📄 msiport.h
字号:
#define MSICSR_PCE 0x00000002 /* Report parity errors */#define MSICSR_SLE 0x00000004 /* Allow SII to respond to selections*/#define MSICSR_HPM 0x00000010 /* SII is operating on arbitrated bus*/ /* Diagnostic Control Reg Mask Bits */#define MSIDCR_PRE 0x00000004 /* Port enable( start bus drivers ) */ /* DSSI Control Register Mask Bits */#define MSIDSCR_CH0 0x00000001 /* Device at port 0 is in DSSI mode */#define MSIDSCR_CH1 0x00000002 /* Device at port 1 is in DSSI mode */#define MSIDSCR_CH2 0x00000004 /* Device at port 2 is in DSSI mode */#define MSIDSCR_CH3 0x00000008 /* Device at port 3 is in DSSI mode */#define MSIDSCR_CH4 0x00000010 /* Device at port 4 is in DSSI mode */#define MSIDSCR_CH5 0x00000020 /* Device at port 5 is in DSSI mode */#define MSIDSCR_CH6 0x00000040 /* Device at port 6 is in DSSI mode */#define MSIDSCR_CH7 0x00000080 /* Device at port 7 is in DSSI mode */#define MSIDSCR_ALLCH 0x000000FF /* Devs at all ports are in DSII mode*/#define MSIDSCR_OUT 0x00004000 /* Enable output transmissions */#define MSIDSCR_DSE 0x00008000 /* Enable DSSI mode in SII chip */#define MSIDSCR_SOUT 0x0000C0FF /* Bit mask settings to start output */ /* DSSI Status Register Mask Bits */#define MSIDSSR_LST 0x00000002 /* SII lost arbitration */#define MSIDSSR_SIP 0x00000004 /* Selection in progress */#define MSIDSSR_SWA 0x00000008 /* SII chip selected with attention */#define MSIDSSR_TGT 0x00000010 /* SII chip operating as target */#define MSIDSSR_DST 0x00000020 /* SII chip selected by another */#define MSIDSSR_CON 0x00000040 /* SII chip connected to another */#define MSIDSSR_SCH 0x00000080 /* SII chip left DSSI mode */#define MSIDSSR_LDN 0x00000100 /* List element done */#define MSIDSSR_BUF 0x00000200 /* Target is not in DSSI mode */#define MSIDSSR_TZ 0x00000400 /* Target ptr 0( receive list empty )*/#define MSIDSSR_OBC 0x00000800 /* Tmo/Target disconn/DSSI bus reset */#define MSIDSSR_BER 0x00001000 /* Bus error */#define MSIDSSR_RST 0x00002000 /* DSSI bus was reset */#define MSIDSSR_CI 0x00008000 /* Composite error bit */#ifdef __mips#define MSIDSSR_FERRS 0x00001208 /* DSSI status reg fatal error bits */#else#define MSIDSSR_FERRS 0x00001288 /* DSSI status reg fatal error bits */#endif /* __mips */ /* ID Register Mask Bits */#define MSIIDR_BUSID 0x00000007 /* Complement - processor DSSI bus ID*/#define MSIIDR_IO 0x00008000 /* Specify processor DSSI bus ID */ /* Timeout Register Mask Bits */#define MSITR_ITV 0x0000000E /* DSSI initiator tmo interval value */ /* ( 14 * 200 usec = 2800 usec ) */#define MSITR_TTV 0x000000C0 /* DSSI target timeout interval value*/ /* ( 12 * 200 usec = 2400 usec ) */#define MSITR_ENA 0x00008000 /* Enable DSSI target & initator tmrs*/ /* SII Command Register Mask Bits */#define SIICOM_SIIRESET 0x00000080 /* Reset SII chip */ /* SII Main Control Diagnostic */ /* Register Mask Bits */#define MSIISR3_WR0 0x00000180 /* SII writing status in IL */#define MSIISR3_WR1 0x00000188 /* SII writing status in IL or TL */#define MSIISR3_STMASK 0x000003FF /* MAIN, XFER and LCTRL state bits *//* MSI Port Command Definitions. */typedef struct _msih { /* MSI Port Header */ u_char opcode; /* Operation code( packet type ) */#define DG 1 /* Datagram */#define MSG 2 /* Message */#define CNF 3 /* Confirm */#define IDREQ 5 /* Identification Request */#define RST 6 /* Reset */#define STRT 7 /* Start */#define DATREQ0 8 /* Data Request @ Priority 0 */#define DATREQ1 9 /* Data Request @ Priority 1 */#define DATREQ2 10 /* Data Request @ Priority 2 */#define ID 11 /* Identification */#define SNTDAT 16 /* Sent Data */#define RETDAT 17 /* Return Data */ struct { /* Operation code modifier flags */ u_char lp : 1; /* Last packet flag */ u_char ns : 3; /* Sending sequence number */ u_char m : 3; /* Packet size multiple */ u_char pkt_size : 1; /* Packet size( always 0 ) */#define Freset pkt_size /* Force reset */#define Dsa pkt_size /* Default start address */#define Pformat pkt_size /* Packing format */ /* Opcode modifier flag bit masks */#define MSIH_LP 0x00000100 /* ( used when performance matters )*/#define MSIH_NS 0x00000E00 /* ( origin is beginning of header )*/#define MSIH_M 0x00007000 /* Opcode modifier flag offsets */#define MSIH_NS_OFFSET 9#define MSIH_M_OFFSET 12 } flags;} MSIH;typedef struct _msicnf { /* CNF Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */} MSI_CNF;typedef struct _msidatreq { /* DATRQE0/DATREQ1/DATREQ2 Pkt Format*/ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */ u_short length[ 2 ]; /* Transaction length */ u_short sbname[ 2 ]; /* Send buffer name */ u_short sboff[ 2 ]; /* Send buffer offset */ u_short rbname[ 2 ]; /* Receive buffer name */ u_short rboff[ 2 ]; /* Receive buffer offset */} MSI_DATREQ;typedef struct _msidg { /* DG Packet Format */ struct _msih ph; /* Port header( also CI PPD length ) */ u_short mtype; /* CI PPD datagram type */ u_char text[ MAX_DG_SIZE ]; /* Datagram text */} MSI_DG;#define DG_OVHD ( sizeof( struct _msih ) + sizeof( u_short ))typedef struct _msiid { /* ID Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */ struct _msi_portid id; /* Local port identification info */} MSI_ID;#define Port_state id.portinfo.sys_state.port_state#define Port_type id.port_typetypedef struct _msiidreq { /* IDREQ Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */} MSI_IDREQ;typedef struct _msilretdat { /* Local RETDAT Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */ u_short rbname[ 2 ]; /* Receive buffer name */ u_short rboff[ 2 ]; /* Receive buffer offset */ u_short : 16; /* Beginning of computation section */ u_short length[ 2 ]; /* Transaction length */ u_short sbname[ 2 ]; /* Send buffer name */ u_short sboff[ 2 ]; /* Send buffer offset */ u_short rcvbname[ 2 ]; /* Receive buffer name */ u_short rcvboff[ 2 ]; /* Receive buffer offset */} MSI_LRETDAT;#define LRETDAT_CSSIZE ( 10 * sizeof( u_short ))typedef struct _msimsg { /* MSG Packet Format */ struct _msih ph; /* Port header( CI PPD length ) */ u_short mtype; /* CI PPD sequenced message type */ u_char text[ MAX_MSG_SIZE ]; /* Message text */} MSI_MSG;#define MSG_OVHD ( sizeof( struct _msih ) + sizeof( u_short ))typedef struct _msiretdat { /* RETDAT Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */ u_short rbname[ 2 ]; /* Receive buffer name */ u_short rboff[ 2 ]; /* Receive buffer offset */ u_char data[ MAX_DATA_SIZE ]; /* Data */} MSI_RETDAT;#define RETDAT_OVHD ( sizeof( struct _msih ) + ( 8 * sizeof( u_short )))typedef struct _msirst { /* RST Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */} MSI_RST;typedef struct _msisntdat { /* SNTDAT Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */ u_short rbname[ 2 ]; /* Receive buffer name */ u_short rboff[ 2 ]; /* Receive buffer offset */ u_char data[ MAX_DATA_SIZE ]; /* Data */} MSI_SNTDAT;#define SNTDAT_MINSIZE ( sizeof( struct _msih ) + ( 8 * sizeof( u_short )))typedef struct _msistrt { /* STRT Packet Format */ struct _msih ph; /* Port header */ u_short xctid[ 4 ]; /* Transaction identifier */ u_short strt_addr[ 2 ]; /* Start address */} MSI_STRT;typedef union _msipacket { /* MSI Packet Formats */ struct _msih ph; /* Common to all packet formats */ struct _msicnf cnf; /* CNF */ struct _msidatreq datreq; /* DATREQ0/DATREQ1/DATREQ2 */ struct _msidg dg; /* DG */ struct _msiid id; /* ID */ struct _msiidreq idreq; /* REQID */ struct _msilretdat lretdat; /* Local form of REDAT */ struct _msimsg msg; /* MSG */ struct _msiretdat retdat; /* RETDAT */ struct _msirst rst; /* RST */ struct _msisntdat sntdat; /* SNTDAT */ struct _msistrt strt; /* STRT */} MSIPACKET;/* MSI Data Structure Definitions. */typedef struct _msibh { /* MSI Buffer Header */ struct _msibq *flink; /* Queue pointers */ struct _msibq *blink; u_short size; /* Size of buffer */ u_char type; /* Structure type */ u_char opt; /* Optional field */ /* Deallocate MSIB following xfer */#define MSI_BM_DBUF 0x01 /* "Byte Mask" */#define MSI_DEALLOC_BUF DEALLOC_BUF /* "Longword" Mask */ /* VC required */#define MSI_BM_VC 0x02 /* "Byte Mask" */#define MSI_VC 0x02000000 /* "Longword" Mask */ u_long retdat_size; /* RETDAT packet size( bytes ) */ u_char msibhpad; /* Unused( present for alignment ) */ u_char rport_addr; /* Remote port station address */ u_short framelength; /* Length of frame to transmit */} MSIBH;typedef struct _msib { /* MSI Buffer */ struct _msibh bh; /* Buffer Header */ union _msipacket pkt; /* Packet */} MSIB;#define MSIB_RCVOVHD 3 /* MSIB Receive Packet Overhead */ /* ( rport_addr, framelength ) */#define Blink bh.blink#define Flink bh.flink#define Framelength bh.framelength#define Msibhpad bh.msibhpad#define Opt bh.opt#define Retdat_size bh.retdat_size#define Rport_addr bh.rport_addr#define Size bh.size#define Type bh.type#define Cnf pkt.cnf#define Datreq pkt.datreq#define Dg pkt.dg#define Id pkt.id#define Idreq pkt.idreq#define Lretdat pkt.lretdat#define Msg pkt.msg#define Ph pkt.ph#define Retdat pkt.retdat#define Rst pkt.rst#define Sntdat pkt.sntdat#define Strt pkt.strt/* MSI Port Specific Data Structure Definitions. */typedef struct _msicmdblk { /* MSI Command Block */ u_short thread; /* Address of next command block */ u_short status; /* Status of current transaction */#define ST_DNE 0x8000 /* Block owned by port driver */#define ST_RST 0x0080 /* DSSI reset during transaction */#define ST_TMO 0x0040 /* Timeout during transaction */#define ST_XSM 0x0020 /* Checksum mismatch( target ) */#define ST_BPH 0x0010 /* Target in bad phase( initiator ) */#define ST_STT 0x0008 /* Target not ret ACK( initiator ) */#define ST_PHS 0x0004 /* Unexpected bus phase( initiator )*/#define ST_DSA 0x0002 /* Error in command bytes( target ) */#define ST_PAR 0x0001 /* Parity error detected */ /* Summary statuses */#define ST_SUCCESS ((u_short)ST_DNE)/* Successful transaction */#define ST_NACK_IS_ACK ((u_short)0x8008)/* NACK is really ACK( initiator ) */ u_short command; /* Command word */#define CMD_IE 0x8000 /* Interrupt when transaction done */#define CMD_DSTID 0x0007 /* ID of target( initiator ) */ u_short opcode; /* Command operation code */#define CMDOPC_REQACK 0x3000 /* REQ/ACK offset value of field */#define CMDOPC_GROUPC 0x00E0 /* Group code value of field */#define CMDOPC_OPCODE 0x30E0 /* Command operation code to use */ u_char dst; /* Destination port station address */ u_char src; /* Source port station address */ u_short length; /* Frame length( ie- size of data ) */} MSICMDBLK;typedef struct _msixmtlnk { /* MSI Transmit Data Segment Link */ u_short len; /* Length of next segment */#define LINK 0x8000 /* Data segment follows the next one*/ u_short addr; /* Nxt data segmnt addr( bits 17:02)*/} MSIXMTLNK;typedef struct _siibuf { /* SII RAM Transmit/Receive Buffer */ struct _siibq *flink; /* Queue pointers */ struct _siibq *blink; u_short size; /* Size of buffer */ u_char type; /* Structure type */ u_char opt; /* Optional field */ struct _msib *save_msib; /* Saved MSIB address */ u_short cmdblkaddr; /* MSI command block SII RAM address */ u_short xpktaddr; /* Transmit data block SII RAM addr */ /* ( Transmit SII RAM buffer ONLY ) */ u_long : 32; /* ( Pad for Quadword alignment ) */ struct _msicmdblk cmdblk; /* Buffer MSI command block */ union { /* Transmit/Receive specific portion */ struct { /* Transmit SII RAM buffer portion */ struct _msixmtlnk link; /* Link to xmt data block segment */ union _msipacket pkt; /* Transmit data block */ } xmt; struct { /* Receive SII RAM buffer portion */ union _msipacket pkt; /* Receive data block */ } rcv; } un;#define Xlink un.xmt.link#define Rpkt un.rcv.pkt#define Xpkt un.xmt.pkt} SIIBUF;/* MSI Macros. */ /* Buffer Name Field Macros */#define Bindex( bname ) bname[ 0 ]#define Bkey( bname ) bname[ 1 ] /* Double Mapping Macros */#define Check_bname( bname, bdp ) \ (( Bindex( bname ) <= ( lscs.max_msibds - 1 )) && \ ( Bkey( bname ) == ( bdp = ( msi_bddb->bdt + Bindex( bname )))->key ) &&\ bdp->valid )#define Check_bsize( bdp, dminfo ) \ (( dminfo.ssize == 0 ) || ( bdp->bsize >= ( dminfo.ssize + dminfo.Sboff )))#define Setup_dmap( bdp, dminfo ) { \ register u_char *toaddr; \ register u_long nptes; \ register struct pte *fptep, *tptep; \ dminfo.Sboff += ( U_short( *bdp ) & PGOFSET ); \ if (( U_short( *bdp ) & 0x4000 )) { \ dminfo.Saddr = ( u_char * )((u_long)bdp->bpte & ~PGOFSET) + dminfo.Sboff ; \ } \ else if (( unsigned )bdp->bpte >= ( unsigned )Sysmap && \ ( unsigned )bdp->bpte < ( unsigned )( Sysmap + sysptsize )) { \ dminfo.Saddr = ( u_char * )sptetosva( bdp->bpte ) + dminfo.Sboff; \ } else { \ for( toaddr = ( u_char * )dminfo.dmap_baddr, \ nptes = rbtop( dminfo.ssize + ( dminfo.Sboff & PGOFSET )),\ fptep = ( bdp->bpte + btop( dminfo.Sboff )), \ tptep = dminfo.dmap_bpteaddr; \ nptes-- > 0; \ toaddr += NBPG ) { \ *( u_long * )tptep++ \ = ((*( u_long * )fptep++ & PG_PFNUM ) | dminfo.protopte ); \ Tbis( toaddr ); \ } \ dminfo.Saddr = ( u_char * )( dminfo.dmap_baddr + \ ( dminfo.Sboff & PGOFSET )); \ } \}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -