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 ),
#define NULL
NULL pointer (VOID *)
struct golan_eq_context ctx
struct arbelprm_rc_send_wqe rc
pseudo_bit_t value[0x00020]
uint8_t headers[IB_MAX_HEADER_SIZE]
struct arbelprm_qp_db_record qp
unsigned long long uint64_t
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" retur dest)
#define build_assert(condition)
Assert a condition at build time (after dead code elimination)
#define assert(condition)
Assert a condition at run-time.
uint16_t offset
Offset to command line.
uint32_t addr
Buffer address.
uint64_t serial
Serial number.
uint32_t features
Supported features.
uint8_t data[48]
Additional event data.
uint16_t supported
Bitmask of supported option values.
uint32_t xact
Requester transaction ID.
#define __unused
Declare a variable or data structure as unused.
#define DBG_DISABLE(level)
#define DBG_ENABLE(level)
uint8_t bufsize
Size of the packet, in bytes.
uint32_t start
Starting offset.
uint16_t size
Buffer size.
static unsigned int count
Number of entries.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOENT
No such file or directory.
#define EINVAL
Invalid argument.
#define ETIMEDOUT
Connection timed out.
#define EPROTO
Protocol error.
#define ENOMEM
Not enough space.
#define EIO
Input/output error.
#define ECANCELED
Operation canceled.
#define ENOBUFS
No buffer space available.
#define ENODEV
No such device.
static int i2c_check_presence(struct i2c_interface *i2c, struct i2c_device *i2cdev)
Check presence of I2C device.
@ I2C_BIT_SDA
Serial data.
@ I2C_BIT_SCL
Serial clock.
static __always_inline void init_i2c_eeprom(struct i2c_device *i2cdev, unsigned int dev_addr)
Initialise generic I2C EEPROM device.
int init_i2c_bit_basher(struct i2c_bit_basher *i2cbit, struct bit_basher_operations *bash_op)
Initialise I2C bit-bashing interface.
#define IB_LINK_SPEED_DDR
#define IB_LINK_SPEED_SDR
#define IB_LINK_SPEED_QDR
struct ib_port_info port_info
uint32_t revision
Entry point revision.
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.
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 IB_GUID_FMT
Infiniband Globally Unique Identifier debug message format.
#define IB_MAX_HEADER_SIZE
Maximum size required for IB headers.
#define IB_GUID_ARGS(guid)
Infiniband Globally Unique Identifier debug message arguments.
static unsigned int unsigned int bit
void mb(void)
Memory barrier.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
#define writeq(data, io_addr)
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void ib_link_state_changed(struct ib_device *ibdev)
Notify of Infiniband link state change.
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.
int register_ibdev(struct ib_device *ibdev)
Register Infiniband device.
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
void ib_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf, int rc)
Complete send work queue entry.
struct ib_device * alloc_ibdev(size_t priv_size)
Allocate Infiniband device.
static __always_inline void * ib_get_drvdata(struct ib_device *ibdev)
Get Infiniband device driver-private data.
static __always_inline void ib_set_drvdata(struct ib_device *ibdev, void *priv)
Set Infiniband device driver-private data.
static __always_inline void * ib_wq_get_drvdata(struct ib_work_queue *wq)
Get Infiniband work queue driver-private data.
static __always_inline void ib_wq_set_drvdata(struct ib_work_queue *wq, void *priv)
Set Infiniband work queue driver-private data.
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
#define iob_put(iobuf, len)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_reserve(iobuf, len)
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
void * zalloc(size_t size)
Allocate cleared memory.
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Dynamic memory allocation.
static unsigned int unsigned int reg
uint32_t channel
RNDIS channel.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
#define __pci_driver
Declare a PCI driver.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
void pci_restore(struct pci_device *pci, struct pci_config_backup *backup, unsigned int limit, const uint8_t *exclude)
Restore PCI configuration space.
void pci_backup(struct pci_device *pci, struct pci_config_backup *backup, unsigned int limit, const uint8_t *exclude)
Back up PCI configuration space.
PCI configuration space backup and restoration.
#define PCI_CONFIG_BACKUP_ALL
Limit of PCI configuration space.
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
#define BIT_FILL_5(_ptr, _field1,...)
#define BIT_FILL_3(_ptr, _field1,...)
#define BIT_SET(_ptr, _field, _value)
#define BIT_FILL_2(_ptr, _field1,...)
#define BIT_FILL_6(_ptr, _field1,...)
#define BIT_FILL_1(_ptr, _field1,...)
static void qib7322_destroy_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy receive work queue.
#define qib7322_writeq_array64k(_qib7322, _ptr, _offset, _idx)
static int qib7322_read_eeprom(struct qib7322 *qib7322)
Read EEPROM parameters.
static const char * qib7322_link_state_text(unsigned int link_state)
Textual representation of link state.
static int qib7322_link_state_check(struct ib_device *ibdev, unsigned int new_link_state)
Wait for link state change to take effect.
static int qib7322_ahb_write(struct qib7322 *qib7322, unsigned int location, uint32_t data)
Write data via AHB.
static int qib7322_open(struct ib_device *ibdev)
Initialise Infiniband link.
static int qib7322_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
static void qib7322_i2c_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Write QIB7322 I2C line status.
static int qib7322_init_i2c(struct qib7322 *qib7322)
Initialise QIB7322 I2C subsystem.
static int qib7322_alloc_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Allocate a context and set queue pair number.
static struct bit_basher_operations qib7322_i2c_basher_ops
QIB7322 I2C bit-bashing interface operations.
static int qib7322_init_ib_serdes(struct qib7322 *qib7322)
Initialise the IB SerDes.
static int qib7322_init_recv(struct qib7322 *qib7322)
Initialise receive datapath.
static int qib7322_set_port_info(struct ib_device *ibdev, union ib_mad *mad)
Set port information.
static void qib7322_close(struct ib_device *ibdev)
Close Infiniband link.
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.
static void qib7322_poll_eq(struct ib_device *ibdev)
Poll event queue.
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.
#define qib7322_writeq_port(_qib7322, _ptr, _offset, _port)
static int qib7322_ahb_wait(struct qib7322 *qib7322)
Wait for AHB transaction to complete.
static void qib7322_link_state_changed(struct ib_device *ibdev)
Handle link state change.
static void qib7322_fini_send(struct qib7322 *qib7322)
Shut down send datapath.
static int qib7322_probe(struct pci_device *pci)
Probe PCI device.
static void qib7322_ahb_release(struct qib7322 *qib7322)
Release ownership of the AHB.
static void qib7322_free_send_buf(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs, unsigned int send_buf)
Free a send buffer.
static int qib7322_init_send(struct qib7322 *qib7322)
Initialise send datapath.
static int qib7322_create_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create queue pair.
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.
static unsigned int qib7322_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Get queue pair context number.
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_complete_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int header_offs)
Complete receive work queue entry.
static void qib7322_destroy_send_bufs(struct qib7322 *qib7322 __unused, struct qib7322_send_buffers *send_bufs)
Destroy send buffer set.
static int qib7322_create_send_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create send work queue.
static int qib7322_create_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create receive work queue.
static unsigned int qib7322_link_speed_supported(struct qib7322 *qib7322, unsigned int port)
Determine supported link speeds.
#define qib7322_readq_port(_qib7322, _ptr, _offset, _port)
static void qib7322_destroy_send_wq(struct ib_device *ibdev __unused, struct ib_queue_pair *qp)
Destroy send work queue.
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.
static int qib7322_ahb_request(struct qib7322 *qib7322, unsigned int location)
Request ownership of the AHB.
#define QIB7322_SEND_BUF_TOGGLE
Send buffer toggle bit.
static int qib7322_send_buf_in_use(struct qib7322 *qib7322, unsigned int send_buf)
Check to see if send buffer is in use.
static void qib7322_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int wqe_idx)
Complete send work queue entry.
static void qib7322_mcast_detach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Detach from multicast group.
static void qib7322_writel(struct qib7322 *qib7322, uint32_t dword, unsigned long offset)
Write QIB7322 dword register.
static int qib7322_set_pkey_table(struct ib_device *ibdev __unused, union ib_mad *mad __unused)
Set partition key table.
static void qib7322_poll_send_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll send work queue.
static int qib7322_create_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
static int qib7322_mcast_attach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
static void qib7322_reset(struct qib7322 *qib7322, struct pci_device *pci)
Reset QIB7322.
static int qib7322_ahb_mod_reg(struct qib7322 *qib7322, unsigned int location, uint32_t value, uint32_t mask)
Read/modify/write AHB register.
#define qib7322_writeq_array8b(_qib7322, _ptr, _offset, _idx)
static void qib7322_poll_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll receive work queue.
static void qib7322_remove(struct pci_device *pci)
Remove PCI device.
static int qib7322_i2c_read_bit(struct bit_basher *basher, unsigned int bit_id)
Read QIB7322 I2C line status.
static struct ib_device_operations qib7322_ib_operations
QIB7322 Infiniband operations.
#define qib7322_readq(_qib7322, _ptr, _offset)
static int qib7322_ahb_read(struct qib7322 *qib7322, unsigned int location, uint32_t *data)
Read data via AHB.
static void qib7322_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
static void qib7322_free_ctx(struct ib_device *ibdev, struct ib_queue_pair *qp)
Free a context.
static unsigned int qib7322_i2c_bits[]
QIB7322 I2C bit to GPIO mappings.
#define qib7322_writeq(_qib7322, _ptr, _offset)
static int qib7322_alloc_send_buf(struct qib7322 *qib7322, struct qib7322_send_buffers *send_bufs)
Allocate a send buffer.
static void qib7322_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
static void qib7322_fini_recv(struct qib7322 *qib7322 __unused)
Shut down receive datapath.
static void qib7322_poll_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Poll completion queue.
static struct pci_device_id qib7322_nics[]
QLogic QIB7322 Infiniband HCA.
#define QIB7322_LARGE_SEND_BUF_COUNT
QIB7322 large send buffer count.
#define QIB7322_VL15_PORT1_SEND_BUF_SIZE
QIB7322 VL15 port 0 send buffer size.
#define QIB7322_EAGER_ARRAY_SIZE_10CTX_KERNEL
#define QIB7322_SMALL_SEND_BUF_START
QIB7322 small send buffer starting index.
#define QIB7322_LINK_STATE_MAX_WAIT_US
Maximum time to wait for link state changes, in us.
#define QIB7322_RECV_HEADERS_SIZE
Total size of an RX header ring.
#define QIB7322_AHB_MAX_WAIT_US
Maximum time for wait for AHB, in us.
#define QIB7322_SMALL_SEND_BUF_SIZE
QIB7322 small send buffer size.
#define QIB7322_VL15_PORT1_SEND_BUF_COUNT
QIB7322 VL15 port 0 send buffer count.
#define QIB7322_QP_IDETH
QPN used for Infinipath Packets.
#define QIB7322_LARGE_SEND_BUF_SIZE
QIB7322 large send buffer size.
#define QIB7322_VL15_PORT0_SEND_BUF_COUNT
QIB7322 VL15 port 0 send buffer count.
#define QIB7322_BAR0_SIZE
QIB7322 memory BAR size.
#define QIB7322_EAGER_ARRAY_SIZE_18CTX_KERNEL
#define QIB7322_GPIO_SCL
QIB7322 I2C SCL line GPIO number.
#define QIB7322_RECV_HEADERS_ALIGN
RX header alignment.
#define QIB7322_SENDBUFAVAIL_ALIGN
DMA alignment for send buffer availability.
#define QIB7322_GPIO_SDA
QIB7322 I2C SDA line GPIO number.
#define QIB7322_EAGER_ARRAY_SIZE_10CTX_USER
#define QIB7322_MAX_PORTS
QIB7322 maximum number of ports.
#define QIB7322_SMALL_SEND_BUF_USED
Number of small send buffers used.
#define QIB7322_AHB_LOC_ADDRESS(_location)
QIB7322 AHB locations.
@ QIB7322_LINK_STATE_ACT_DEFER
@ QIB7322_LINK_STATE_DOWN
@ QIB7322_LINK_STATE_INIT
@ QIB7322_LINK_STATE_ACTIVE
#define QIB7322_PORT_BASE
QIB7322 base port number.
#define QIB7322_EAGER_BUFFER_ALIGN
Eager buffer required alignment.
#define QIB7322_EAGER_ARRAY_SIZE_18CTX_USER
#define QIB7322_RECV_HEADER_COUNT
Number of RX headers per context.
#define QIB7322_EEPROM_SERIAL_SIZE
Board serial number size within EEPROM.
#define QIB7322_EEPROM_SERIAL_OFFSET
Board serial number offset within EEPROM.
#define QIB7322_RECV_HEADER_SIZE
Maximum size of each RX header.
#define QIB7322_VL15_PORT0_SEND_BUF_SIZE
QIB7322 VL15 port 0 send buffer size.
#define QIB7322_EAGER_ARRAY_SIZE_6CTX_KERNEL
ContextCfg values for different numbers of contexts.
@ QIB7322_EAGER_BUFFER_NONE
@ QIB7322_EAGER_BUFFER_16K
@ QIB7322_EAGER_BUFFER_8K
@ QIB7322_EAGER_BUFFER_32K
@ QIB7322_EAGER_BUFFER_2K
@ QIB7322_EAGER_BUFFER_64K
@ QIB7322_EAGER_BUFFER_4K
#define QIB7322_EAGER_ARRAY_SIZE_6CTX_USER
#define QIB7322_NUM_CONTEXTS
Number of contexts (including kernel context)
#define QIB7322_MAX_CREDITS_VL15
Number of credits to advertise for VL15.
#define QIB7322_MAX_CREDITS_VL0
Number of credits to advertise for VL0.
#define QIB7322_AHB_LOCATION(_port, _channel, _register)
#define QIB7322_AHB_LOC_TARGET(_location)
#define QIB7322_EEPROM_GUID_OFFSET
GUID offset within EEPROM.
@ QIB7322_CONTEXTCFG_18CTX
@ QIB7322_CONTEXTCFG_10CTX
@ QIB7322_CONTEXTCFG_6CTX
#define QIB7322_MAX_WIDTH
QIB7322 maximum width.
#define QIB7322_VL15_PORT0_SEND_BUF_START
QIB7322 VL15 port 0 send buffer starting index.
#define QIB7322_RECV_PAYLOAD_SIZE
RX payload size.
#define QIB7322_VL15_PORT1_SEND_BUF_START
QIB7322 VL15 port 0 send buffer starting index.
#define QIB_7322_SendCtrl_0_offset
#define QIB_7322_RcvCtrl_0_offset
#define QIB_7322_SendCtrl_offset
#define QIB_7322_Control_offset
#define QIB_7322_RxCreditVL0_1_offset
#define QIB_7322_IBCCtrlB_1_offset
#define QIB_7322_RcvEgrBase_offset
#define QIB_7322_IBPCSConfig_1_offset
#define QIB_7322_RcvQPMapTableB_0_offset
#define QIB_7322_IBCStatusA_0_offset
#define QIB_7322_IBCCtrlA_0_offset
#define QIB_7322_RcvCtrl_offset
#define QIB_7322_RcvQPMulticastContext_0_offset
#define QIB_7322_ErrStatus_0_offset
#define QIB_7322_SendBufBase_offset
#define QIB_7322_RcvHdrCnt_offset
#define QIB_7322_GPIOOut_offset
#define QIB_7322_RcvHdrHead0_offset
#define QIB_7322_RcvQPMapTableB_1_offset
#define QIB_7322_RcvQPMapTableA_1_offset
#define QIB_7322_RcvBTHQP_0_offset
#define QIB_7322_RcvBTHQP_1_offset
#define QIB_7322_EXTCtrl_offset
#define QIB_7322_ErrClear_0_offset
#define QIB_7322_EXTStatus_offset
#define QIB_7322_ahb_transaction_reg_offset
#define QIB_7322_IBCCtrlB_0_offset
#define QIB_7322_SendCtrl_1_offset
#define QIB_7322_RcvQPMulticastContext_1_offset
#define QIB_7322_SendBufAvailAddr_offset
#define QIB_7322_Revision_offset
#define QIB_7322_RcvQPMapTableA_0_offset
#define QIB_7322_RcvHdrTailAddr0_offset
#define QIB_7322_RcvEgrIndexHead0_offset
#define QIB_7322_active_feature_mask_offset
#define QIB_7322_RcvHdrEntSize_offset
#define QIB_7322_IBPCSConfig_0_offset
#define QIB_7322_RxCreditVL0_0_offset
#define QIB_7322_RcvCtrl_1_offset
#define QIB_7322_ahb_access_ctrl_offset
#define QIB_7322_RcvHdrAddr0_offset
#define QIB_7322_IBCCtrlA_1_offset
static void(* free)(struct refcnt *refcnt))
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
A bit-bashing I2C interface.
struct i2c_interface i2c
I2C interface.
struct bit_basher basher
Bit-bashing interface.
int(* read)(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, uint8_t *data, unsigned int len)
Read data from I2C device.
An Infiniband Address Vector.
An Infiniband Completion Queue.
unsigned long cqn
Completion queue number.
struct list_head work_queues
List of work queues completing to this queue.
Infiniband device operations.
uint8_t link_width_enabled
Link width enabled.
uint8_t link_speed_active
Link speed active.
unsigned int ports
Total ports on device.
uint8_t link_speed_supported
Link speed supported.
struct ib_device_operations * op
Infiniband operations.
union ib_guid node_guid
Node GUID.
struct device * dev
Underlying device.
uint8_t link_width_active
Link width active.
uint8_t link_speed_enabled
Link speed enabled.
uint8_t link_width_supported
Link width supported.
uint8_t port_state
Port state.
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
unsigned int port
Port number.
A Port Information attribute.
An Infiniband Queue Pair.
struct ib_work_queue recv
Receive queue.
unsigned long qpn
Queue pair number.
An Infiniband Work Queue.
unsigned int fill
Number of occupied work queue entries.
struct io_buffer ** iobufs
I/O buffers assigned to work queue.
struct ib_completion_queue * cq
Associated completion queue.
struct list_head list
List of work queues on this completion queue.
struct ib_queue_pair * qp
Containing queue pair.
int is_send
"Is a send queue" flag
unsigned int num_wqes
Number of work queue entries.
void * data
Start of data.
A PCI configuration space backup.
A PCI device ID list entry.
unsigned long membase
Memory base.
struct device dev
Generic device.
int(* probe)(struct pci_device *pci)
Probe device.
A QIB7322 receive work queue.
unsigned long eager_array
Offset within register space of the eager array.
struct QIB_7322_scalar header_prod
Receive header producer offset (written by hardware)
unsigned int header_cons
Receive header consumer offset.
unsigned int eager_prod
Eager array producer index.
unsigned int eager_entries
Number of entries in eager array.
unsigned int eager_cons
Eager array consumer index.
void * header
Receive header ring.
A QIB7322 send buffer set.
uint16_t avail[0]
Send buffer availability.
unsigned int prod
Send buffer availability producer counter.
unsigned int size
Send buffer size.
unsigned int count
Number of send buffers.
unsigned long base
Offset within register space of the first send buffer.
unsigned int start
Index of first send buffer.
unsigned int cons
Send buffer availability consumer counter.
A QIB7322 send work queue.
uint16_t * used
Send buffer usage.
unsigned int cons
Consumer index.
struct qib7322_send_buffers * send_bufs
Send buffer set.
unsigned int prod
Producer index.
struct i2c_bit_basher i2c
I2C bit-bashing interface.
struct QIB_7322_SendBufAvail * sendbufavail
Send buffer availability (reported by hardware)
struct qib7322_send_buffers * send_bufs_vl15_port0
VL15 port 0 send buffers.
union ib_guid guid
Base GUID.
struct i2c_device eeprom
I2C serial EEPROM.
struct qib7322_recv_work_queue recv_wq[QIB7322_NUM_CONTEXTS]
Receive work queues.
struct qib7322_send_buffers * send_bufs_vl15_port1
VL15 port 1 send buffers.
struct ib_device * ibdev[QIB7322_MAX_PORTS]
Infiniband devices.
struct qib7322_send_buffers * send_bufs_small
Small send buffers.
uint8_t used_ctx[QIB7322_NUM_CONTEXTS]
In-use contexts.
struct qib7322_send_work_queue send_wq[QIB7322_NUM_CONTEXTS]
Send work queues.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
An Infiniband Global Identifier.
struct ib_gid::@251011351113275240012301235177256303262052134237 s
An Infiniband Globally Unique Identifier.
static struct xen_remove_from_physmap * remove