📄 cpqfctsstructs.h
字号:
UCHAR DNC : 1; UCHAR DIN : 1; UCHAR DCM : 1; UCHAR CTS : 1; UCHAR SBV : 1; // IRB entry valid - IRB'B' only} IRBflags;typedef struct // I/O Request Block{ // Request 'A' ULONG Req_A_SFS_Len; // total frame len (hdr + payload), min 32 ULONG Req_A_SFS_Addr; // 32-bit pointer to FCHS struct (to be sent) ULONG Req_A_SFS_D_ID; // 24-bit FC destination (i.e. 8 bit al_pa) ULONG Req_A_Trans_ID; // X_ID (OX_ID or RX_ID) and/or Index in SEST // Request 'B' ULONG Req_B_SFS_Len; // total frame len (hdr + payload), min 32 ULONG Req_B_SFS_Addr; // 32-bit pointer to FCHS struct (to be sent) ULONG Req_B_SFS_D_ID; // 24-bit FC destination (i.e. 8 bit al_pa) ULONG Req_B_Trans_ID; // X_ID (OX_ID or RX_ID) and/or Index in SEST} TachLiteIRB;typedef struct // TachLite placeholder for IRBs{ // aligned @sizeof(ERQ) for TachLite // MAX commands is sum of SEST len and ERQ // we know that each SEST entry requires an // IRB (ERQ) entry; in addition, we provide // ERQ_LEN TachLiteIRB QEntry[ERQ_LEN]; // Base register; entries 32 bytes ea. ULONG consumerIndex; // Consumer Index register ULONG producerIndex; // ERQ Producer Index register ULONG length; // Length register ULONG base; // copy of base ptr for debug // struct is sized for largest expected cmnd (LOGIN)} TachLiteERQ;// for now, just 32 bit DMA, eventually 40something, with code changes#define CPQFCTS_DMA_MASK ((unsigned long) (0x00000000FFFFFFFF))#define TL_MAX_SG_ELEM_LEN 0x7ffff // Max buffer length a single S/G entry // may represent (a hardware limitation). The // only reason to ever change this is if you // want to exercise very-hard-to-reach code in // cpqfcTSworker.c:build_SEST_sglist().#define TL_DANGER_SGPAGES 7 // arbitrary high water mark for # of S/G pages // we must exceed to elicit a warning indicative // of EXTREMELY large data transfers or // EXTREME memory fragmentation. // (means we just used up 2048 S/G elements, // Never seen this is real life, only in // testing with tricked up driver.)#define TL_EXT_SG_PAGE_COUNT 256 // Number of Extended Scatter/Gather a/l PAIRS // Tachyon register (IOBaseU 0x68) // power-of-2 value ONLY! 4 min, 256 max // byte len is #Pairs * 2 ULONG/Pair * 4 bytes/ULONG#define TL_EXT_SG_PAGE_BYTELEN (TL_EXT_SG_PAGE_COUNT *2 *4)// SEST entry types: IWE, IRE, TWE, TREtypedef struct { ULONG Hdr_Len; ULONG Hdr_Addr; ULONG RSP_Len; ULONG RSP_Addr; ULONG Buff_Off;#define USES_EXTENDED_SGLIST(this_sest, x_ID) \ (!((this_sest)->u[ x_ID ].IWE.Buff_Off & 0x80000000)) ULONG Link; ULONG RX_ID; ULONG Data_Len; ULONG Exp_RO; ULONG Exp_Byte_Cnt; // --- extended/local Gather Len/Address pairs ULONG GLen1; ULONG GAddr1; ULONG GLen2; ULONG GAddr2; ULONG GLen3; ULONG GAddr3;} TachLiteIWE;typedef struct { ULONG Seq_Accum; ULONG reserved; // must clear to 0 ULONG RSP_Len; ULONG RSP_Addr; ULONG Buff_Off; ULONG Buff_Index; // ULONG 5 ULONG Exp_RO; ULONG Byte_Count; ULONG reserved_; // ULONG 8 ULONG Exp_Byte_Cnt; // --- extended/local Scatter Len/Address pairs ULONG SLen1; ULONG SAddr1; ULONG SLen2; ULONG SAddr2; ULONG SLen3; ULONG SAddr3;} TachLiteIRE;typedef struct // Target Write Entry{ ULONG Seq_Accum; // dword 0 ULONG reserved; // dword 1 must clear to 0 ULONG Remote_Node_ID; ULONG reserved1; // dword 3 must clear to 0 ULONG Buff_Off; ULONG Buff_Index; // ULONG 5 ULONG Exp_RO; ULONG Byte_Count; ULONG reserved_; // ULONG 8 ULONG Exp_Byte_Cnt; // --- extended/local Scatter Len/Address pairs ULONG SLen1; ULONG SAddr1; ULONG SLen2; ULONG SAddr2; ULONG SLen3; ULONG SAddr3;} TachLiteTWE;typedef struct { ULONG Hdr_Len; ULONG Hdr_Addr; ULONG RSP_Len; // DWord 2 ULONG RSP_Addr; ULONG Buff_Off; ULONG Buff_Index; // DWord 5 ULONG reserved; ULONG Data_Len; ULONG reserved_; ULONG reserved__; // --- extended/local Gather Len/Address pairs ULONG GLen1; // DWord A ULONG GAddr1; ULONG GLen2; ULONG GAddr2; ULONG GLen3; ULONG GAddr3;} TachLiteTRE;typedef struct ext_sg_page_ptr_t *PSGPAGES;typedef struct ext_sg_page_ptr_t { unsigned char page[TL_EXT_SG_PAGE_BYTELEN * 2]; // 2x for alignment dma_addr_t busaddr; // need the bus addresses and unsigned int maplen; // lengths for later pci unmapping. PSGPAGES next;} SGPAGES; // linked list of S/G pairs, by Exchangetypedef struct // SCSI Exchange State Table{ union // Entry can be IWE, IRE, TWE, TRE { // 64 bytes per entry TachLiteIWE IWE; TachLiteIRE IRE; TachLiteTWE TWE; TachLiteTRE TRE; } u[TACH_SEST_LEN]; TachFCHDR DataHDR[TACH_SEST_LEN]; // for SEST FCP_DATA frame hdr (no pl) TachFCHDR_RSP RspHDR[TACH_SEST_LEN]; // space for SEST FCP_RSP frame PSGPAGES sgPages[TACH_SEST_LEN]; // head of linked list of Pool-allocations ULONG length; // Length register ULONG base; // copy of base ptr for debug} TachSEST;typedef struct // each register has it's own address // and value (used for write-only regs){ void* address; volatile ULONG value;} FCREGISTER;typedef struct // Host copy - TachLite Registers{ ULONG IOBaseL, IOBaseU; // I/O port lower and upper TL register addresses ULONG MemBase; // memory mapped register addresses void* ReMapMemBase; // O/S VM reference for MemBase ULONG wwn_hi; // WWN is set once at startup ULONG wwn_lo; ULONG my_al_pa; // al_pa received after LIP() ULONG ROMCTR; // flags for on-board RAM/ROM ULONG RAMBase; // on-board RAM (i.e. some Tachlites) ULONG SROMBase; // on-board EEPROM (some Tachlites) ULONG PCIMCTR; // PCI Master Control Reg (has bus width) FCREGISTER INTEN; // copy of interrupt enable mask FCREGISTER INTPEND; // interrupt pending FCREGISTER INTSTAT; // interrupt status FCREGISTER SFQconsumerIndex; FCREGISTER ERQproducerIndex; FCREGISTER TYconfig; // TachYon (chip level) FCREGISTER TYcontrol; FCREGISTER TYstatus; FCREGISTER FMconfig; // Frame Manager (FC loop level) FCREGISTER FMcontrol; FCREGISTER FMstatus; FCREGISTER FMLinkStatus1; FCREGISTER FMLinkStatus2; FCREGISTER FMBB_CreditZero; FCREGISTER status; FCREGISTER ed_tov; // error detect time-out value FCREGISTER rcv_al_pa; // received arb. loop physical address FCREGISTER primitive; // e.g. LIP(), OPN(), ...} TL_REGISTERS;typedef struct { ULONG ok; ULONG invalidArgs; ULONG linkDown; ULONG linkUp; ULONG outQueFull; ULONG SESTFull; ULONG hpe; // host programming err (from Tach) ULONG FC4aborted; // aborts from Application or upper driver layer ULONG FC2aborted; // aborts from our driver's timeouts ULONG timeouts; // our driver timeout (on individual exchanges) ULONG logouts; // explicit - sent LOGO; implicit - device removed ULONG retries; ULONG linkFailTX; ULONG linkFailRX; ULONG CntErrors; // byte count expected != count received (typ. SEST) ULONG e_stores; // elastic store errs ULONG resets; // hard or soft controller resets ULONG FMinits; // TACH Frame Manager Init (e.g. LIPs) ULONG lnkQueFull; // too many LOGIN, loop commands ULONG ScsiQueFull; // too many FCP-SCSI inbound frames ULONG LossofSignal; // FM link status 1 regs ULONG BadRXChar; // FM link status 1 regs ULONG LossofSync; // FM link status 1 regs ULONG Rx_EOFa; // FM link status 2 regs (received EOFa) ULONG Dis_Frm; // FM link status 2 regs (discarded frames) ULONG Bad_CRC; // FM link status 2 regs ULONG BB0_Timer; // FM BB_Credit Zero Timer Reg ULONG loopBreaks; // infinite loop exits ULONG lastBB0timer; // static accum. buffer needed by Tachlite} FCSTATS;typedef struct // Config Options{ // LS Bit first USHORT : 1; // bit0: USHORT flogi : 1; // bit1: We sent FLOGI - wait for Fabric logins USHORT fabric: 1; // bit2: Tachyon detected Fabric (FM stat LG) USHORT LILPin: 1; // bit3: We can use an FC-AL LILP frame USHORT target: 1; // bit4: this Port has SCSI target capability USHORT initiator: 1; // bit5: this Port has SCSI initiator capability USHORT extLoopback: 1; // bit6: loopback at GBIC USHORT intLoopback: 1; // bit7: loopback in HP silicon USHORT : 1; // bit8: USHORT : 1; // bit9: USHORT : 1; // bit10: USHORT : 1; // bit11: USHORT : 1; // bit12: USHORT : 1; // bit13: USHORT : 1; // bit14: USHORT : 1; // bit15:} FC_OPTIONS;typedef struct dyn_mem_pair{ void *BaseAllocated; // address as allocated from O/S; unsigned long AlignedAddress; // aligned address (used by Tachyon DMA) dma_addr_t dma_handle; size_t size;} ALIGNED_MEM;// these structs contain only CRUCIAL (stuff we actually use) parameters// from FC-PH(n) logins. (Don't save entire LOGIN payload to save mem.)// Implicit logout happens when the loop goes down - we require PDISC// to restore. Explicit logout is when WE decide never to talk to someone,// or when a target refuses to talk to us, i.e. sends us a LOGO frame or// LS_RJT reject in response to our PLOGI request.#define IMPLICIT_LOGOUT 1#define EXPLICIT_LOGOUT 2typedef struct { UCHAR channel; // SCSI "bus" UCHAR target; UCHAR InqDeviceType; // byte 0 from SCSI Inquiry response UCHAR VolumeSetAddressing; // FCP-SCSI LUN coding (40h for VSA) UCHAR LunMasking; // True if selective presentation supported UCHAR lun[CPQFCTS_MAX_LUN];} SCSI_NEXUS;typedef struct { union { UCHAR ucWWN[8]; // a FC 64-bit World Wide Name/ PortID of target // addressing of single target on single loop... u64 liWWN; } u; ULONG port_id; // a FC 24-bit address of port (lower 8 bits = al_pa) Scsi_Cmnd ScsiCmnd; // command buffer for Report Luns#define REPORT_LUNS_PL 256 UCHAR ReportLunsPayload[REPORT_LUNS_PL]; SCSI_NEXUS ScsiNexus; // LUNs per FC device ULONG LOGO_counter; // might try several times before logging out for good ULONG LOGO_timer; // after LIP, ports expecting PDISC must time-out and // LOGOut if successful PDISC not completed in 2 secs ULONG concurrent_seq; // must be 1 or greater ULONG rx_data_size; // e.g. 128, 256, 1024, 2048 per FC-PH spec ULONG BB_credit; ULONG EE_credit; ULONG fcp_info; // from PRLI (i.e. INITIATOR/ TARGET flags) // flags for login process BOOLEAN Originator; // Login sequence Originated (if false, we // responded to another port's login sequence) BOOLEAN plogi; // PLOGI frame ACCepted (originated or responded) BOOLEAN pdisc; // PDISC frame was ORIGINATED (self-login logic) BOOLEAN prli; // PRLI frame ACCepted (originated or responded) BOOLEAN flogi; // FLOGI frame ACCepted (originated or responded) BOOLEAN logo; // port permanently logged out (invalid login param) BOOLEAN flogiReq; // Fabric login required (set in LIP process) UCHAR highest_ver; UCHAR lowest_ver; // when the "target" (actually FC Port) is waiting for login // (e.g. after Link reset), set the device_blocked bit; // after Port completes login, un-block target. UCHAR device_blocked; // see Scsi_Device struct // define singly-linked list of logged-in ports // once a port_id is identified, it is remembered, // even if the port is removed indefinitely PVOID pNextPort; // actually, type PFC_LOGGEDIN_PORT; void for Compiler} FC_LOGGEDIN_PORT, *PFC_LOGGEDIN_PORT;// This serves as the ESB (Exchange Status Block),// and has timeout counter; used for ABORTstypedef struct { // FC-1 X_IDs ULONG type; // ELS_PLOGI, SCSI_IWE, ... (0 if free) PFC_LOGGEDIN_PORT pLoggedInPort; // FC device on other end of Exchange Scsi_Cmnd *Cmnd; // Linux SCSI command packet includes S/G list ULONG timeOut; // units of ??, DEC by driver, Abort when 0 ULONG reTries; // need one or more retries? ULONG status; // flags indicating errors (0 if none) TachLiteIRB IRB; // I/O Request Block, gets copied to ERQ TachFCHDR_GCMND fchs; // location of IRB's Req_A_SFS_Addr} FC_EXCHANGE, *PFC_EXCHANGE;// Unfortunately, Linux limits our kmalloc() allocations to 128k.// Because of this and the fact that our ScsiRegister allocation// is also constrained, we move this large structure out for// allocation after Scsi Register.// (In other words, this cumbersome indirection is necessary
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -