📄 aacraid.h
字号:
#if (!defined(dprintk))# define dprintk(x)#endif/*------------------------------------------------------------------------------ * D E F I N E S *----------------------------------------------------------------------------*/#define MAXIMUM_NUM_CONTAINERS 32#define MAXIMUM_NUM_ADAPTERS 8#define AAC_NUM_FIB (256 + 64)#define AAC_NUM_IO_FIB 100#define AAC_MAX_LUN (8)#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)/* * These macros convert from physical channels to virtual channels */#define CONTAINER_CHANNEL (0)#define ID_LUN_TO_CONTAINER(id, lun) (id)#define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL)#define CONTAINER_TO_ID(cont) (cont)#define CONTAINER_TO_LUN(cont) (0)#define aac_phys_to_logical(x) (x+1)#define aac_logical_to_phys(x) (x?x-1:0)#define AAC_DETAILED_STATUS_INFOextern int nondasd;extern int paemode;struct diskparm{ int heads; int sectors; int cylinders;};/* * DON'T CHANGE THE ORDER, this is set by the firmware */ #define CT_NONE 0#define CT_VOLUME 1#define CT_MIRROR 2#define CT_STRIPE 3#define CT_RAID5 4#define CT_SSRW 5#define CT_SSRO 6#define CT_MORPH 7#define CT_PASSTHRU 8#define CT_RAID4 9#define CT_RAID10 10 /* stripe of mirror */#define CT_RAID00 11 /* stripe of stripe */#define CT_VOLUME_OF_MIRRORS 12 /* volume of mirror */#define CT_PSEUDO_RAID 13 /* really raid4 */#define CT_LAST_VOLUME_TYPE 14/* * Types of objects addressable in some fashion by the client. * This is a superset of those objects handled just by the filesystem * and includes "raw" objects that an administrator would use to * configure containers and filesystems. */#define FT_REG 1 /* regular file */#define FT_DIR 2 /* directory */#define FT_BLK 3 /* "block" device - reserved */#define FT_CHR 4 /* "character special" device - reserved */#define FT_LNK 5 /* symbolic link */#define FT_SOCK 6 /* socket */#define FT_FIFO 7 /* fifo */#define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */#define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */#define FT_SLICE 10 /* virtual disk - raw volume - slice */#define FT_PARTITION 11 /* FSA partition - carved out of a slice - building block for containers */#define FT_VOLUME 12 /* Container - Volume Set */#define FT_STRIPE 13 /* Container - Stripe Set */#define FT_MIRROR 14 /* Container - Mirror Set */#define FT_RAID5 15 /* Container - Raid 5 Set */#define FT_DATABASE 16 /* Storage object with "foreign" content manager *//* * Host side memory scatter gather list * Used by the adapter for read, write, and readdirplus operations * We have separate 32 and 64 bit version because even * on 64 bit systems not all cards support the 64 bit version */struct sgentry { u32 addr; /* 32-bit address. */ u32 count; /* Length. */};struct sgentry64 { u32 addr[2]; /* 64-bit addr. 2 pieces for data alignment */ u32 count; /* Length. */};/* * SGMAP * * This is the SGMAP structure for all commands that use * 32-bit addressing. */struct sgmap { u32 count; struct sgentry sg[1]; };struct sgmap64 { u32 count; struct sgentry64 sg[1];};struct creation_info{ u8 buildnum; /* e.g., 588 */ u8 usec; /* e.g., 588 */ u8 via; /* e.g., 1 = FSU, * 2 = API */ u8 year; /* e.g., 1997 = 97 */ u32 date; /* * unsigned Month :4; // 1 - 12 * unsigned Day :6; // 1 - 32 * unsigned Hour :6; // 0 - 23 * unsigned Minute :6; // 0 - 60 * unsigned Second :6; // 0 - 60 */ u32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */};/* * Define all the constants needed for the communication interface *//* * Define how many queue entries each queue will have and the total * number of entries for the entire communication interface. Also define * how many queues we support. * * This has to match the controller */#define NUMBER_OF_COMM_QUEUES 8 // 4 command; 4 response#define HOST_HIGH_CMD_ENTRIES 4#define HOST_NORM_CMD_ENTRIES 8#define ADAP_HIGH_CMD_ENTRIES 4#define ADAP_NORM_CMD_ENTRIES 512#define HOST_HIGH_RESP_ENTRIES 4#define HOST_NORM_RESP_ENTRIES 512#define ADAP_HIGH_RESP_ENTRIES 4#define ADAP_NORM_RESP_ENTRIES 8#define TOTAL_QUEUE_ENTRIES \ (HOST_NORM_CMD_ENTRIES + HOST_HIGH_CMD_ENTRIES + ADAP_NORM_CMD_ENTRIES + ADAP_HIGH_CMD_ENTRIES + \ HOST_NORM_RESP_ENTRIES + HOST_HIGH_RESP_ENTRIES + ADAP_NORM_RESP_ENTRIES + ADAP_HIGH_RESP_ENTRIES)/* * Set the queues on a 16 byte alignment */ #define QUEUE_ALIGNMENT 16/* * The queue headers define the Communication Region queues. These * are physically contiguous and accessible by both the adapter and the * host. Even though all queue headers are in the same contiguous block * they will be represented as individual units in the data structures. */struct aac_entry { u32 size; /* Size in bytes of Fib which this QE points to */ u32 addr; /* Receiver address of the FIB */};/* * The adapter assumes the ProducerIndex and ConsumerIndex are grouped * adjacently and in that order. */ struct aac_qhdr { u64 header_addr; /* Address to hand the adapter to access to this queue head */ u32 *producer; /* The producer index for this queue (host address) */ u32 *consumer; /* The consumer index for this queue (host address) */};/* * Define all the events which the adapter would like to notify * the host of. */ #define HostNormCmdQue 1 /* Change in host normal priority command queue */#define HostHighCmdQue 2 /* Change in host high priority command queue */#define HostNormRespQue 3 /* Change in host normal priority response queue */#define HostHighRespQue 4 /* Change in host high priority response queue */#define AdapNormRespNotFull 5#define AdapHighRespNotFull 6#define AdapNormCmdNotFull 7#define AdapHighCmdNotFull 8#define SynchCommandComplete 9#define AdapInternalError 0xfe /* The adapter detected an internal error shutting down *//* * Define all the events the host wishes to notify the * adapter of. The first four values much match the Qid the * corresponding queue. */#define AdapNormCmdQue 2#define AdapHighCmdQue 3#define AdapNormRespQue 6#define AdapHighRespQue 7#define HostShutdown 8#define HostPowerFail 9#define FatalCommError 10#define HostNormRespNotFull 11#define HostHighRespNotFull 12#define HostNormCmdNotFull 13#define HostHighCmdNotFull 14#define FastIo 15#define AdapPrintfDone 16/* * Define all the queues that the adapter and host use to communicate * Number them to match the physical queue layout. */enum aac_queue_types { HostNormCmdQueue = 0, /* Adapter to host normal priority command traffic */ HostHighCmdQueue, /* Adapter to host high priority command traffic */ AdapNormCmdQueue, /* Host to adapter normal priority command traffic */ AdapHighCmdQueue, /* Host to adapter high priority command traffic */ HostNormRespQueue, /* Adapter to host normal priority response traffic */ HostHighRespQueue, /* Adapter to host high priority response traffic */ AdapNormRespQueue, /* Host to adapter normal priority response traffic */ AdapHighRespQueue /* Host to adapter high priority response traffic */};/* * Assign type values to the FSA communication data structures */#define FIB_MAGIC 0x0001/* * Define the priority levels the FSA communication routines support. */#define FsaNormal 1#define FsaHigh 2/* * Define the FIB. The FIB is the where all the requested data and * command information are put to the application on the FSA adapter. */struct aac_fibhdr { u32 XferState; // Current transfer state for this CCB u16 Command; // Routing information for the destination u8 StructType; // Type FIB u8 Flags; // Flags for FIB u16 Size; // Size of this FIB in bytes u16 SenderSize; // Size of the FIB in the sender (for response sizing) u32 SenderFibAddress; // Host defined data in the FIB u32 ReceiverFibAddress; // Logical address of this FIB for the adapter u32 SenderData; // Place holder for the sender to store data union { struct { u32 _ReceiverTimeStart; // Timestamp for receipt of fib u32 _ReceiverTimeDone; // Timestamp for completion of fib } _s; } _u;};#define FIB_DATA_SIZE_IN_BYTES (512 - sizeof(struct aac_fibhdr))struct hw_fib { struct aac_fibhdr header; u8 data[FIB_DATA_SIZE_IN_BYTES]; // Command specific data};/* * FIB commands */#define TestCommandResponse 1#define TestAdapterCommand 2/* * Lowlevel and comm commands */#define LastTestCommand 100#define ReinitHostNormCommandQueue 101#define ReinitHostHighCommandQueue 102#define ReinitHostHighRespQueue 103#define ReinitHostNormRespQueue 104#define ReinitAdapNormCommandQueue 105#define ReinitAdapHighCommandQueue 107#define ReinitAdapHighRespQueue 108#define ReinitAdapNormRespQueue 109#define InterfaceShutdown 110#define DmaCommandFib 120#define StartProfile 121#define TermProfile 122#define SpeedTest 123#define TakeABreakPt 124#define RequestPerfData 125#define SetInterruptDefTimer 126#define SetInterruptDefCount 127#define GetInterruptDefStatus 128#define LastCommCommand 129/* * Filesystem commands */#define NuFileSystem 300#define UFS 301#define HostFileSystem 302#define LastFileSystemCommand 303/* * Container Commands */#define ContainerCommand 500#define ContainerCommand64 501/* * Cluster Commands */#define ClusterCommand 550/* * Scsi Port commands (scsi passthrough) */#define ScsiPortCommand 600#define ScsiPortCommand64 601/* * Misc house keeping and generic adapter initiated commands */#define AifRequest 700#define CheckRevision 701#define FsaHostShutdown 702#define RequestAdapterInfo 703#define IsAdapterPaused 704#define SendHostTime 705#define LastMiscCommand 706//// Commands that will target the failover level on the FSA adapter//enum fib_xfer_state { HostOwned = (1<<0), AdapterOwned = (1<<1), FibInitialized = (1<<2), FibEmpty = (1<<3), AllocatedFromPool = (1<<4), SentFromHost = (1<<5), SentFromAdapter = (1<<6), ResponseExpected = (1<<7), NoResponseExpected = (1<<8), AdapterProcessed = (1<<9), HostProcessed = (1<<10), HighPriority = (1<<11), NormalPriority = (1<<12), Async = (1<<13), AsyncIo = (1<<13), // rpbfix: remove with new regime PageFileIo = (1<<14), // rpbfix: remove with new regime ShutdownRequest = (1<<15), LazyWrite = (1<<16), // rpbfix: remove with new regime AdapterMicroFib = (1<<17), BIOSFibPath = (1<<18), FastResponseCapable = (1<<19), ApiFib = (1<<20) // Its an API Fib.};/* * The following defines needs to be updated any time there is an * incompatible change made to the aac_init structure. */#define ADAPTER_INIT_STRUCT_REVISION 3struct aac_init{ u32 InitStructRevision; u32 MiniPortRevision; u32 fsrev; u32 CommHeaderAddress; u32 FastIoCommAreaAddress; u32 AdapterFibsPhysicalAddress; u32 AdapterFibsVirtualAddress; u32 AdapterFibsSize; u32 AdapterFibAlign; u32 printfbuf; u32 printfbufsiz; u32 HostPhysMemPages; // number of 4k pages of host physical memory u32 HostElapsedSeconds; // number of seconds since 1970.};enum aac_log_level { LOG_INIT = 10, LOG_INFORMATIONAL = 20, LOG_WARNING = 30, LOG_LOW_ERROR = 40, LOG_MEDIUM_ERROR = 50, LOG_HIGH_ERROR = 60, LOG_PANIC = 70, LOG_DEBUG = 80, LOG_WINDBG_PRINT = 90};#define FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT 0x030b#define FSAFS_NTC_FIB_CONTEXT 0x030cstruct aac_dev;struct adapter_ops{ void (*adapter_interrupt)(struct aac_dev *dev); void (*adapter_notify)(struct aac_dev *dev, u32 event); void (*adapter_enable_int)(struct aac_dev *dev, u32 event); void (*adapter_disable_int)(struct aac_dev *dev, u32 event); int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 *status); int (*adapter_check_health)(struct aac_dev *dev);};/* * Define which interrupt handler needs to be installed */struct aac_driver_ident{ int (*init)(struct aac_dev *dev); char * name; char * vname; char * model; u16 channels; int quirks;};/* * Some adapter firmware needs communication memory * below 2gig. This tells the init function to set the * dma mask such that fib memory will be allocated where the * adapter firmware can get to it. */#define AAC_QUIRK_31BIT 1/* * The adapter interface specs all queues to be located in the same * physically contigous block. The host structure that defines the * commuication queues will assume they are each a separate physically * contigous memory region that will support them all being one big * contigous block. * There is a command and response queue for each level and direction of * commuication. These regions are accessed by both the host and adapter. */ struct aac_queue { u64 logical; /*address we give the adapter */ struct aac_entry *base; /*system virtual address */ struct aac_qhdr headers; /*producer,consumer q headers*/ u32 entries; /*Number of queue entries */ wait_queue_head_t qfull; /*Event to wait on if q full */ wait_queue_head_t cmdready; /*Cmd ready from the adapter */ /* This is only valid for adapter to host command queues. */ spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ unsigned long SavedIrql; /* Previous IRQL when the spin lock is taken */ u32 padding; /* Padding - FIXME - can remove I believe */ struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ /* only valid for command queues which receive entries from the adapter. */ struct list_head pendingq; /* A queue of outstanding fib's to the adapter. */ u32 numpending; /* Number of entries on outstanding queue. */ struct aac_dev * dev; /* Back pointer to adapter structure */};/* * Message queues. The order here is important, see also the * queue type ordering */struct aac_queue_block
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -