153 #define qib7322_readq( _qib7322, _ptr, _offset ) \ 154 qib7322_readq ( (_qib7322), (_ptr)->u.qwords, (_offset) ) 155 #define qib7322_readq_array8b( _qib7322, _ptr, _offset, _idx ) \ 156 qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) ) 157 #define qib7322_readq_array64k( _qib7322, _ptr, _offset, _idx ) \ 158 qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ) ) 159 #define qib7322_readq_port( _qib7322, _ptr, _offset, _port ) \ 160 qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) ) ) 173 #define qib7322_writeq( _qib7322, _ptr, _offset ) \ 174 qib7322_writeq ( (_qib7322), (_ptr)->u.qwords, (_offset) ) 175 #define qib7322_writeq_array8b( _qib7322, _ptr, _offset, _idx ) \ 176 qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) ) 177 #define qib7322_writeq_array64k( _qib7322, _ptr, _offset, _idx ) \ 178 qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 65536 ) )) 179 #define qib7322_writeq_port( _qib7322, _ptr, _offset, _port ) \ 180 qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_port) * 4096 ) )) 208 switch ( link_state ) {
214 default:
return "UNKNOWN";
228 unsigned int link_training_state;
229 unsigned int link_state;
230 unsigned int link_width;
231 unsigned int link_speed;
232 unsigned int link_speed_qdr;
239 link_training_state =
BIT_GET ( &ibcstatusa, LinkTrainingState );
240 link_state =
BIT_GET ( &ibcstatusa, LinkState );
241 link_width =
BIT_GET ( &ibcstatusa, LinkWidthActive );
242 link_speed =
BIT_GET ( &ibcstatusa, LinkSpeedActive );
243 link_speed_qdr =
BIT_GET ( &ibcstatusa, LinkSpeedQDR );
244 DBGC (
qib7322,
"QIB7322 %p port %d training state %#x link state %s " 247 ( link_speed_qdr ?
"QDR" : ( link_speed ?
"DDR" :
"SDR" ) ),
248 ( link_width ?
"x4" :
"x1" ) );
255 BIT_SET ( &extctrl, LEDPort0GreenOn, green );
256 BIT_SET ( &extctrl, LEDPort0YellowOn, yellow );
258 BIT_SET ( &extctrl, LEDPort1GreenOn, green );
259 BIT_SET ( &extctrl, LEDPort1YellowOn, yellow );
280 unsigned int new_link_state ) {
284 unsigned int link_state;
290 link_state =
BIT_GET ( &ibcstatusa, LinkState );
291 if ( link_state == new_link_state )
296 DBGC (
qib7322,
"QIB7322 %p port %d timed out waiting for link state " 314 unsigned int link_state;
320 DBGC (
qib7322,
"QIB7322 %p set link state to %s (%x)\n",
325 BIT_SET ( &ibcctrla, LinkCmd, link_state );
378 qp->qpn = (
ctx & ~0x01 );
385 DBGC (
qib7322,
"QIB7322 %p port %d out of available contexts\n",
432 #define QIB7322_SEND_BUF_TOGGLE 0x8000 447 unsigned int count ) {
452 send_bufs =
zalloc (
sizeof ( *send_bufs ) +
462 for ( i = 0 ; i <
count ; i++ )
465 DBGC2 (
qib7322,
"QIB7322 %p send buffer set %p [%d,%d] at %lx\n",
495 unsigned int send_buf;
497 used = ( send_bufs->
cons - send_bufs->
prod );
498 if ( used >= send_bufs->
count ) {
499 DBGC (
qib7322,
"QIB7322 %p send buffer set %p out of " 500 "buffers\n",
qib7322, send_bufs );
504 mask = ( send_bufs->
count - 1 );
505 send_buf = send_bufs->
avail[ send_bufs->
cons++ & mask ];
519 unsigned int send_buf ) {
522 mask = ( send_bufs->
count - 1 );
523 send_bufs->
avail[ send_bufs->
prod++ & mask ] = send_buf;
534 unsigned int send_buf ) {
535 unsigned int send_idx;
536 unsigned int send_check;
537 unsigned int inusecheck;
544 inuse = ( !! ( inusecheck & 0x02 ) );
545 check = ( !! ( inusecheck & 0x01 ) );
546 return ( inuse || ( check != send_check ) );
559 unsigned int send_buf ) {
592 sizeof ( qib7322_wq->
used[0] ) );
593 if ( ! qib7322_wq->
used )
597 qib7322_wq->
prod = 0;
598 qib7322_wq->
cons = 0;
628 unsigned long baseaddr_smallpio;
629 unsigned long baseaddr_largepio;
630 unsigned long baseaddr_vl15_port0;
631 unsigned long baseaddr_vl15_port1;
636 baseaddr_smallpio =
BIT_GET ( &sendbufbase, BaseAddr_SmallPIO );
637 baseaddr_largepio =
BIT_GET ( &sendbufbase, BaseAddr_LargePIO );
638 baseaddr_vl15_port0 = ( baseaddr_largepio +
641 baseaddr_vl15_port1 = ( baseaddr_vl15_port0 +
650 goto err_create_send_bufs_small;
659 goto err_create_send_bufs_vl15_port0;
668 goto err_create_send_bufs_vl15_port1;
676 goto err_alloc_sendbufavail;
681 memset ( &sendbufavailaddr, 0,
sizeof ( sendbufavailaddr ) );
682 BIT_FILL_1 ( &sendbufavailaddr, SendBufAvailAddr,
688 memset ( &sendctrlp, 0,
sizeof ( sendctrlp ) );
694 memset ( &sendctrl, 0,
sizeof ( sendctrl ) );
701 err_alloc_sendbufavail:
703 err_create_send_bufs_vl15_port1:
705 err_create_send_bufs_vl15_port0:
707 err_create_send_bufs_small:
720 memset ( &sendctrl, 0,
sizeof ( sendctrl ) );
772 if ( ! qib7322_wq->
header ) {
774 goto err_alloc_header;
778 memset ( &rcvhdraddr, 0,
sizeof ( rcvhdraddr ) );
783 memset ( &rcvhdrtailaddr, 0,
sizeof ( rcvhdrtailaddr ) );
788 memset ( &rcvhdrhead, 0,
sizeof ( rcvhdrhead ) );
792 memset ( &rcvegrindexhead, 0,
sizeof ( rcvegrindexhead ) );
805 DBGC (
qib7322,
"QIB7322 %p port %d QPN %ld CTX %d hdrs [%lx,%lx) prod " 872 unsigned int contextcfg;
873 unsigned long egrbase;
874 unsigned int eager_array_size_kernel;
875 unsigned int eager_array_size_user;
901 memset ( &rcvctrl, 0,
sizeof ( rcvctrl ) );
904 ContextCfg, contextcfg );
908 memset ( &rcvctrlp, 0,
sizeof ( rcvctrlp ) );
912 RcvPartitionKeyDisable, 1 );
915 memset ( &rcvqpmaptablea0, 0,
sizeof ( rcvqpmaptablea0 ) );
922 RcvQPMapContext5, 10 );
925 memset ( &rcvqpmaptableb0, 0,
sizeof ( rcvqpmaptableb0 ) );
927 RcvQPMapContext6, 12,
928 RcvQPMapContext7, 14,
929 RcvQPMapContext8, 16 );
932 memset ( &rcvqpmaptablea1, 0,
sizeof ( rcvqpmaptablea1 ) );
939 RcvQPMapContext5, 11 );
942 memset ( &rcvqpmaptableb1, 0,
sizeof ( rcvqpmaptableb1 ) );
944 RcvQPMapContext6, 13,
945 RcvQPMapContext7, 15,
946 RcvQPMapContext8, 17 );
951 memset ( &rcvqpmcastctx0, 0,
sizeof ( rcvqpmcastctx0 ) );
952 BIT_FILL_1 ( &rcvqpmcastctx0, RcvQpMcContext, 0 );
955 memset ( &rcvqpmcastctx1, 0,
sizeof ( rcvqpmcastctx1 ) );
956 BIT_FILL_1 ( &rcvqpmcastctx1, RcvQpMcContext, 1 );
961 memset ( &rcvhdrcnt, 0,
sizeof ( rcvhdrcnt ) );
964 memset ( &rcvhdrentsize, 0,
sizeof ( rcvhdrentsize ) );
971 egrbase =
BIT_GET ( &rcvegrbase, Value );
975 egrbase += ( eager_array_size_kernel *
981 egrbase += ( eager_array_size_user *
985 DBGC (
qib7322,
"QIB7322 %p CTX %d eager array at %lx (%d " 992 memset ( &rcvbthqp, 0,
sizeof ( rcvbthqp ) );
998 memset ( &rxcreditvl, 0,
sizeof ( rxcreditvl ) );
1101 goto err_create_recv_wq;
1105 goto err_create_send_wq;
1178 unsigned long start_offset;
1195 qib7322_wq->
used[qib7322_wq->
prod] = send_buf;
1204 iob_len ( iobuf ) + 3 ) & ~3 );
1207 memset ( &sendpbc, 0,
sizeof ( sendpbc ) );
1209 LengthP1_toibc, ( (
len >> 2 ) - 1 ),
1216 offset +=
sizeof ( sendpbc );
1220 frag_len > 0 ;
data++,
offset += 4, frag_len -= 4 ) {
1226 frag_len > 0 ;
data++,
offset += 4, frag_len -= 4 ) {
1232 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld TX %04x(%04x) posted [%lx,%lx)\n",
1251 unsigned int wqe_idx ) {
1256 unsigned int send_buf;
1259 send_buf = qib7322_wq->
used[wqe_idx];
1260 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld TX %04x(%04x) complete\n",
1264 iobuf = wq->
iobufs[wqe_idx];
1284 unsigned int send_buf;
1287 while ( wq->
fill ) {
1290 send_buf = qib7322_wq->
used[qib7322_wq->
cons];
1298 qib7322_wq->
cons = ( ( qib7322_wq->
cons + 1 ) &
1322 unsigned int wqe_idx;
1329 DBGC (
qib7322,
"QIB7322 %p QPN %ld misaligned RX buffer " 1334 DBGC (
qib7322,
"QIB7322 %p QPN %ld wrong RX buffer size " 1344 wq->
iobufs[wqe_idx] = iobuf;
1359 memset ( &rcvegr, 0,
sizeof ( rcvegr ) );
1361 Addr, (
addr >> 11 ),
1365 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld RX egr %04x(%04x) posted " 1374 memset ( &rcvegrindexhead, 0,
sizeof ( rcvegrindexhead ) );
1393 unsigned int header_offs ) {
1404 unsigned int rcvtype;
1405 unsigned int pktlen;
1406 unsigned int egrindex;
1407 unsigned int useegrbfr;
1408 unsigned int iberr, mkerr, tiderr, khdrerr, mtuerr;
1409 unsigned int lenerr, parityerr, vcrcerr, icrcerr;
1411 unsigned int hdrqoffset;
1412 unsigned int header_len;
1413 unsigned int padded_payload_len;
1414 unsigned int wqe_idx;
1420 rcvhdrflags = ( qib7322_wq->
header + header_offs +
1422 rcvtype =
BIT_GET ( rcvhdrflags, RcvType );
1423 pktlen = (
BIT_GET ( rcvhdrflags, PktLen ) << 2 );
1424 egrindex =
BIT_GET ( rcvhdrflags, EgrIndex );
1425 useegrbfr =
BIT_GET ( rcvhdrflags, UseEgrBfr );
1426 hdrqoffset = (
BIT_GET ( rcvhdrflags, HdrqOffset ) << 2 );
1427 iberr =
BIT_GET ( rcvhdrflags, IBErr );
1428 mkerr =
BIT_GET ( rcvhdrflags, MKErr );
1429 tiderr =
BIT_GET ( rcvhdrflags, TIDErr );
1430 khdrerr =
BIT_GET ( rcvhdrflags, KHdrErr );
1431 mtuerr =
BIT_GET ( rcvhdrflags, MTUErr );
1432 lenerr =
BIT_GET ( rcvhdrflags, LenErr );
1433 parityerr =
BIT_GET ( rcvhdrflags, ParityErr );
1434 vcrcerr =
BIT_GET ( rcvhdrflags, VCRCErr );
1435 icrcerr =
BIT_GET ( rcvhdrflags, ICRCErr );
1437 sizeof ( *rcvhdrflags ) );
1438 padded_payload_len = ( pktlen - header_len - 4 );
1439 err = ( iberr | mkerr | tiderr | khdrerr | mtuerr |
1440 lenerr | parityerr | vcrcerr | icrcerr );
1443 header_len, header_len );
1446 DBGC2 (
qib7322,
"QIB7322 %p QPN %ld RX egr %04x%s hdr %d type %d len " 1447 "%d(%d+%d+4)%s%s%s%s%s%s%s%s%s%s%s\n",
qib7322,
qp->qpn,
1448 egrindex, ( useegrbfr ?
"" :
"(unused)" ),
1450 rcvtype, pktlen, header_len, padded_payload_len,
1451 ( err ?
" [Err" :
"" ), ( iberr ?
" IB" :
"" ),
1452 ( mkerr ?
" MK" :
"" ), ( tiderr ?
" TID" :
"" ),
1453 ( khdrerr ?
" KHdr" :
"" ), ( mtuerr ?
" MTU" :
"" ),
1454 ( lenerr ?
" Len" :
"" ), ( parityerr ?
" Parity" :
""),
1455 ( vcrcerr ?
" VCRC" :
"" ), ( icrcerr ?
" ICRC" :
"" ),
1456 ( err ?
"]" :
"" ) );
1458 ( header_len + sizeof ( *rcvhdrflags ) ) );
1461 qp0 = (
qp->qpn == 0 );
1464 &payload_len, &
dest, &source ) ) != 0 ) {
1465 DBGC (
qib7322,
"QIB7322 %p could not parse headers: %s\n",
1469 if ( ! intended_qp )
1501 iobuf = wq->
iobufs[wqe_idx];
1511 iob_put ( iobuf, payload_len );
1516 "%zd\n",
qib7322, payload_len );
1520 if (
qp != intended_qp ) {
1537 memset ( &rcvegr, 0,
sizeof ( rcvegr ) );
1561 unsigned int header_prod;
1569 while ( qib7322_wq->
header_cons != header_prod ) {
1589 memset ( &rcvhdrhead, 0,
sizeof ( rcvhdrhead ) );
1638 if ( errstatus.u.qwords[0] ) {
1640 port, errstatus.u.dwords[1], errstatus.u.dwords[0] );
1647 if (
BIT_GET ( &errstatus, IBStatusChanged ) )
1665 unsigned int port ) {
1669 unsigned int boardid;
1682 DBGC (
qib7322,
"QIB7322 %p port %d is invalid\n",
1691 switch ( boardid ) {
1693 DBGC2 (
qib7322,
"QIB7322 %p is a QMH7342; forcing QDR-only\n",
1703 (
supported ?
"supports" :
"disabled" ),
1724 BIT_SET ( &ibcctrla, IBLinkEn, 1 );
1744 BIT_SET ( &ibcctrla, IBLinkEn, 0 );
1833 unsigned int bit_id ) {
1857 unsigned int bit_id,
unsigned long data ) {
1863 unsigned int outputs = 0;
1864 unsigned int output_enables = 0;
1876 output_enables =
BIT_GET ( &extctrl, GPIOOe );
1877 output_enables = ( ( output_enables & ~
bit ) | ( ~
data &
bit ) );
1878 outputs =
BIT_GET ( &gpioout, GPIO );
1879 outputs = ( outputs & ~
bit );
1880 BIT_SET ( &extctrl, GPIOOe, output_enables );
1881 BIT_SET ( &gpioout, GPIO, outputs );
1906 static int try_eeprom_address[] = { 0x51, 0x50 };
1913 DBGC (
qib7322,
"QIB7322 %p could not initialise I2C bus: %s\n",
1919 for ( i = 0 ; i < (
sizeof ( try_eeprom_address ) /
1920 sizeof ( try_eeprom_address[0] ) ) ; i++ ) {
1925 qib7322, try_eeprom_address[i] );
1948 sizeof ( *
guid ) ) ) != 0 ) {
1949 DBGC (
qib7322,
"QIB7322 %p could not read GUID: %s\n",
1963 ( sizeof (
serial ) - 1 ) ) ) != 0 ) {
1964 DBGC (
qib7322,
"QIB7322 %p could not read serial: " 1968 DBGC2 (
qib7322,
"QIB7322 %p has serial number \"%s\"\n",
1996 if (
BIT_GET ( &transaction, ahb_rdy ) )
2001 DBGC (
qib7322,
"QIB7322 %p timed out waiting for AHB transaction\n",
2014 unsigned int location ) {
2019 memset ( &access, 0,
sizeof ( access ) );
2027 DBGC (
qib7322,
"QIB7322 %p could not obtain AHB ownership: " 2043 memset ( &access, 0,
sizeof ( access ) );
2069 write_not_read, 0 );
2141 new_value = ( ( old_value & ~mask ) |
value );
2143 qib7322, location, old_value, new_value );
2168 unsigned int location;
2175 value, mask ) ) != 0 )
2201 memset ( &ibcctrla, 0,
sizeof ( ibcctrla ) );
2203 FlowCtrlPeriod, 0x03,
2204 FlowCtrlWaterMark, 0x05,
2208 PhyerrThreshold, 0xf,
2209 OverrunThreshold, 0xf );
2218 BIT_SET ( &ibcctrlb, IB_ENHANCED_MODE, 0 );
2219 BIT_SET ( &ibcctrlb, SD_SPEED_SDR, 1 );
2220 BIT_SET ( &ibcctrlb, SD_SPEED_DDR, 0 );
2221 BIT_SET ( &ibcctrlb, SD_SPEED_QDR, 0 );
2222 BIT_SET ( &ibcctrlb, IB_NUM_CHANNELS, 1 );
2223 BIT_SET ( &ibcctrlb, IB_LANE_REV_SUPPORTED, 0 );
2224 BIT_SET ( &ibcctrlb, HRTBT_ENB, 0 );
2225 BIT_SET ( &ibcctrlb, HRTBT_AUTO, 0 );
2233 memset ( &ibpcsconfig, 0,
sizeof ( ibpcsconfig ) );
2292 goto err_alloc_qib7322;
2322 goto err_read_eeprom;
2334 goto err_init_ib_serdes;
2345 goto err_alloc_ibdev;
2370 DBGC (
qib7322,
"QIB7322 %p port %d could not register " 2372 goto err_register_ibdev;
2380 for ( i-- ; i >= 0 ; i-- ) {
2386 for ( i-- ; i >= 0 ; i-- )
2423 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.
uint8_t size
Entry size (in 32-bit words)
#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)
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
#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)
uint16_t 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.
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
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.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
An Infiniband Address Vector.
uint16_t offset
Offset to command line.
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.
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.
uint32_t supported
Bitmask of supported AENQ groups (device -> host)
#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.
#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.