154 #define qib7322_readq( _qib7322, _ptr, _offset ) \ 155 qib7322_readq ( (_qib7322), (_ptr)->u.qwords, (_offset) ) 156 #define qib7322_readq_array8b( _qib7322, _ptr, _offset, _idx ) \ 157 qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) ) 158 #define qib7322_readq_array64k( _qib7322, _ptr, _offset, _idx ) \ 159 qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ) ) 160 #define qib7322_readq_port( _qib7322, _ptr, _offset, _port ) \ 161 qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) ) ) 174 #define qib7322_writeq( _qib7322, _ptr, _offset ) \ 175 qib7322_writeq ( (_qib7322), (_ptr)->u.qwords, (_offset) ) 176 #define qib7322_writeq_array8b( _qib7322, _ptr, _offset, _idx ) \ 177 qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) ) 178 #define qib7322_writeq_array64k( _qib7322, _ptr, _offset, _idx ) \ 179 qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) )) 180 #define qib7322_writeq_port( _qib7322, _ptr, _offset, _port ) \ 181 qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) )) 209 switch ( link_state ) {
215 default:
return "UNKNOWN";
229 unsigned int link_training_state;
230 unsigned int link_state;
231 unsigned int link_width;
232 unsigned int link_speed;
233 unsigned int link_speed_qdr;
240 link_training_state =
BIT_GET ( &ibcstatusa, LinkTrainingState );
241 link_state =
BIT_GET ( &ibcstatusa, LinkState );
242 link_width =
BIT_GET ( &ibcstatusa, LinkWidthActive );
243 link_speed =
BIT_GET ( &ibcstatusa, LinkSpeedActive );
244 link_speed_qdr =
BIT_GET ( &ibcstatusa, LinkSpeedQDR );
245 DBGC (
qib7322,
"QIB7322 %p port %d training state %#x link state %s " 248 ( link_speed_qdr ?
"QDR" : ( link_speed ?
"DDR" :
"SDR" ) ),
249 ( link_width ?
"x4" :
"x1" ) );
256 BIT_SET ( &extctrl, LEDPort0GreenOn, green );
257 BIT_SET ( &extctrl, LEDPort0YellowOn, yellow );
259 BIT_SET ( &extctrl, LEDPort1GreenOn, green );
260 BIT_SET ( &extctrl, LEDPort1YellowOn, yellow );
281 unsigned int new_link_state ) {
285 unsigned int link_state;
291 link_state =
BIT_GET ( &ibcstatusa, LinkState );
292 if ( link_state == new_link_state )
297 DBGC (
qib7322,
"QIB7322 %p port %d timed out waiting for link state " 315 unsigned int link_state;
321 DBGC (
qib7322,
"QIB7322 %p set link state to %s (%x)\n",
326 BIT_SET ( &ibcctrla, LinkCmd, link_state );
379 qp->qpn = (
ctx & ~0x01 );
386 DBGC (
qib7322,
"QIB7322 %p port %d out of available contexts\n",
433 #define QIB7322_SEND_BUF_TOGGLE 0x8000 448 unsigned int count ) {
453 send_bufs =
zalloc (
sizeof ( *send_bufs ) +
463 for ( i = 0 ; i <
count ; i++ )
466 DBGC2 (
qib7322,
"QIB7322 %p send buffer set %p [%d,%d] at %lx\n",
496 unsigned int send_buf;
498 used = ( send_bufs->
cons - send_bufs->
prod );
499 if ( used >= send_bufs->
count ) {
500 DBGC (
qib7322,
"QIB7322 %p send buffer set %p out of " 501 "buffers\n",
qib7322, send_bufs );
505 mask = ( send_bufs->
count - 1 );
506 send_buf = send_bufs->
avail[ send_bufs->
cons++ & mask ];
520 unsigned int send_buf ) {
523 mask = ( send_bufs->
count - 1 );
524 send_bufs->
avail[ send_bufs->
prod++ & mask ] = send_buf;
535 unsigned int send_buf ) {
536 unsigned int send_idx;
537 unsigned int send_check;
538 unsigned int inusecheck;
545 inuse = ( !! ( inusecheck & 0x02 ) );
546 check = ( !! ( inusecheck & 0x01 ) );
547 return ( inuse || ( check != send_check ) );
560 unsigned int send_buf ) {
593 sizeof ( qib7322_wq->
used[0] ) );
594 if ( ! qib7322_wq->
used )
598 qib7322_wq->
prod = 0;
599 qib7322_wq->
cons = 0;
629 unsigned long baseaddr_smallpio;
630 unsigned long baseaddr_largepio;
631 unsigned long baseaddr_vl15_port0;
632 unsigned long baseaddr_vl15_port1;
637 baseaddr_smallpio =
BIT_GET ( &sendbufbase, BaseAddr_SmallPIO );
638 baseaddr_largepio =
BIT_GET ( &sendbufbase, BaseAddr_LargePIO );
639 baseaddr_vl15_port0 = ( baseaddr_largepio +
642 baseaddr_vl15_port1 = ( baseaddr_vl15_port0 +
651 goto err_create_send_bufs_small;
660 goto err_create_send_bufs_vl15_port0;
669 goto err_create_send_bufs_vl15_port1;
677 goto err_alloc_sendbufavail;
682 memset ( &sendbufavailaddr, 0,
sizeof ( sendbufavailaddr ) );
683 BIT_FILL_1 ( &sendbufavailaddr, SendBufAvailAddr,
689 memset ( &sendctrlp, 0,
sizeof ( sendctrlp ) );
695 memset ( &sendctrl, 0,
sizeof ( sendctrl ) );
702 err_alloc_sendbufavail:
704 err_create_send_bufs_vl15_port1:
706 err_create_send_bufs_vl15_port0:
708 err_create_send_bufs_small:
721 memset ( &sendctrl, 0,
sizeof ( sendctrl ) );
773 if ( ! qib7322_wq->
header ) {
775 goto err_alloc_header;
779 memset ( &rcvhdraddr, 0,
sizeof ( rcvhdraddr ) );
784 memset ( &rcvhdrtailaddr, 0,
sizeof ( rcvhdrtailaddr ) );
789 memset ( &rcvhdrhead, 0,
sizeof ( rcvhdrhead ) );
793 memset ( &rcvegrindexhead, 0,
sizeof ( rcvegrindexhead ) );
806 DBGC (
qib7322,
"QIB7322 %p port %d QPN %ld CTX %d hdrs [%lx,%lx) prod " 873 unsigned int contextcfg;
874 unsigned long egrbase;
875 unsigned int eager_array_size_kernel;
876 unsigned int eager_array_size_user;
902 memset ( &rcvctrl, 0,
sizeof ( rcvctrl ) );
905 ContextCfg, contextcfg );
909 memset ( &rcvctrlp, 0,
sizeof ( rcvctrlp ) );
913 RcvPartitionKeyDisable, 1 );
916 memset ( &rcvqpmaptablea0, 0,
sizeof ( rcvqpmaptablea0 ) );
923 RcvQPMapContext5, 10 );
926 memset ( &rcvqpmaptableb0, 0,
sizeof ( rcvqpmaptableb0 ) );
928 RcvQPMapContext6, 12,
929 RcvQPMapContext7, 14,
930 RcvQPMapContext8, 16 );
933 memset ( &rcvqpmaptablea1, 0,
sizeof ( rcvqpmaptablea1 ) );
940 RcvQPMapContext5, 11 );
943 memset ( &rcvqpmaptableb1, 0,
sizeof ( rcvqpmaptableb1 ) );
945 RcvQPMapContext6, 13,
946 RcvQPMapContext7, 15,
947 RcvQPMapContext8, 17 );
952 memset ( &rcvqpmcastctx0, 0,
sizeof ( rcvqpmcastctx0 ) );
953 BIT_FILL_1 ( &rcvqpmcastctx0, RcvQpMcContext, 0 );
956 memset ( &rcvqpmcastctx1, 0,
sizeof ( rcvqpmcastctx1 ) );
957 BIT_FILL_1 ( &rcvqpmcastctx1, RcvQpMcContext, 1 );
962 memset ( &rcvhdrcnt, 0,
sizeof ( rcvhdrcnt ) );
965 memset ( &rcvhdrentsize, 0,
sizeof ( rcvhdrentsize ) );
972 egrbase =
BIT_GET ( &rcvegrbase, Value );
976 egrbase += ( eager_array_size_kernel *
982 egrbase += ( eager_array_size_user *
986 DBGC (
qib7322,
"QIB7322 %p CTX %d eager array at %lx (%d " 993 memset ( &rcvbthqp, 0,
sizeof ( rcvbthqp ) );
999 memset ( &rxcreditvl, 0,
sizeof ( rxcreditvl ) );
1102 goto err_create_recv_wq;
1106 goto err_create_send_wq;
1179 unsigned long start_offset;
1196 qib7322_wq->
used[qib7322_wq->
prod] = send_buf;
1205 iob_len ( iobuf ) + 3 ) & ~3 );
1208 memset ( &sendpbc, 0,
sizeof ( sendpbc ) );
1210 LengthP1_toibc, ( (
len >> 2 ) - 1 ),
1217 offset +=
sizeof ( sendpbc );
1221 frag_len > 0 ;
data++,
offset += 4, frag_len -= 4 ) {
1227 frag_len > 0 ;
data++,
offset += 4, frag_len -= 4 ) {
1233 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld TX %04x(%04x) posted [%lx,%lx)\n",
1252 unsigned int wqe_idx ) {
1257 unsigned int send_buf;
1260 send_buf = qib7322_wq->
used[wqe_idx];
1261 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld TX %04x(%04x) complete\n",
1265 iobuf = wq->
iobufs[wqe_idx];
1285 unsigned int send_buf;
1288 while ( wq->
fill ) {
1291 send_buf = qib7322_wq->
used[qib7322_wq->
cons];
1299 qib7322_wq->
cons = ( ( qib7322_wq->
cons + 1 ) &
1323 unsigned int wqe_idx;
1330 DBGC (
qib7322,
"QIB7322 %p QPN %ld misaligned RX buffer " 1335 DBGC (
qib7322,
"QIB7322 %p QPN %ld wrong RX buffer size " 1345 wq->
iobufs[wqe_idx] = iobuf;
1360 memset ( &rcvegr, 0,
sizeof ( rcvegr ) );
1362 Addr, (
addr >> 11 ),
1366 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld RX egr %04x(%04x) posted " 1375 memset ( &rcvegrindexhead, 0,
sizeof ( rcvegrindexhead ) );
1394 unsigned int header_offs ) {
1405 unsigned int rcvtype;
1406 unsigned int pktlen;
1407 unsigned int egrindex;
1408 unsigned int useegrbfr;
1409 unsigned int iberr, mkerr, tiderr, khdrerr, mtuerr;
1410 unsigned int lenerr, parityerr, vcrcerr, icrcerr;
1412 unsigned int hdrqoffset;
1413 unsigned int header_len;
1414 unsigned int padded_payload_len;
1415 unsigned int wqe_idx;
1421 rcvhdrflags = ( qib7322_wq->
header + header_offs +
1423 rcvtype =
BIT_GET ( rcvhdrflags, RcvType );
1424 pktlen = (
BIT_GET ( rcvhdrflags, PktLen ) << 2 );
1425 egrindex =
BIT_GET ( rcvhdrflags, EgrIndex );
1426 useegrbfr =
BIT_GET ( rcvhdrflags, UseEgrBfr );
1427 hdrqoffset = (
BIT_GET ( rcvhdrflags, HdrqOffset ) << 2 );
1428 iberr =
BIT_GET ( rcvhdrflags, IBErr );
1429 mkerr =
BIT_GET ( rcvhdrflags, MKErr );
1430 tiderr =
BIT_GET ( rcvhdrflags, TIDErr );
1431 khdrerr =
BIT_GET ( rcvhdrflags, KHdrErr );
1432 mtuerr =
BIT_GET ( rcvhdrflags, MTUErr );
1433 lenerr =
BIT_GET ( rcvhdrflags, LenErr );
1434 parityerr =
BIT_GET ( rcvhdrflags, ParityErr );
1435 vcrcerr =
BIT_GET ( rcvhdrflags, VCRCErr );
1436 icrcerr =
BIT_GET ( rcvhdrflags, ICRCErr );
1438 sizeof ( *rcvhdrflags ) );
1439 padded_payload_len = ( pktlen - header_len - 4 );
1440 err = ( iberr | mkerr | tiderr | khdrerr | mtuerr |
1441 lenerr | parityerr | vcrcerr | icrcerr );
1444 header_len, header_len );
1447 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld RX egr %04x%s hdr %d type %d len " 1448 "%d(%d+%d+4)%s%s%s%s%s%s%s%s%s%s%s\n",
qib7322,
qp->qpn,
1449 egrindex, ( useegrbfr ?
"" :
"(unused)" ),
1451 rcvtype, pktlen, header_len, padded_payload_len,
1452 ( err ?
" [Err" :
"" ), ( iberr ?
" IB" :
"" ),
1453 ( mkerr ?
" MK" :
"" ), ( tiderr ?
" TID" :
"" ),
1454 ( khdrerr ?
" KHdr" :
"" ), ( mtuerr ?
" MTU" :
"" ),
1455 ( lenerr ?
" Len" :
"" ), ( parityerr ?
" Parity" :
""),
1456 ( vcrcerr ?
" VCRC" :
"" ), ( icrcerr ?
" ICRC" :
"" ),
1457 ( err ?
"]" :
"" ) );
1459 ( header_len + sizeof ( *rcvhdrflags ) ) );
1462 qp0 = (
qp->qpn == 0 );
1465 &payload_len, &
dest, &source ) ) != 0 ) {
1466 DBGC (
qib7322,
"QIB7322 %p could not parse headers: %s\n",
1470 if ( ! intended_qp )
1502 iobuf = wq->
iobufs[wqe_idx];
1512 iob_put ( iobuf, payload_len );
1517 "%zd\n",
qib7322, payload_len );
1521 if (
qp != intended_qp ) {
1538 memset ( &rcvegr, 0,
sizeof ( rcvegr ) );
1562 unsigned int header_prod;
1570 while ( qib7322_wq->
header_cons != header_prod ) {
1590 memset ( &rcvhdrhead, 0,
sizeof ( rcvhdrhead ) );
1639 if ( errstatus.u.qwords[0] ) {
1641 port, errstatus.u.dwords[1], errstatus.u.dwords[0] );
1648 if (
BIT_GET ( &errstatus, IBStatusChanged ) )
1666 unsigned int port ) {
1670 unsigned int boardid;
1683 DBGC (
qib7322,
"QIB7322 %p port %d is invalid\n",
1692 switch ( boardid ) {
1694 DBGC2 (
qib7322,
"QIB7322 %p is a QMH7342; forcing QDR-only\n",
1704 (
supported ?
"supports" :
"disabled" ),
1725 BIT_SET ( &ibcctrla, IBLinkEn, 1 );
1745 BIT_SET ( &ibcctrla, IBLinkEn, 0 );
1834 unsigned int bit_id ) {
1858 unsigned int bit_id,
unsigned long data ) {
1864 unsigned int outputs = 0;
1865 unsigned int output_enables = 0;
1877 output_enables =
BIT_GET ( &extctrl, GPIOOe );
1878 output_enables = ( ( output_enables & ~
bit ) | ( ~
data &
bit ) );
1879 outputs =
BIT_GET ( &gpioout, GPIO );
1880 outputs = ( outputs & ~
bit );
1881 BIT_SET ( &extctrl, GPIOOe, output_enables );
1882 BIT_SET ( &gpioout, GPIO, outputs );
1907 static int try_eeprom_address[] = { 0x51, 0x50 };
1914 DBGC (
qib7322,
"QIB7322 %p could not initialise I2C bus: %s\n",
1920 for ( i = 0 ; i < (
sizeof ( try_eeprom_address ) /
1921 sizeof ( try_eeprom_address[0] ) ) ; i++ ) {
1926 qib7322, try_eeprom_address[i] );
1949 sizeof ( *
guid ) ) ) != 0 ) {
1950 DBGC (
qib7322,
"QIB7322 %p could not read GUID: %s\n",
1964 ( sizeof (
serial ) - 1 ) ) ) != 0 ) {
1965 DBGC (
qib7322,
"QIB7322 %p could not read serial: " 1969 DBGC2 (
qib7322,
"QIB7322 %p has serial number \"%s\"\n",
1997 if (
BIT_GET ( &transaction, ahb_rdy ) )
2002 DBGC (
qib7322,
"QIB7322 %p timed out waiting for AHB transaction\n",
2015 unsigned int location ) {
2020 memset ( &access, 0,
sizeof ( access ) );
2028 DBGC (
qib7322,
"QIB7322 %p could not obtain AHB ownership: " 2044 memset ( &access, 0,
sizeof ( access ) );
2070 write_not_read, 0 );
2142 new_value = ( ( old_value & ~mask ) |
value );
2144 qib7322, location, old_value, new_value );
2169 unsigned int location;
2176 value, mask ) ) != 0 )
2202 memset ( &ibcctrla, 0,
sizeof ( ibcctrla ) );
2204 FlowCtrlPeriod, 0x03,
2205 FlowCtrlWaterMark, 0x05,
2209 PhyerrThreshold, 0xf,
2210 OverrunThreshold, 0xf );
2219 BIT_SET ( &ibcctrlb, IB_ENHANCED_MODE, 0 );
2220 BIT_SET ( &ibcctrlb, SD_SPEED_SDR, 1 );
2221 BIT_SET ( &ibcctrlb, SD_SPEED_DDR, 0 );
2222 BIT_SET ( &ibcctrlb, SD_SPEED_QDR, 0 );
2223 BIT_SET ( &ibcctrlb, IB_NUM_CHANNELS, 1 );
2224 BIT_SET ( &ibcctrlb, IB_LANE_REV_SUPPORTED, 0 );
2225 BIT_SET ( &ibcctrlb, HRTBT_ENB, 0 );
2226 BIT_SET ( &ibcctrlb, HRTBT_AUTO, 0 );
2234 memset ( &ibpcsconfig, 0,
sizeof ( ibpcsconfig ) );
2293 goto err_alloc_qib7322;
2323 goto err_read_eeprom;
2335 goto err_init_ib_serdes;
2346 goto err_alloc_ibdev;
2371 DBGC (
qib7322,
"QIB7322 %p port %d could not register " 2373 goto err_register_ibdev;
2381 for ( i-- ; i >= 0 ; i-- ) {
2387 for ( i-- ; i >= 0 ; i-- )
2424 PCI_ROM ( 0x1077, 0x7322,
"iba7322",
"IBA7322 QDR InfiniBand HCA", 0 ),
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
static int qib7322_ahb_mod_reg_all(struct qib7322 *qib7322, unsigned int reg, uint32_t value, uint32_t mask)
Read/modify/write AHB register across all ports and channels.
#define QIB_7322_ahb_access_ctrl_offset
static void qib7322_complete_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int header_offs)
Complete receive work queue entry.
static int qib7322_i2c_read_bit(struct bit_basher *basher, unsigned int bit_id)
Read QIB7322 I2C line status.
#define EINVAL
Invalid argument.
static __always_inline void ib_set_drvdata(struct ib_device *ibdev, void *priv)
Set Infiniband device driver-private data.
unsigned long membase
Memory base.
struct arbelprm_rc_send_wqe rc
void pci_restore(struct pci_device *pci, struct pci_config_backup *backup, unsigned int limit, const uint8_t *exclude)
Restore PCI configuration space.
#define QIB7322_MAX_CREDITS_VL0
Number of credits to advertise for VL0.
#define QIB_7322_RcvCtrl_1_offset
#define BIT_FILL_5(_ptr, _field1,...)
unsigned int start
Index of first send buffer.
#define iob_put(iobuf, len)
#define BIT_FILL_6(_ptr, _field1,...)
#define QIB_7322_RcvCtrl_offset
#define QIB7322_EAGER_BUFFER_ALIGN
Eager buffer required alignment.
void * header
Receive header ring.
#define QIB7322_RECV_HEADERS_ALIGN
RX header alignment.
static int qib7322_alloc_send_buf(struct qib7322 *qib7322, struct qib7322_send_buffers *send_bufs)
Allocate a send buffer.
#define QIB7322_SMALL_SEND_BUF_USED
Number of small send buffers used.
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
static unsigned int unsigned int reg
Infiniband device operations.
#define IB_LINK_SPEED_QDR
static int qib7322_ahb_mod_reg(struct qib7322 *qib7322, unsigned int location, uint32_t value, uint32_t mask)
Read/modify/write AHB register.
static void qib7322_destroy_send_bufs(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs)
Destroy send buffer set.
#define QIB_7322_RcvQPMapTableB_1_offset
uint16_t * used
Send buffer usage.
#define QIB_7322_ErrClear_0_offset
static void qib7322_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
static struct ib_device_operations qib7322_ib_operations
QIB7322 Infiniband operations.
static void qib7322_poll_send_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll send work queue.
uint8_t used_ctx[QIB7322_NUM_CONTEXTS]
In-use contexts.
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
uint64_t readq(volatile uint64_t *io_addr)
Read 64-bit qword from memory-mapped device.
A QIB7322 send work queue.
#define QIB7322_VL15_PORT1_SEND_BUF_COUNT
QIB7322 VL15 port 0 send buffer count.
#define QIB_7322_SendBufBase_offset
unsigned int eager_cons
Eager array consumer index.
#define qib7322_writeq_array8b(_qib7322, _ptr, _offset, _idx)
static int i2c_check_presence(struct i2c_interface *i2c, struct i2c_device *i2cdev)
Check presence of I2C device.
#define DBG_ENABLE(level)
struct pci_device_id * ids
PCI ID table.
#define QIB7322_AHB_MAX_WAIT_US
Maximum time for wait for AHB, in us.
static int qib7322_create_send_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create send work queue.
uint16_t size
Buffer size.
#define qib7322_readq(_qib7322, _ptr, _offset)
struct qib7322_send_buffers * send_bufs
Send buffer set.
struct pci_driver qib7322_driver __pci_driver
int ib_pull(struct ib_device *ibdev, struct io_buffer *iobuf, struct ib_queue_pair **qp, size_t *payload_len, struct ib_address_vector *dest, struct ib_address_vector *source)
Remove IB headers.
#define QIB7322_EAGER_ARRAY_SIZE_6CTX_KERNEL
ContextCfg values for different numbers of contexts.
#define QIB7322_EEPROM_GUID_OFFSET
GUID offset within EEPROM.
#define IB_GUID_ARGS(guid)
Infiniband Globally Unique Identifier debug message arguments.
static void qib7322_destroy_send_wq(struct ib_device *ibdev __unused, struct ib_queue_pair *qp)
Destroy send work queue.
union ib_smp_data smp_data
static int qib7322_send_buf_in_use(struct qib7322 *qib7322, unsigned int send_buf)
Check to see if send buffer is in use.
#define IB_LINK_SPEED_SDR
#define QIB7322_EAGER_ARRAY_SIZE_10CTX_KERNEL
#define ENOENT
No such file or directory.
struct device * dev
Underlying device.
#define QIB_7322_GPIOOut_offset
#define QIB_7322_RcvBTHQP_0_offset
unsigned long long uint64_t
#define QIB_7322_RcvHdrHead0_offset
#define DBG_DISABLE(level)
#define BIT_SET(_ptr, _field, _value)
A bit-bashing I2C interface.
static int qib7322_ahb_write(struct qib7322 *qib7322, unsigned int location, uint32_t data)
Write data via AHB.
#define QIB_7322_RcvHdrCnt_offset
#define qib7322_writeq_array64k(_qib7322, _ptr, _offset, _idx)
#define QIB_7322_SendBufAvailAddr_offset
static int qib7322_ahb_read(struct qib7322 *qib7322, unsigned int location, uint32_t *data)
Read data via AHB.
static unsigned int unsigned int bit
#define QIB_7322_RxCreditVL0_1_offset
static int qib7322_mcast_attach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
void ib_link_state_changed(struct ib_device *ibdev)
Notify of Infiniband link state change.
#define QIB7322_GPIO_SDA
QIB7322 I2C SDA line GPIO number.
struct golan_eq_context ctx
struct ib_work_queue recv
Receive queue.
#define QIB_7322_SendCtrl_1_offset
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
unsigned int size
Send buffer size.
static struct bit_basher_operations qib7322_i2c_basher_ops
QIB7322 I2C bit-bashing interface operations.
static unsigned int qib7322_i2c_bits[]
QIB7322 I2C bit to GPIO mappings.
#define PCI_CONFIG_BACKUP_ALL
Limit of PCI configuration space.
uint8_t link_speed_enabled
Link speed enabled.
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
struct i2c_device eeprom
I2C serial EEPROM.
static void qib7322_close(struct ib_device *ibdev)
Close Infiniband link.
unsigned int eager_entries
Number of entries in eager array.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
#define QIB7322_EEPROM_SERIAL_OFFSET
Board serial number offset within EEPROM.
static int qib7322_init_ib_serdes(struct qib7322 *qib7322)
Initialise the IB SerDes.
An Infiniband Global Identifier.
static void qib7322_free_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Free a context.
#define QIB7322_VL15_PORT0_SEND_BUF_START
QIB7322 VL15 port 0 send buffer starting index.
#define QIB_7322_IBCCtrlA_0_offset
struct device dev
Generic device.
#define QIB_7322_IBPCSConfig_0_offset
#define QIB7322_NUM_CONTEXTS
Number of contexts (including kernel context)
unsigned int eager_prod
Eager array producer index.
uint8_t link_width_enabled
Link width enabled.
#define QIB7322_VL15_PORT1_SEND_BUF_START
QIB7322 VL15 port 0 send buffer starting index.
struct ib_port_info port_info
#define QIB7322_SMALL_SEND_BUF_START
QIB7322 small send buffer starting index.
uint8_t link_width_supported
Link width supported.
unsigned int prod
Send buffer availability producer counter.
#define ECANCELED
Operation canceled.
static int qib7322_post_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
Post receive work queue entry.
static void qib7322_i2c_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Write QIB7322 I2C line status.
struct ib_port_info port_info
#define QIB7322_VL15_PORT0_SEND_BUF_SIZE
QIB7322 VL15 port 0 send buffer size.
Dynamic memory allocation.
#define QIB7322_SENDBUFAVAIL_ALIGN
DMA alignment for send buffer availability.
#define QIB_7322_RcvCtrl_0_offset
#define QIB_7322_Revision_offset
unsigned long base
Offset within register space of the first send buffer.
A QIB7322 send buffer set.
uint32_t start
Starting offset.
#define QIB7322_VL15_PORT1_SEND_BUF_SIZE
QIB7322 VL15 port 0 send buffer size.
struct ib_completion_queue * cq
Associated completion queue.
unsigned int prod
Producer index.
unsigned int count
Number of send buffers.
#define QIB7322_LARGE_SEND_BUF_SIZE
QIB7322 large send buffer size.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
static __always_inline void init_i2c_eeprom(struct i2c_device *i2cdev, unsigned int dev_addr)
Initialise generic I2C EEPROM device.
#define ENOMEM
Not enough space.
static void qib7322_mcast_detach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Detach from multicast group.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define QIB_7322_RxCreditVL0_0_offset
static int qib7322_init_send(struct qib7322 *qib7322)
Initialise send datapath.
#define QIB7322_EAGER_ARRAY_SIZE_18CTX_USER
#define IB_GUID_FMT
Infiniband Globally Unique Identifier debug message format.
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
#define QIB7322_AHB_LOC_TARGET(_location)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
struct i2c_bit_basher i2c
I2C bit-bashing interface.
#define QIB7322_SEND_BUF_TOGGLE
Send buffer toggle bit.
struct qib7322_recv_work_queue recv_wq[QIB7322_NUM_CONTEXTS]
Receive work queues.
static int qib7322_create_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create receive work queue.
static void qib7322_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
#define QIB_7322_Control_offset
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void qib7322_ahb_release(struct qib7322 *qib7322)
Release ownership of the AHB.
#define container_of(ptr, type, field)
Get containing structure.
struct ib_device_operations * op
Infiniband operations.
static void qib7322_reset(struct qib7322 *qib7322, struct pci_device *pci)
Reset QIB7322.
An Infiniband Work Queue.
struct i2c_interface i2c
I2C interface.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
static int qib7322_post_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct io_buffer *iobuf)
Post send work queue entry.
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
static void qib7322_fini_recv(struct qib7322 *qib7322 __unused)
Shut down receive datapath.
uint8_t link_speed_supported__port_state
static void qib7322_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int wqe_idx)
Complete send work queue entry.
void ib_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Complete send work queue entry.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
#define build_assert(condition)
Assert a condition at build time (after dead code elimination)
static int qib7322_init_i2c(struct qib7322 *qib7322)
Initialise QIB7322 I2C subsystem.
#define QIB_7322_RcvEgrIndexHead0_offset
unsigned long qpn
Queue pair number.
static int qib7322_open(struct ib_device *ibdev)
Initialise Infiniband link.
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
static unsigned int count
Number of entries.
static int qib7322_set_pkey_table(struct ib_device *ibdev __unused, union ib_mad *mad __unused)
Set partition key table.
uint32_t channel
RNDIS channel.
static void qib7322_poll_eq(struct ib_device *ibdev)
Poll event queue.
static int qib7322_init_recv(struct qib7322 *qib7322)
Initialise receive datapath.
unsigned int num_wqes
Number of work queue entries.
#define QIB7322_EAGER_ARRAY_SIZE_10CTX_USER
#define QIB_7322_RcvBTHQP_1_offset
#define EPROTO
Protocol error.
struct list_head work_queues
List of work queues completing to this queue.
#define QIB7322_AHB_LOCATION(_port, _channel, _register)
#define QIB7322_GPIO_SCL
QIB7322 I2C SCL line GPIO number.
#define BIT_FILL_3(_ptr, _field1,...)
static void qib7322_destroy_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy receive work queue.
uint32_t revision
Entry point revision.
struct bit_basher basher
Bit-bashing interface.
#define qib7322_writeq(_qib7322, _ptr, _offset)
int(* read)(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
#define QIB7322_BAR0_SIZE
QIB7322 memory BAR size.
unsigned int port
Port number.
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
static unsigned int qib7322_link_speed_supported(struct qib7322 *qib7322, unsigned int port)
Determine supported link speeds.
#define QIB_7322_IBCCtrlA_1_offset
void * zalloc(size_t size)
Allocate cleared memory.
uint32_t features
Supported features.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
struct ib_device * alloc_ibdev(size_t priv_size)
Allocate Infiniband device.
#define QIB7322_EAGER_ARRAY_SIZE_18CTX_KERNEL
struct QIB_7322_SendBufAvail * sendbufavail
Send buffer availability (reported by hardware)
A PCI configuration space backup.
uint32_t addr
Buffer address.
An Infiniband Globally Unique Identifier.
#define QIB7322_PORT_BASE
QIB7322 base port number.
#define QIB7322_LARGE_SEND_BUF_COUNT
QIB7322 large send buffer count.
#define QIB7322_RECV_HEADERS_SIZE
Total size of an RX header ring.
uint64_t serial
Serial number.
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
union ib_guid node_guid
Node GUID.
#define ENODEV
No such device.
unsigned int fill
Number of occupied work queue entries.
An Infiniband Completion Queue.
static void qib7322_poll_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll receive work queue.
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
QLogic QIB7322 Infiniband HCA.
static void qib7322_free_send_buf(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs, unsigned int send_buf)
Free a send buffer.
#define QIB7322_RECV_HEADER_SIZE
Maximum size of each RX header.
uint8_t link_width_active
Link width active.
#define QIB7322_MAX_PORTS
QIB7322 maximum number of ports.
unsigned int cons
Send buffer availability consumer counter.
#define QIB_7322_RcvEgrBase_offset
int register_ibdev(struct ib_device *ibdev)
Register Infiniband device.
#define QIB_7322_IBCCtrlB_0_offset
A PCI device ID list entry.
struct ib_queue_pair * qp
Containing queue pair.
uint8_t headers[IB_MAX_HEADER_SIZE]
#define QIB_7322_EXTCtrl_offset
int(* read)(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, uint8_t *data, unsigned int len)
Read data from I2C device.
unsigned int ports
Total ports on device.
static void qib7322_fini_send(struct qib7322 *qib7322)
Shut down send datapath.
#define QIB_7322_ahb_transaction_reg_offset
static int qib7322_ahb_request(struct qib7322 *qib7322, unsigned int location)
Request ownership of the AHB.
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
#define QIB_7322_RcvHdrAddr0_offset
static struct xen_remove_from_physmap * remove
uint16_t avail[0]
Send buffer availability.
#define QIB_7322_SendCtrl_offset
#define QIB_7322_RcvQPMapTableA_0_offset
struct list_head list
List of work queues on this completion queue.
An Infiniband Queue Pair.
static int qib7322_set_port_info(struct ib_device *ibdev, union ib_mad *mad)
Set port information.
static int qib7322_ahb_wait(struct qib7322 *qib7322)
Wait for AHB transaction to complete.
struct QIB_7322_scalar header_prod
Receive header producer offset (written by hardware)
#define QIB7322_AHB_LOC_ADDRESS(_location)
QIB7322 AHB locations.
static int qib7322_link_state_check(struct ib_device *ibdev, unsigned int new_link_state)
Wait for link state change to take effect.
uint32_t xact
Requester transaction ID.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
struct arbelprm_qp_db_record qp
#define BIT_FILL_2(_ptr, _field1,...)
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define iob_reserve(iobuf, len)
#define QIB7322_QP_IDETH
QPN used for Infinipath Packets.
#define QIB_7322_RcvQPMapTableA_1_offset
static void qib7322_poll_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Poll completion queue.
struct qib7322_send_buffers * send_bufs_vl15_port0
VL15 port 0 send buffers.
#define ENOBUFS
No buffer space available.
void pci_backup(struct pci_device *pci, struct pci_config_backup *backup, unsigned int limit, const uint8_t *exclude)
Back up PCI configuration space.
#define QIB7322_EEPROM_SERIAL_SIZE
Board serial number size within EEPROM.
int(* probe)(struct pci_device *pci)
Probe device.
#define QIB7322_RECV_HEADER_COUNT
Number of RX headers per context.
#define QIB_7322_ErrStatus_0_offset
uint8_t link_speed_active
Link speed active.
struct qib7322_send_buffers * send_bufs_small
Small send buffers.
#define QIB7322_VL15_PORT0_SEND_BUF_COUNT
QIB7322 VL15 port 0 send buffer count.
static const char * qib7322_link_state_text(unsigned int link_state)
Textual representation of link state.
#define QIB_7322_IBCStatusA_0_offset
#define IB_LINK_SPEED_DDR
union ib_guid guid
Base GUID.
struct qib7322_send_buffers * send_bufs_vl15_port1
VL15 port 1 send buffers.
#define BIT_FILL_1(_ptr, _field1,...)
void * data
Start of data.
unsigned int header_cons
Receive header consumer offset.
#define EIO
Input/output error.
#define QIB_7322_RcvHdrTailAddr0_offset
static struct qib7322_send_buffers * qib7322_create_send_bufs(struct qib7322 *qib7322, unsigned long base, unsigned int size, unsigned int start, unsigned int count)
Create send buffer set.
#define QIB_7322_IBCCtrlB_1_offset
static void qib7322_writel(struct qib7322 *qib7322, uint32_t dword, unsigned long offset)
Write QIB7322 dword register.
#define QIB_7322_EXTStatus_offset
#define QIB_7322_active_feature_mask_offset
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
static int qib7322_create_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create queue pair.
uint8_t port_state
Port state.
unsigned long cqn
Completion queue number.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t data[48]
Additional event data.
#define QIB7322_MAX_WIDTH
QIB7322 maximum width.
struct qib7322_send_work_queue send_wq[QIB7322_NUM_CONTEXTS]
Send work queues.
unsigned int cons
Consumer index.
uint8_t link_speed_supported
Link speed supported.
void ib_complete_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_address_vector *dest, struct ib_address_vector *source, struct io_buffer *iobuf, int rc)
Complete receive work queue entry.
static int qib7322_read_eeprom(struct qib7322 *qib7322)
Read EEPROM parameters.
static struct pci_device_id qib7322_nics[]
static int qib7322_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
An Infiniband Address Vector.
void mb(void)
Memory barrier.
#define QIB7322_EAGER_ARRAY_SIZE_6CTX_USER
A QIB7322 receive work queue.
static int qib7322_probe(struct pci_device *pci)
Probe PCI device.
uint16_t offset
Offset to command line.
static int qib7322_create_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
static void qib7322_link_state_changed(struct ib_device *ibdev)
Handle link state change.
uint16_t supported
Bitmask of supported option values.
#define QIB7322_SMALL_SEND_BUF_SIZE
QIB7322 small send buffer size.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
uint8_t bufsize
Size of the packet, in bytes.
int is_send
"Is a send queue" flag
#define QIB_7322_RcvHdrEntSize_offset
int init_i2c_bit_basher(struct i2c_bit_basher *i2cbit, struct bit_basher_operations *bash_op)
Initialise I2C bit-bashing interface.
static void qib7322_remove(struct pci_device *pci)
Remove PCI device.
static int qib7322_alloc_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Allocate a context and set queue pair number.
unsigned long eager_array
Offset within register space of the eager array.
#define QIB_7322_RcvQPMulticastContext_0_offset
#define QIB_7322_RcvQPMulticastContext_1_offset
#define NULL
NULL pointer (VOID *)
#define ETIMEDOUT
Connection timed out.
int ib_push(struct ib_device *ibdev, struct io_buffer *iobuf, struct ib_queue_pair *qp, size_t payload_len, const struct ib_address_vector *dest)
Add IB headers.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
A Port Information attribute.
static __always_inline void ib_wq_set_drvdata(struct ib_work_queue *wq, void *priv)
Set Infiniband work queue driver-private data.
void writeq(uint64_t data, volatile uint64_t *io_addr)
Write 64-bit qword to memory-mapped device.
#define QIB_7322_RcvQPMapTableB_0_offset
#define IB_MAX_HEADER_SIZE
Maximum size required for IB headers.
int(* create_cq)(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
#define QIB_7322_SendCtrl_0_offset
#define QIB_7322_IBPCSConfig_1_offset
#define QIB7322_MAX_CREDITS_VL15
Number of credits to advertise for VL15.
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
#define QIB7322_RECV_PAYLOAD_SIZE
RX payload size.
#define QIB7322_LINK_STATE_MAX_WAIT_US
Maximum time to wait for link state changes, in us.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static unsigned long qib7322_send_buffer_offset(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs, unsigned int send_buf)
Calculate starting offset for send buffer.
void * memset(void *dest, int character, size_t len) __nonnull
PCI configuration space backup and restoration.
struct io_buffer ** iobufs
I/O buffers assigned to work queue.