128 #define linda_readq( _linda, _ptr, _offset ) \ 129 linda_readq ( (_linda), (_ptr)->u.qwords, (_offset) ) 130 #define linda_readq_array8b( _linda, _ptr, _offset, _idx ) \ 131 linda_readq ( (_linda), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) ) 132 #define linda_readq_array64k( _linda, _ptr, _offset, _idx ) \ 133 linda_readq ( (_linda), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ) ) 146 #define linda_writeq( _linda, _ptr, _offset ) \ 147 linda_writeq ( (_linda), (_ptr)->u.qwords, (_offset) ) 148 #define linda_writeq_array8b( _linda, _ptr, _offset, _idx ) \ 149 linda_writeq ( (_linda), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) ) 150 #define linda_writeq_array64k( _linda, _ptr, _offset, _idx ) \ 151 linda_writeq ( (_linda), (_ptr), ( (_offset) + ( (_idx) * 65536 ) ) ) 179 switch ( link_state ) {
185 default:
return "UNKNOWN";
198 unsigned int link_state;
199 unsigned int link_width;
200 unsigned int link_speed;
204 link_state =
BIT_GET ( &ibcstatus, LinkState );
205 link_width =
BIT_GET ( &ibcstatus, LinkWidthActive );
206 link_speed =
BIT_GET ( &ibcstatus, LinkSpeedActive );
209 ( link_speed ?
"DDR" :
"SDR" ), ( link_width ?
"x4" :
"x1" ) );
213 BIT_SET ( &extctrl, LEDPriPortGreenOn,
215 BIT_SET ( &extctrl, LEDPriPortYellowOn,
236 unsigned int new_link_state ) {
238 unsigned int link_state;
243 link_state =
BIT_GET ( &ibcstatus, LinkState );
244 if ( link_state == new_link_state )
249 DBGC (
linda,
"Linda %p timed out waiting for link state %s\n",
265 unsigned int link_state;
274 BIT_SET ( &ibcctrl, LinkCmd, link_state );
378 #define LINDA_SEND_BUF_TOGGLE 0x80 391 unsigned int send_buf;
407 unsigned int send_buf ) {
421 unsigned int send_buf ) {
422 unsigned int send_idx;
423 unsigned int send_check;
424 unsigned int inusecheck;
431 inuse = ( !! ( inusecheck & 0x02 ) );
432 check = ( !! ( inusecheck & 0x01 ) );
433 return ( inuse || ( check != send_check ) );
444 unsigned int send_buf ) {
465 DBGC (
linda,
"Linda %p out of send buffers (have %d, used " 469 goto err_reserve_bufs;
482 goto err_alloc_send_buf;
526 DBGC (
linda,
"Linda %p send buffers at %lx\n",
538 goto err_alloc_sendbufavail;
543 memset ( &sendbufavailaddr, 0,
sizeof ( sendbufavailaddr ) );
544 BIT_FILL_1 ( &sendbufavailaddr, SendBufAvailAddr,
550 memset ( &sendctrl, 0,
sizeof ( sendctrl ) );
559 err_alloc_sendbufavail:
572 memset ( &sendctrl, 0,
sizeof ( sendctrl ) );
618 if ( ! linda_wq->
header ) {
620 goto err_alloc_header;
624 memset ( &rcvhdraddr, 0,
sizeof ( rcvhdraddr ) );
629 memset ( &rcvhdrtailaddr, 0,
sizeof ( rcvhdrtailaddr ) );
630 BIT_FILL_1 ( &rcvhdrtailaddr, RcvHdrTailAddr0,
634 memset ( &rcvhdrhead, 0,
sizeof ( rcvhdrhead ) );
638 memset ( &rcvegrindexhead, 0,
sizeof ( rcvegrindexhead ) );
647 DBGC (
linda,
"Linda %p QPN %ld CTX %d hdrs [%lx,%lx) prod %lx\n",
700 unsigned int portcfg;
701 unsigned long egrbase;
702 unsigned int eager_array_size_0;
703 unsigned int eager_array_size_other;
729 memset ( &rcvctrl, 0,
sizeof ( rcvctrl ) );
737 memset ( &rcvhdrcnt, 0,
sizeof ( rcvhdrcnt ) );
740 memset ( &rcvhdrentsize, 0,
sizeof ( rcvhdrentsize ) );
746 egrbase =
BIT_GET ( &rcvegrbase, Value );
753 egrbase += ( eager_array_size_other *
757 DBGC (
linda,
"Linda %p CTX %d eager array at %lx (%d " 764 memset ( &rcvbthqp, 0,
sizeof ( rcvbthqp ) );
864 goto err_create_recv_wq;
868 goto err_create_send_wq;
939 unsigned int send_buf;
940 unsigned long start_offset;
962 iob_len ( iobuf ) + 3 ) & ~3 );
965 memset ( &sendpbc, 0,
sizeof ( sendpbc ) );
967 LengthP1_toibc, ( (
len >> 2 ) - 1 ),
973 offset +=
sizeof ( sendpbc );
977 frag_len > 0 ;
data++,
offset += 4, frag_len -= 4 ) {
983 frag_len > 0 ;
data++,
offset += 4, frag_len -= 4 ) {
989 DBGC2 (
linda,
"Linda %p QPN %ld TX %d(%d) posted [%lx,%lx)\n",
1008 unsigned int wqe_idx ) {
1013 unsigned int send_buf;
1016 send_buf = linda_wq->
send_buf[wqe_idx];
1017 DBGC2 (
linda,
"Linda %p QPN %ld TX %d(%d) complete\n",
1018 linda,
qp->qpn, send_buf, wqe_idx );
1021 iobuf = wq->
iobufs[wqe_idx];
1044 while ( wq->
fill ) {
1055 linda_wq->
cons = ( ( linda_wq->
cons + 1 ) &
1079 unsigned int wqe_idx;
1086 DBGC (
linda,
"Linda %p QPN %ld misaligned RX buffer " 1091 DBGC (
linda,
"Linda %p QPN %ld wrong RX buffer size (%zd)\n",
1101 wq->
iobufs[wqe_idx] = iobuf;
1116 memset ( &rcvegr, 0,
sizeof ( rcvegr ) );
1118 Addr, (
addr >> 11 ),
1122 DBGC2 (
linda,
"Linda %p QPN %ld RX egr %d(%d) posted [%lx,%lx)\n",
1131 memset ( &rcvegrindexhead, 0,
sizeof ( rcvegrindexhead ) );
1150 unsigned int header_offs ) {
1161 unsigned int rcvtype;
1162 unsigned int pktlen;
1163 unsigned int egrindex;
1164 unsigned int useegrbfr;
1165 unsigned int iberr, mkerr, tiderr, khdrerr, mtuerr;
1166 unsigned int lenerr, parityerr, vcrcerr, icrcerr;
1168 unsigned int hdrqoffset;
1169 unsigned int header_len;
1170 unsigned int padded_payload_len;
1171 unsigned int wqe_idx;
1177 rcvhdrflags = ( linda_wq->
header + header_offs +
1179 rcvtype =
BIT_GET ( rcvhdrflags, RcvType );
1180 pktlen = (
BIT_GET ( rcvhdrflags, PktLen ) << 2 );
1181 egrindex =
BIT_GET ( rcvhdrflags, EgrIndex );
1182 useegrbfr =
BIT_GET ( rcvhdrflags, UseEgrBfr );
1183 hdrqoffset = (
BIT_GET ( rcvhdrflags, HdrqOffset ) << 2 );
1184 iberr =
BIT_GET ( rcvhdrflags, IBErr );
1185 mkerr =
BIT_GET ( rcvhdrflags, MKErr );
1186 tiderr =
BIT_GET ( rcvhdrflags, TIDErr );
1187 khdrerr =
BIT_GET ( rcvhdrflags, KHdrErr );
1188 mtuerr =
BIT_GET ( rcvhdrflags, MTUErr );
1189 lenerr =
BIT_GET ( rcvhdrflags, LenErr );
1190 parityerr =
BIT_GET ( rcvhdrflags, ParityErr );
1191 vcrcerr =
BIT_GET ( rcvhdrflags, VCRCErr );
1192 icrcerr =
BIT_GET ( rcvhdrflags, ICRCErr );
1194 sizeof ( *rcvhdrflags ) );
1195 padded_payload_len = ( pktlen - header_len - 4 );
1196 err = ( iberr | mkerr | tiderr | khdrerr | mtuerr |
1197 lenerr | parityerr | vcrcerr | icrcerr );
1200 header_len, header_len );
1203 if ( err || ( ! useegrbfr ) ) {
1204 DBGC (
linda,
"Linda %p QPN %ld RX egr %d%s hdr %d type %d " 1205 "len %d(%d+%d+4)%s%s%s%s%s%s%s%s%s%s%s\n",
linda,
1206 qp->qpn, egrindex, ( useegrbfr ?
"" :
"(unused)" ),
1208 pktlen, header_len, padded_payload_len,
1209 ( err ?
" [Err" :
"" ), ( iberr ?
" IB" :
"" ),
1210 ( mkerr ?
" MK" :
"" ), ( tiderr ?
" TID" :
"" ),
1211 ( khdrerr ?
" KHdr" :
"" ), ( mtuerr ?
" MTU" :
"" ),
1212 ( lenerr ?
" Len" :
"" ), ( parityerr ?
" Parity" :
""),
1213 ( vcrcerr ?
" VCRC" :
"" ), ( icrcerr ?
" ICRC" :
"" ),
1214 ( err ?
"]" :
"" ) );
1216 DBGC2 (
linda,
"Linda %p QPN %ld RX egr %d hdr %d type %d " 1217 "len %d(%d+%d+4)\n",
linda,
qp->qpn, egrindex,
1219 pktlen, header_len, padded_payload_len );
1222 ( header_len + sizeof ( *rcvhdrflags ) ) );
1225 qp0 = (
qp->qpn == 0 );
1228 &payload_len, &
dest, &source ) ) != 0 ) {
1229 DBGC (
linda,
"Linda %p could not parse headers: %s\n",
1233 if ( ! intended_qp )
1265 iobuf = wq->
iobufs[wqe_idx];
1275 iob_put ( iobuf, payload_len );
1279 DBGC (
linda,
"Linda %p bad payload len %zd\n",
1280 linda, payload_len );
1284 if (
qp != intended_qp ) {
1285 DBGC (
linda,
"Linda %p redirecting QPN %ld " 1301 memset ( &rcvegr, 0,
sizeof ( rcvegr ) );
1324 unsigned int header_prod;
1343 memset ( &rcvhdrhead, 0,
sizeof ( rcvhdrhead ) );
1392 if (
BIT_GET ( &errstatus, IBStatusChanged ) ) {
1394 memset ( &errclear, 0,
sizeof ( errclear ) );
1395 BIT_FILL_1 ( &errclear, IBStatusChangedClear, 1 );
1523 unsigned int bit_id ) {
1547 unsigned int bit_id,
unsigned long data ) {
1553 unsigned int outputs = 0;
1554 unsigned int output_enables = 0;
1566 output_enables =
BIT_GET ( &extctrl, GPIOOe );
1567 output_enables = ( ( output_enables & ~
bit ) | ( ~
data &
bit ) );
1568 outputs =
BIT_GET ( &gpioout, GPIO );
1569 outputs = ( outputs & ~
bit );
1570 BIT_SET ( &extctrl, GPIOOe, output_enables );
1571 BIT_SET ( &gpioout, GPIO, outputs );
1596 static int try_eeprom_address[] = { 0x51, 0x50 };
1603 DBGC (
linda,
"Linda %p could not initialise I2C bus: %s\n",
1609 for ( i = 0 ; i < (
sizeof ( try_eeprom_address ) /
1610 sizeof ( try_eeprom_address[0] ) ) ; i++ ) {
1614 DBGC2 (
linda,
"Linda %p found EEPROM at %02x\n",
1615 linda, try_eeprom_address[i] );
1637 guid->bytes, sizeof ( *
guid ) ) ) != 0 ) {
1638 DBGC (
linda,
"Linda %p could not read GUID: %s\n",
1652 ( sizeof (
serial ) - 1 ) ) ) != 0 ) {
1653 DBGC (
linda,
"Linda %p could not read serial: %s\n",
1657 DBGC2 (
linda,
"Linda %p has serial number \"%s\"\n",
1682 memset ( &access, 0,
sizeof ( access ) );
1690 if (
BIT_GET ( &access, sw_ib_epb_req_granted ) )
1695 DBGC (
linda,
"Linda %p timed out waiting for IB EPB request\n",
1719 DBGC (
linda,
"Linda %p EPB transaction " 1720 "failed\n",
linda );
1729 DBGC (
linda,
"Linda %p timed out waiting for IB EPB transaction\n",
1742 memset ( &access, 0,
sizeof ( access ) );
1795 unsigned int data ) {
1833 unsigned int channel,
unsigned int element,
1834 unsigned int reg,
unsigned int value,
1835 unsigned int mask ) {
1836 unsigned int location;
1851 if ( (~mask) & 0xff ) {
1853 if ( old_value < 0 ) {
1863 DBGCP (
linda,
"Linda %p CS %d EPB(%d,%d,%#02x) %#02x => %#02x\n",
1890 unsigned int address_hi;
1891 unsigned int address_lo;
1920 address_hi = (
address >> 8 );
1923 address_hi ) ) != 0 )
1925 address_lo = (
address & 0xff );
1928 address_lo ) ) != 0 )
1985 #define LINDA_EPB_ALL_CHANNELS 31 1988 #define LINDA_SERDES_PARAM_END { 0, 0, 0 } 2000 unsigned int channel_start;
2001 unsigned int channel_end;
2002 unsigned int element;
2014 channel_start = channel_end =
channel;
2022 param->mask ) ) != 0 )
2041 for ( ; params->
mask != 0 ; params++ ){
2050 #define LINDA_DDS_VAL( amp_d, main_d, ipst_d, ipre_d, \ 2051 amp_s, main_s, ipst_s, ipre_s ) \ 2052 { LINDA_EPB_ADDRESS ( LINDA_EPB_ALL_CHANNELS, 9, 0x00 ), \ 2053 ( ( ( amp_d & 0x1f ) << 1 ) | 1 ), 0xff }, \ 2054 { LINDA_EPB_ADDRESS ( LINDA_EPB_ALL_CHANNELS, 9, 0x01 ), \ 2055 ( ( ( amp_s & 0x1f ) << 1 ) | 1 ), 0xff }, \ 2056 { LINDA_EPB_ADDRESS ( LINDA_EPB_ALL_CHANNELS, 9, 0x09 ), \ 2057 ( ( main_d << 3 ) | 4 | ( ipre_d >> 2 ) ), 0xff }, \ 2058 { LINDA_EPB_ADDRESS ( LINDA_EPB_ALL_CHANNELS, 9, 0x0a ), \ 2059 ( ( main_s << 3 ) | 4 | ( ipre_s >> 2 ) ), 0xff }, \ 2060 { LINDA_EPB_ADDRESS ( LINDA_EPB_ALL_CHANNELS, 9, 0x06 ), \ 2061 ( ( ( ipst_d & 0xf ) << 1 ) | \ 2062 ( ( ipre_d & 3 ) << 6 ) | 0x21 ), 0xff }, \ 2063 { LINDA_EPB_ADDRESS ( LINDA_EPB_ALL_CHANNELS, 9, 0x07 ), \ 2064 ( ( ( ipst_s & 0xf ) << 1 ) | \ 2065 ( ( ipre_s & 3 ) << 6) | 0x21 ), 0xff } 2141 DBGC (
linda,
"Linda %p could not load IB firmware: %s\n",
2161 offset +=
sizeof ( verify ) ) {
2164 sizeof (verify) )) != 0 ){
2165 DBGC (
linda,
"Linda %p could not read back IB " 2170 sizeof ( verify ) ) != 0 ) {
2171 DBGC (
linda,
"Linda %p firmware verification failed " 2174 sizeof ( verify ) );
2204 if (
BIT_GET ( &intstatus, IBSerdesTrimDone ) ) {
2211 DBGC (
linda,
"Linda %p timed out waiting for trim done\n",
linda );
2240 memset ( &ibcctrl, 0,
sizeof ( ibcctrl ) );
2242 FlowCtrlPeriod, 0x03,
2243 FlowCtrlWaterMark, 0x05,
2247 PhyerrThreshold, 0xf,
2248 OverrunThreshold, 0xf,
2257 BIT_SET ( &ibcddrctrl, IB_ENHANCED_MODE, 0 );
2258 BIT_SET ( &ibcddrctrl, SD_SPEED_SDR, 1 );
2259 BIT_SET ( &ibcddrctrl, SD_SPEED_DDR, 0 );
2260 BIT_SET ( &ibcddrctrl, SD_SPEED_QDR, 0 );
2261 BIT_SET ( &ibcddrctrl, HRTBT_ENB, 0 );
2262 BIT_SET ( &ibcddrctrl, HRTBT_AUTO, 0 );
2295 BIT_SET ( &xgxscfg, tx_rx_reset, 0 );
2296 BIT_SET ( &xgxscfg, xcv_reset, 0 );
2326 goto err_alloc_ibdev;
2365 goto err_read_eeprom;
2379 goto err_init_ib_serdes;
2383 DBGC (
linda,
"Linda %p could not register IB " 2385 goto err_register_ibdev;
2422 PCI_ROM ( 0x1077, 0x7220,
"iba7220",
"QLE7240/7280 HCA driver", 0 ),
void unregister_ibdev(struct ib_device *ibdev)
Unregister Infiniband device.
struct linda_send_work_queue send_wq[LINDA_NUM_CONTEXTS]
Send work queues.
static int linda_ctx_to_qpn(unsigned int ctx)
Map context number to QPN.
#define LINDA_EPB_LOC_CS(_loc)
#define EINVAL
Invalid argument.
struct option_descriptor read[1]
unsigned long membase
Memory base.
static void linda_destroy_recv_wq(struct linda *linda, struct ib_queue_pair *qp)
Destroy receive work queue.
struct arbelprm_rc_send_wqe rc
unsigned long send_buffer_base
Offset within register space of the first send buffer.
static void linda_i2c_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Write Linda I2C line status.
static void linda_complete_send(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int wqe_idx)
Complete send work queue entry.
#define iob_put(iobuf, len)
#define LINDA_TRIM_DONE_MAX_WAIT_MS
Maximum time to wait for "trim done" signal, in ms.
#define BIT_FILL_6(_ptr, _field1,...)
unsigned int header_cons
Receive header consumer offset.
#define LINDA_EPB_ADDRESS(_channel, _element, _reg)
Linda external parallel bus register addresses.
QLogic Linda Infiniband HCA.
static int linda_ib_epb_read(struct linda *linda, unsigned int location)
Read data via IB external parallel bus.
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
static unsigned int unsigned int reg
Infiniband device operations.
static unsigned int unsigned int bit
#define QIB_7220_RcvHdrTailAddr0_offset
#define LINDA_EPB_ADDRESS_REG(_address)
#define LINDA_SERDES_PARAM_END
End of SerDes parameter list marker.
#define QIB_7220_XGXSCfg_offset
#define QIB_7220_SendBufBase_offset
static int linda_open(struct ib_device *ibdev)
Initialise Infiniband link.
#define QIB_7220_EXTCtrl_offset
static void linda_complete_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned int header_offs)
Complete receive work queue entry.
uint64_t readq(volatile uint64_t *io_addr)
Read 64-bit qword from memory-mapped device.
#define LINDA_EPB_XACT_MAX_WAIT_US
Maximum time for wait for external parallel bus transaction, in us.
#define QIB_7220_RcvHdrEntSize_offset
#define LINDA_LINK_STATE_MAX_WAIT_US
Maximum time to wait for link state changes, in us.
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 linda_writeq(_linda, _ptr, _offset)
uint64_t address
Base address.
static struct ib_device_operations linda_ib_operations
Linda Infiniband operations.
#define linda_readq(_linda, _ptr, _offset)
static int linda_ib_epb_write(struct linda *linda, unsigned int location, unsigned int data)
Write data via IB external parallel bus.
#define QIB_7220_RcvEgrIndexHead0_offset
static void linda_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
static void linda_link_state_changed(struct ib_device *ibdev)
Handle link state change.
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 IB_GUID_ARGS(guid)
Infiniband Globally Unique Identifier debug message arguments.
static struct linda_serdes_param linda_serdes_defaults3[]
static int linda_verify_uc_ram(struct linda *linda)
Verify the microcontroller RAM.
union ib_smp_data smp_data
#define LINDA_EPB_UC_CTL_WRITE
#define QIB_7220_Revision_offset
uint8_t * send_buf
Send buffer usage.
#define IB_LINK_SPEED_SDR
#define ENOENT
No such file or directory.
#define LINDA_EPB_UC_ADDR_HI
struct device * dev
Underlying device.
#define linda_writeq_array64k(_linda, _ptr, _offset, _idx)
static struct linda_serdes_param linda_serdes_defaults2[]
A Linda receive work queue.
unsigned long long uint64_t
#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 void linda_close(struct ib_device *ibdev)
Close Infiniband link.
struct linda_recv_work_queue recv_wq[LINDA_NUM_CONTEXTS]
Receive work queues.
#define LINDA_EAGER_ARRAY_SIZE_17CTX_0
A Linda SerDes parameter.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void ib_link_state_changed(struct ib_device *ibdev)
Notify of Infiniband link state change.
static void linda_writel(struct linda *linda, uint32_t dword, unsigned long offset)
Write Linda dword register.
static void linda_fini_send(struct linda *linda)
Shut down send datapath.
static void linda_fini_recv(struct linda *linda __unused)
Shut down receive datapath.
uint8_t linda_ib_fw[8192]
struct golan_eq_context ctx
struct ib_work_queue recv
Receive queue.
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
#define QIB_7220_ibsd_epb_access_ctrl_offset
static const char * linda_link_state_text(unsigned int link_state)
Textual representation of link state.
unsigned int prod
Producer index.
uint8_t link_speed_enabled
Link speed enabled.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
An Infiniband Global Identifier.
struct device dev
Generic device.
uint8_t link_width_enabled
Link width enabled.
#define LINDA_RECV_HEADERS_SIZE
Total size of an RX header ring.
struct ib_port_info port_info
#define QIB_7220_SendBufAvailAddr_offset
uint8_t link_width_supported
Link width supported.
uint8_t used_ctx[LINDA_NUM_CONTEXTS]
In-use contexts.
#define ECANCELED
Operation canceled.
#define QIB_7220_GPIOOut_offset
struct ib_port_info port_info
unsigned int cons
Consumer index.
Dynamic memory allocation.
#define LINDA_EPB_ALL_CHANNELS
Magic "all channels" channel number.
uint16_t address
EPB address as constructed by LINDA_EPB_ADDRESS()
static int linda_i2c_read_bit(struct bit_basher *basher, unsigned int bit_id)
Read Linda I2C line status.
#define QIB_7220_ErrClear_offset
struct ib_completion_queue * cq
Associated completion queue.
static void linda_free_ctx(struct linda *linda, unsigned int ctx)
Free a context.
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.
uint8_t value
Value to set.
uint8_t send_buf[LINDA_MAX_SEND_BUFS]
Send buffer availability (maintained by software)
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int linda_program_uc_ram(struct linda *linda)
Program the microcontroller RAM.
#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.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
struct i2c_device eeprom
I2C serial EEPROM.
static int linda_link_state_check(struct linda *linda, unsigned int new_link_state)
Wait for link state change to take effect.
#define QIB_7220_RcvHdrCnt_offset
static struct bit_basher_operations linda_i2c_basher_ops
Linda I2C bit-bashing interface operations.
static void linda_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
struct ib_device_operations * op
Infiniband operations.
An Infiniband Work Queue.
static int linda_init_recv(struct linda *linda)
Initialise receive datapath.
struct i2c_interface i2c
I2C interface.
static void linda_mcast_detach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Detach from multicast group.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
uint8_t link_speed_supported__port_state
#define LINDA_RECV_HEADERS_ALIGN
RX header alignment.
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)
#define QIB_7220_RcvHdrHead0_offset
unsigned long qpn
Queue pair number.
static int linda_read_eeprom(struct linda *linda, union ib_guid *guid)
Read EEPROM parameters.
#define BIT_FILL_4(_ptr, _field1,...)
#define BIT_GET(_ptr, _field)
Extract value of named field (for fields up to the size of a long)
uint32_t channel
RNDIS channel.
void * header
Receive header ring.
#define LINDA_SENDBUFAVAIL_ALIGN
DMA alignment for send buffer availability.
#define QIB_7220_Control_offset
#define LINDA_EPB_ADDRESS_CHANNEL(_address)
#define LINDA_GPIO_SCL
Linda I2C SCL line GPIO number.
unsigned int num_wqes
Number of work queue entries.
static void linda_ib_epb_release(struct linda *linda)
Release ownership of the IB external parallel bus.
#define EPROTO
Protocol error.
struct list_head work_queues
List of work queues completing to this queue.
#define BIT_FILL_3(_ptr, _field1,...)
uint32_t revision
Entry point revision.
static void linda_free_send_buf(struct linda *linda, unsigned int send_buf)
Free a send buffer.
#define QIB_7220_EXTStatus_offset
#define QIB_7220_RcvBTHQP_offset
unsigned int eager_entries
Number of entries in eager array.
struct bit_basher basher
Bit-bashing interface.
static int linda_create_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Create queue pair.
int(* read)(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
#define LINDA_DDS_VAL(amp_d, main_d, ipst_d, ipre_d, amp_s, main_s, ipst_s, ipre_s)
#define LINDA_EEPROM_GUID_OFFSET
GUID offset within EEPROM.
static int linda_modify_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Modify queue pair.
unsigned int port
Port number.
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
static int linda_ib_epb_ram_xfer(struct linda *linda, unsigned int address, const void *write, void *read, size_t len)
Transfer data to/from microcontroller RAM.
char * strerror(int errno)
Retrieve string representation of error number.
static int linda_create_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
#define QIB_7220_SendCtrl_offset
static void(* free)(struct refcnt *refcnt))
static int linda_ib_epb_request(struct linda *linda)
Request ownership of the IB external parallel bus.
void * zalloc(size_t size)
Allocate cleared memory.
#define LINDA_QP_IDETH
QPN used for Infinipath Packets.
#define LINDA_EPB_WRITE
Linda external parallel bus read/write operations.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
struct hv_monitor_parameter param[4][32]
Parameters.
#define LINDA_EAGER_ARRAY_SIZE_5CTX_OTHER
#define LINDA_EPB_ADDRESS_ELEMENT(_address)
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.
unsigned int eager_prod
Eager array producer index.
static int linda_qpn_to_ctx(unsigned int qpn)
Map QPN to context number.
static int linda_trim_ib(struct linda *linda)
Use the microcontroller to trim the IB link.
An Infiniband Globally Unique Identifier.
#define LINDA_EEPROM_SERIAL_SIZE
Board serial number size within EEPROM.
uint64_t serial
Serial number.
static int linda_init_i2c(struct linda *linda)
Initialise Linda I2C subsystem.
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.
#define QIB_7220_IntStatus_offset
unsigned int fill
Number of occupied work queue entries.
An Infiniband Completion Queue.
#define QIB_7220_RcvHdrAddr0_offset
#define QIB_7220_RcvCtrl_offset
static void linda_destroy_send_wq(struct linda *linda, struct ib_queue_pair *qp)
Destroy send work queue.
#define LINDA_RECV_HEADER_SIZE
Maximum size of each RX header.
uint8_t link_width_active
Link width active.
static int linda_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.
static int linda_set_serdes_param(struct linda *linda, struct linda_serdes_param *param)
Program IB SerDes register(s)
int register_ibdev(struct ib_device *ibdev)
Register Infiniband device.
A PCI device ID list entry.
struct ib_queue_pair * qp
Containing queue pair.
uint8_t headers[IB_MAX_HEADER_SIZE]
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.
#define linda_writeq_array8b(_linda, _ptr, _offset, _idx)
#define LINDA_RECV_PAYLOAD_SIZE
RX payload size.
static struct xen_remove_from_physmap * remove
#define LINDA_GPIO_SDA
Linda I2C SDA line GPIO number.
#define QIB_7220_IBCDDRCtrl_offset
#define QIB_7220_ErrStatus_offset
struct list_head list
List of work queues on this completion queue.
An Infiniband Queue Pair.
uint32_t xact
Requester transaction ID.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
unsigned int reserved_send_bufs
Number of reserved send buffers (across all QPs)
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 LINDA_EAGER_ARRAY_SIZE_17CTX_OTHER
static struct pci_device_id linda_nics[]
uint8_t mask
Mask to apply to old value.
static void linda_poll_eq(struct ib_device *ibdev)
Poll event queue.
static int linda_post_recv(struct ib_device *ibdev, struct ib_queue_pair *qp, struct io_buffer *iobuf)
Post receive work queue entry.
#define LINDA_EEPROM_SERIAL_OFFSET
Board serial number offset within EEPROM.
static int linda_mcast_attach(struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *gid)
Attach to multicast group.
#define LINDA_SEND_BUF_TOGGLE
Send buffer toggle bit.
static int linda_set_port_info(struct ib_device *ibdev, union ib_mad *mad)
Set port information.
#define LINDA_EAGER_ARRAY_SIZE_5CTX_0
PortCfg values for different numbers of contexts.
#define ENOBUFS
No buffer space available.
int(* probe)(struct pci_device *pci)
Probe device.
uint8_t link_speed_active
Link speed active.
unsigned int send_buf_prod
Send buffer availability producer counter.
#define IB_LINK_SPEED_DDR
unsigned long eager_array
Offset within register space of the eager array.
struct linda_serdes_param __packed
#define BIT_FILL_1(_ptr, _field1,...)
void * data
Start of data.
static unsigned int linda_alloc_send_buf(struct linda *linda)
Allocate a send buffer.
static int linda_init_ib_serdes(struct linda *linda)
Initialise the IB SerDes.
#define EIO
Input/output error.
#define LINDA_NUM_CONTEXTS
Number of contexts (including kernel context)
#define LINDA_MAX_SEND_BUFS
Maximum number of send buffers used.
static unsigned long linda_send_buffer_offset(struct linda *linda, unsigned int send_buf)
Calculate starting offset for send buffer.
static int linda_set_pkey_table(struct ib_device *ibdev __unused, union ib_mad *mad __unused)
Set partition key table.
uint8_t port_state
Port state.
static struct linda_serdes_param linda_serdes_defaults1[]
Linda SerDes default parameters.
static int linda_send_buf_in_use(struct linda *linda, unsigned int send_buf)
Check to see if send buffer is in use.
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.
#define LINDA_EPB_UC_CTL_READ
uint8_t data[48]
Additional event data.
static int linda_create_recv_wq(struct linda *linda, struct ib_queue_pair *qp)
Create receive work queue.
static int linda_set_serdes_params(struct linda *linda, struct linda_serdes_param *params)
Program IB SerDes registers.
#define LINDA_EAGER_BUFFER_ALIGN
Eager buffer required alignment.
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 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 LINDA_EPB_LOC(_cs, _channel, _element, _reg)
Linda external parallel bus locations.
#define QIB_7220_IBCCtrl_offset
#define LINDA_EAGER_ARRAY_SIZE_9CTX_OTHER
struct QIB_7220_SendBufAvail * sendbufavail
Send buffer availability (reported by hardware)
static void linda_poll_recv_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll receive work queue.
static int linda_init_send(struct linda *linda)
Initialise send datapath.
#define QIB_7220_IBCStatus_offset
#define LINDA_EAGER_ARRAY_SIZE_9CTX_0
#define LINDA_SEND_BUF_SIZE
Linda send buffer size.
static void linda_poll_send_wq(struct ib_device *ibdev, struct ib_queue_pair *qp)
Poll send work queue.
static int linda_probe(struct pci_device *pci)
Probe PCI device.
#define LINDA_EPB_UC_DATA
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define QIB_7220_RcvEgrBase_offset
uint8_t bufsize
Size of the packet, in bytes.
static int linda_ib_epb_mod_reg(struct linda *linda, unsigned int cs, unsigned int channel, unsigned int element, unsigned int reg, unsigned int value, unsigned int mask)
Read/modify/write EPB register.
int is_send
"Is a send queue" flag
static unsigned int linda_i2c_bits[]
Linda I2C bit to GPIO mappings.
int init_i2c_bit_basher(struct i2c_bit_basher *i2cbit, struct bit_basher_operations *bash_op)
Initialise I2C bit-bashing interface.
#define LINDA_EPB_UC_ADDR_LO
#define LINDA_EPB_REQUEST_MAX_WAIT_US
Maximum time for wait for external parallel bus request, in us.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
static int linda_create_send_wq(struct linda *linda, struct ib_queue_pair *qp)
Create send work queue.
#define NULL
NULL pointer (VOID *)
static void linda_remove(struct pci_device *pci)
Remove PCI device.
static int linda_ib_epb_wait(struct linda *linda, struct QIB_7220_ibsd_epb_transaction_reg *xact)
Wait for IB external parallel bus transaction to complete.
static int linda_alloc_ctx(struct linda *linda)
Allocate a context.
#define QIB_7220_IBSerDesCtrl_offset
#define LINDA_EPB_CS_SERDES
Linda external parallel bus chip selects.
#define ETIMEDOUT
Connection timed out.
struct i2c_bit_basher i2c
I2C bit-bashing interface.
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.
#define QIB_7220_ibsd_epb_transaction_reg_offset
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.
unsigned int eager_cons
Eager array consumer index.
unsigned int send_buf_cons
Send buffer availability consumer counter.
#define IB_MAX_HEADER_SIZE
Maximum size required for IB headers.
struct pci_driver linda_driver __pci_driver
struct QIB_7220_scalar header_prod
Receive header producer offset (written by hardware)
int(* create_cq)(struct ib_device *ibdev, struct ib_completion_queue *cq)
Create completion queue.
#define LINDA_RECV_HEADER_COUNT
Number of RX headers per context.
#define LINDA_BAR0_SIZE
Linda memory BAR size.
static void linda_poll_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Poll completion queue.
#define LINDA_EPB_UC_CHUNK_SIZE
void * memset(void *dest, int character, size_t len) __nonnull
#define LINDA_EPB_LOC_ADDRESS(_loc)
struct io_buffer ** iobufs
I/O buffers assigned to work queue.