AFHBA404
AFHBA404 connects ACQ2106 to PCI-Express
afhba_sysfs.c
Go to the documentation of this file.
1 /* ------------------------------------------------------------------------- */
2 /* acq400_drv.c D-TACQ ACQ400 FMC DRIVER
3  * afhba_sysfs.c
4  *
5  * Created on: 20 Jan 2015
6  * Author: pgm
7  */
8 
9 /* ------------------------------------------------------------------------- */
10 /* Copyright (C) 2015 Peter Milne, D-TACQ Solutions Ltd *
11  * <peter dot milne at D hyphen TACQ dot com> *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of Version 2 of the GNU General Public License *
15  * as published by the Free Software Foundation; *
16  * *
17  * This program is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  * You should have received a copy of the GNU General Public License *
23  * along with this program; if not, write to the Free Software *
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
25 /* ------------------------------------------------------------------------- */
26 
27 #include "acq-fiber-hba.h"
28 #include "afhba_stream_drv.h"
29 
30 
31 
32 static char* getDataFifoStat(u32 stat, char buf[], int maxbuf)
33 {
34  int cursor = 0;
35 
36 
37  cursor += sprintf(buf+cursor, "%4d ",
39 
40  if ((stat & DMA_DATA_FIFO_EMPTY) != 0){
41  cursor += sprintf(buf+cursor, "EMPTY ");
42  }
43  if ((stat & DMA_DATA_FIFO_FULL) != 0){
44  cursor += sprintf(buf+cursor, "FULL ");
45  }
46  if ((stat & DMA_DATA_FIFO_UNDER) != 0){
47  cursor += sprintf(buf+cursor, "UNDER ");
48  }
49  if ((stat & DMA_DATA_FIFO_OVER) != 0){
50  cursor += sprintf(buf+cursor, "EMPTY ");
51  }
52  strcat(buf, "\n");
53  assert(cursor < maxbuf);
54  return buf;
55 }
56 
57 #define DATA_FIFO_STAT(DIR, SHL) \
58 static ssize_t show_data_fifo_stat_##DIR( \
59  struct device * dev, \
60  struct device_attribute *attr, \
61  char * buf) \
62 { \
63  char flags[80]; \
64  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev); \
65  u32 stat = (DMA_DATA_FIFSTA_RD(adev) >> SHL)&0xffff; \
66  getDataFifoStat(stat, flags, 80); \
67  return sprintf(buf, "0x%04x %s\n", stat, flags); \
68 } \
69  \
70 static DEVICE_ATTR(data_fifo_stat_##DIR, (S_IRUSR|S_IRGRP), show_data_fifo_stat_##DIR, 0)
71 
74 
75 #define DESC_FIFO_STAT(DIR, SHL) \
76 static ssize_t show_desc_fifo_stat_##DIR( \
77  struct device * dev, \
78  struct device_attribute *attr, \
79  char * buf) \
80 { \
81  char flags[80]; \
82  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev); \
83  u32 stat = (DMA_DESC_FIFSTA_RD(adev) >> SHL)&0xffff; \
84  getDataFifoStat(stat, flags, 80); \
85  return sprintf(buf, "0x%04x %s\n", stat, flags); \
86 } \
87  \
88 static DEVICE_ATTR(desc_fifo_stat_##DIR, (S_IRUSR|S_IRGRP), show_desc_fifo_stat_##DIR, 0)
89 
92 
93 static char* getDmaCtrl(u32 stat, char buf[], int maxbuf)
94 {
95  int cursor = 0;
96  buf[0] = '\0';
97 
98  if ((stat & DMA_CTRL_EN) != 0){
99  cursor += sprintf(buf+cursor, "ENABLE ");
100  }
101  if ((stat & DMA_CTRL_FIFO_RST) != 0){
102  cursor += sprintf(buf+cursor, "RESET ");
103  }
104  if ((stat & DMA_CTRL_LOW_LAT) != 0){
105  cursor += sprintf(buf+cursor, "LOWLAT ");
106  }
107  if ((stat & DMA_CTRL_RECYCLE) != 0){
108  cursor += sprintf(buf+cursor, "RECYCLE ");
109  }
110  strcat(buf, "\n");
111  assert(cursor < maxbuf);
112  return buf;
113 }
114 
115 #define DMA_CTRL(DIR, SHL) \
116 static ssize_t show_dma_ctrl_##DIR( \
117  struct device * dev, \
118  struct device_attribute *attr, \
119  char * buf) \
120 { \
121  char flags[80]; \
122  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev); \
123  u32 stat = (DMA_CTRL_RD(adev) >> SHL)&0xffff; \
124  getDmaCtrl(stat, flags, 80); \
125  return sprintf(buf, "0x%04x %s\n", stat, flags); \
126 } \
127  \
128 static DEVICE_ATTR(dma_ctrl_##DIR, (S_IRUSR|S_IRGRP), show_dma_ctrl_##DIR, 0)
129 
132 
133 static char* getDesc(u32 descr, char buf[], int maxbuf)
134 {
135  int cursor = 0;
136 
137  cursor += sprintf(buf+cursor, "pa=%08x ", descr&DMA_DESCR_ADDR);
138 
139  if ((descr & DMA_DESCR_INTEN) != 0){
140  cursor += sprintf(buf+cursor, "INTEN ");
141  }
142  cursor += sprintf(buf+cursor, "lenb=%08x ", DMA_DESCR_LEN_BYTES(descr));
143  cursor += sprintf(buf+cursor, "id=%x\n", descr&DMA_DESCR_ID);
144  assert(cursor < maxbuf);
145  return buf;
146 }
147 
148 #define DMA_LATEST(DIR, RD) \
149 static ssize_t show_dma_latest_##DIR( \
150  struct device * dev, \
151  struct device_attribute *attr, \
152  char * buf) \
153 { \
154  char flags[80]; \
155  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev); \
156  u32 descr = RD(adev); \
157  getDesc(descr, flags, 80); \
158  return sprintf(buf, "0x%08x %s\n", descr, flags); \
159 } \
160  \
161 static DEVICE_ATTR(dma_latest_##DIR##_desc, (S_IRUSR|S_IRGRP), show_dma_latest_##DIR, 0)
162 
165 
166 
167 
168 
169 static ssize_t store_reset_buffers(
170  struct device * dev,
171  struct device_attribute *attr,
172  const char *buf, size_t count)
173 {
174  unsigned mode;
175 
176  if (sscanf(buf, "%u", &mode) > 0){
177  if (mode == 1){
179  }
180  return count;
181  }else{
182  return -EPERM;
183  }
184 }
185 
186 static DEVICE_ATTR(reset_buffers, (S_IWUSR|S_IWGRP), 0, store_reset_buffers);
187 
188 
189 extern int buffer_len;
190 
191 static ssize_t store_buffer_len(
192  struct device * dev,
193  struct device_attribute *attr,
194  const char * buf, size_t count)
195 {
196  int ll_length;
198 
199  if (sscanf(buf, "%d", &ll_length) == 1 && ll_length > 0){
200  sdev->buffer_len = min(ll_length, buffer_len);
201  return strlen(buf);
202 
203  }else{
204  return -1;
205  }
206 }
207 
208 static ssize_t show_buffer_len(
209  struct device * dev,
210  struct device_attribute *attr,
211  char * buf)
212 {
214 
215  sprintf(buf, "%d\n", sdev->buffer_len);
216  return strlen(buf);
217 }
218 
219 static DEVICE_ATTR(buffer_len, (S_IRUSR|S_IRGRP)|(S_IWUSR|S_IWGRP), show_buffer_len, store_buffer_len);
220 
221 
222 char* getFlags(u32 stat, char buf[], int maxbuf)
223 {
224  int cursor = 0;
225 
226  cursor += sprintf(buf+cursor, "%c%s ",
227  (stat & AFHBA_AURORA_STAT_SFP_PRESENTn)? '-': '+',
228  "PRESENT");
229  if ((stat & AFHBA_AURORA_STAT_SFP_LOS) != 0){
230  cursor += sprintf(buf+cursor, "LOS ");
231  }
232  if ((stat & AFHBA_AURORA_STAT_SFP_TX_FAULT) != 0){
233  cursor += sprintf(buf+cursor, "TX_FAULT ");
234  }
235  if ((stat & AFHBA_AURORA_STAT_HARD_ERR) != 0){
236  cursor += sprintf(buf+cursor, "HARD_ERR ");
237  }
238  if ((stat & AFHBA_AURORA_STAT_SOFT_ERR) != 0){
239  cursor += sprintf(buf+cursor, "SOFT_ERR ");
240  }
241  if ((stat & AFHBA_AURORA_STAT_FRAME_ERR) != 0){
242  cursor += sprintf(buf+cursor, "FRAME_ERR ");
243  }
244  if ((stat & AFHBA_AURORA_STAT_CHANNEL_UP) != 0){
245  cursor += sprintf(buf+cursor, "+CHANNEL_UP ");
246  }
247  if ((stat & AFHBA_AURORA_STAT_LANE_UP) != 0){
248  cursor += sprintf(buf+cursor, "+LANE_UP ");
249  }
250  strcat(buf, "\n");
251  assert(cursor < maxbuf);
252  return buf;
253 }
254 
255 static ssize_t store_aurora(
256  struct device * dev,
257  struct device_attribute *attr,
258  const char * buf, size_t count)
259 {
260  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
261  int cr_off = AURORA_CONTROL_REG(adev->sfp);
262  u32 ctrl = simple_strtoul(buf, 0, 16);
263 
264  afhba_write_reg(adev, cr_off, ctrl);
265  return count;
266 }
267 
268 static ssize_t show_aurora(
269  struct device * dev,
270  struct device_attribute *attr,
271  char * buf)
272 {
273  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
274  int sr_off = AURORA_STATUS_REG(adev->sfp);
275  int cr_off = AURORA_CONTROL_REG(adev->sfp);
276  char flags[80];
277 
278  u32 stat = afhba_read_reg(adev, sr_off);
279 
280  if ((stat&AFHBA_AURORA_STAT_ERR) != 0){
281  u32 ctrl = afhba_read_reg(adev, cr_off);
282  afhba_write_reg(adev, cr_off, ctrl|AFHBA_AURORA_CTRL_CLR);
283  afhba_write_reg(adev, cr_off, ctrl);
284  }
285  return sprintf(buf, "0x%08x %s\n", stat, getFlags(stat, flags, 80)); \
286 }
287 
288 
289 static DEVICE_ATTR(aurora, (S_IRUGO)|(S_IWUSR|S_IWGRP), show_aurora, store_aurora);
290 
291 static ssize_t show_aurora_ext(
292  struct device * dev,
293  struct device_attribute *attr,
294  char * buf)
295 {
296  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
297 
298  return sprintf(buf, "0x%08x\n", read_astatus2(adev));
299 }
300 static DEVICE_ATTR(aurora_ext, (S_IRUGO), show_aurora_ext, 0);
301 
302 static ssize_t store_comms_init(
303  struct device * dev,
304  struct device_attribute *attr,
305  const char * buf, size_t count)
306 {
307  int init;
308  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
309  struct AFHBA_STREAM_DEV *sdev = adev->stream_dev;
310 
311  if (sscanf(buf, "%d", &init) == 1 && init==1){
312  sdev->comms_init_done = false;
313  afs_comms_init(adev);
314  return strlen(buf);
315  }else{
316  return -1;
317  }
318 }
319 
320 static ssize_t show_comms_init(
321  struct device * dev,
322  struct device_attribute *attr,
323  char * buf)
324 {
326 
327  return sprintf(buf, "%d\n", sdev->comms_init_done);
328 }
329 
330 static DEVICE_ATTR(comms_init, (S_IRUGO)|(S_IWUSR|S_IWGRP), show_comms_init, store_comms_init);
331 
332 
333 static ssize_t show_inflight(
334  struct device * dev,
335  struct device_attribute *attr,
336  char * buf)
337 {
339  struct JOB *job = &sdev->job;
340 
341  return sprintf(buf, "%d\n", job->buffers_queued-job->buffers_received);
342 }
343 
344 static DEVICE_ATTR(inflight, (S_IRUGO), show_inflight, 0);
345 
346 static ssize_t show_shot(
347  struct device * dev,
348  struct device_attribute *attr,
349  char * buf)
350 {
352  return sprintf(buf, "%d\n", sdev->shot);
353 }
354 
355 static DEVICE_ATTR(shot, (S_IRUGO), show_shot, 0);
356 
357 #define _ERRLAT(yymask) ((yymask) == 0x0ffff || (yymask) == 0)
358 #define ERRLAT(yy) (_ERRLAT((yy)&0x0ffff))
359 
360 static ssize_t show_latstat(
361  struct device * dev,
362  struct device_attribute *attr,
363  char * buf)
364 {
365  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
366  unsigned ls1 = afhba_read_reg(adev, HOST_PCIE_LATSTATS_1);
367  unsigned ls2 = afhba_read_reg(adev, HOST_PCIE_LATSTATS_2);
368  int maxtry = 1;
369 
370  unsigned over5 = ls1 & 0x0ffff;
371  while (over5 && (ERRLAT(ls2>>16) || ERRLAT(ls2))){
372  yield();
374  if (++maxtry > 100){
375  dev_warn(dev, "show_latstat maxtry exceeded");
376  break;
377  }
378  }
379  return sprintf(buf, "%5d %5d %5d %5d\n",
380  ls1>>16, ls1&0x0ffff, ls2>>16, ls2&0x0ffff);
381 }
382 
383 static DEVICE_ATTR(latstat, (S_IRUSR|S_IRGRP), show_latstat, 0);
384 
385 static ssize_t show_fpga_rev(
386  struct device * dev,
387  struct device_attribute *attr,
388  char * buf)
389 {
390  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
391  return sprintf(buf, "0x%08x\n", afhba_read_reg(adev, FPGA_REVISION_REG));
392 }
393 
394 static DEVICE_ATTR(fpga_rev, (S_IRUGO), show_fpga_rev, 0);
395 
396 
397 static ssize_t store_dma_test(
398  struct device * dev,
399  struct device_attribute *attr,
400  const char * buf, size_t count)
401 {
402  unsigned test;
403  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
404 
405  if (sscanf(buf, "0x%x", &test) == 1 || sscanf(buf, "%d", &test) == 1){
406  DMA_TEST_WR(adev, test);
407  return strlen(buf);
408  }else{
409  return -1;
410  }
411 }
412 
413 static ssize_t show_dma_test(
414  struct device * dev,
415  struct device_attribute *attr,
416  char * buf)
417 {
418  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
419 
420  sprintf(buf, "0x%08x\n", DMA_TEST_RD(adev));
421  return strlen(buf);
422 }
423 
424 static DEVICE_ATTR(dma_test, (S_IRUGO)|(S_IWUSR|S_IWGRP), show_dma_test, store_dma_test);
425 
426 
427 static ssize_t show_heartbeat(
428  struct device * dev,
429  struct device_attribute *attr,
430  char * buf)
431 {
432  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
433  return sprintf(buf, "0x%08x\n", afhba_read_reg(adev, HOST_COUNTER_REG));
434 }
435 
436 static DEVICE_ATTR(heartbeat, (S_IRUGO), show_heartbeat, 0);
437 
438 
439 static ssize_t store_push_dma_timeouts(
440  struct device * dev,
441  struct device_attribute *attr,
442  const char * buf, size_t count)
443 {
445  int clear;
446 
447  if (sscanf(buf, "%d", &clear) == 1 && clear == 1){
448  sdev->push_dma_timeouts = 0;
449  return strlen(buf);
450 
451  }else{
452  return -1;
453  }
454 }
455 
456 static ssize_t show_push_dma_timeouts(
457  struct device * dev,
458  struct device_attribute *attr,
459  char * buf)
460 {
462 
463  sprintf(buf, "%d\n", sdev->push_dma_timeouts);
464  return strlen(buf);
465 }
466 
467 static DEVICE_ATTR(push_dma_timeouts, (S_IRUGO)|(S_IWUSR|S_IWGRP), show_push_dma_timeouts, store_push_dma_timeouts);
468 
469 static ssize_t store_pull_dma_timeouts(
470  struct device * dev,
471  struct device_attribute *attr,
472  const char * buf, size_t count)
473 {
475  int clear;
476 
477  if (sscanf(buf, "%d", &clear) == 1 && clear == 1){
478  sdev->pull_dma_timeouts = 0;
479  return strlen(buf);
480 
481  }else{
482  return -1;
483  }
484 }
485 
486 static ssize_t show_pull_dma_timeouts(
487  struct device * dev,
488  struct device_attribute *attr,
489  char * buf)
490 {
492 
493  sprintf(buf, "%d\n", sdev->pull_dma_timeouts);
494  return strlen(buf);
495 }
496 
497 static DEVICE_ATTR(pull_dma_timeouts, (S_IRUGO)|(S_IWUSR|S_IWGRP), show_pull_dma_timeouts, store_pull_dma_timeouts);
498 
499 static ssize_t store_host_test(
500  struct device * dev,
501  struct device_attribute *attr,
502  const char * buf, size_t count)
503 {
504  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
505  unsigned tv;
506 
507  if (sscanf(buf, "%x", &tv) == 1){
508  afhba_write_reg(adev, HOST_TEST_REG, tv);
509  return strlen(buf);
510  }else{
511  return -1;
512  }
513 }
514 
515 static ssize_t show_host_test(
516  struct device * dev,
517  struct device_attribute *attr,
518  char * buf)
519 {
520  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
521 
522  sprintf(buf, "%08x\n", afhba_read_reg(adev, HOST_TEST_REG));
523  return strlen(buf);
524 }
525 
526 static DEVICE_ATTR(host_test, (S_IRUGO)|(S_IWUSR|S_IWGRP), show_host_test, store_host_test);
527 
528 static ssize_t show_host_temp(
529  struct device * dev,
530  struct device_attribute *attr,
531  char * buf)
532 {
533  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
534  unsigned reg = afhba_read_reg(adev, HOST_MON_REG);
535  int TC100 = (reg>>HOST_MON_TEMP_SHL)*50398/4096 - 27315;
536 
537  sprintf(buf, "%08x T:%d.%02d C %s %s %s\n",
538  reg, TC100/100, TC100%100,
539  (reg&HOST_MON_USR_TEMP)? "USR_TEMP ALARM":"",
540  (reg&HOST_MON_OVER_TEMP)? "OVER TEMP ALARM": "",
541  (reg&HOST_MON_VOLT_ALARM)? "VOLTAGE ALARM": "");
542  return strlen(buf);
543 }
544 static DEVICE_ATTR(host_temp, (S_IRUGO), show_host_temp, 0);
545 
546 static ssize_t show_streamer_pid(
547  struct device * dev,
548  struct device_attribute *attr,
549  char * buf)
550 {
551  struct AFHBA_STREAM_DEV *sdev =
553 
554  sprintf(buf, "%d\n", sdev->pid);
555  return strlen(buf);
556 }
557 static DEVICE_ATTR(streamer_pid, (S_IRUGO), show_streamer_pid, 0 );
558 
559 
560 static const struct attribute *dev_attrs[] = {
561  &dev_attr_buffer_len.attr,
562  &dev_attr_dma_test.attr,
563  &dev_attr_inflight.attr,
564  &dev_attr_reset_buffers.attr,
565  &dev_attr_aurora.attr,
566  &dev_attr_aurora_ext.attr,
567  &dev_attr_data_fifo_stat_push.attr,
568  &dev_attr_data_fifo_stat_pull.attr,
569  &dev_attr_desc_fifo_stat_push.attr,
570  &dev_attr_desc_fifo_stat_pull.attr,
571  &dev_attr_dma_ctrl_push.attr,
572  &dev_attr_dma_ctrl_pull.attr,
573  &dev_attr_dma_latest_push_desc.attr,
574  &dev_attr_dma_latest_pull_desc.attr,
575  &dev_attr_comms_init.attr,
576  &dev_attr_shot.attr,
577  &dev_attr_latstat.attr,
578  &dev_attr_fpga_rev.attr,
579  &dev_attr_heartbeat.attr,
580  &dev_attr_host_test.attr,
581  &dev_attr_host_temp.attr,
582  &dev_attr_streamer_pid.attr,
583  &dev_attr_pull_dma_timeouts.attr,
584  &dev_attr_push_dma_timeouts.attr,
585  NULL
586 };
587 
588 
589 
590 void afhba_create_sysfs(struct AFHBA_DEV *adev)
591 {
592  int rc;
593  rc = sysfs_create_files(&adev->class_dev->kobj, dev_attrs);
594  if (rc){
595  dev_err(pdev(adev), "failed to create files");
596  return;
597  }
598 }
599 
600 void afhba_remove_sysfs(struct AFHBA_DEV *adev)
601 {
602  sysfs_remove_files(&adev->class_dev->kobj, dev_attrs);
603 }
604 
605 static ssize_t show_dev(
606  struct device * dev,
607  struct device_attribute *attr,
608  char * buf)
609 {
610  struct AFHBA_DEV *adev = afhba_lookupDeviceFromClass(dev);
611  if (adev){
612  return sprintf(buf, "%d:0\n", adev->major);
613  }else{
614  return -ENODEV;
615  }
616 }
617 static DEVICE_ATTR(dev, (S_IRUSR|S_IRGRP), show_dev, 0);
618 
619 static const struct attribute *class_attrs[] = {
620  &dev_attr_dev.attr,
621  NULL
622 };
623 
625 {
626  int rc;
627  dev_dbg(pdev(adev), "01");
628 
629  rc = sysfs_create_files(&adev->class_dev->kobj, class_attrs);
630  if (rc){
631  dev_err(pdev(adev), "failed to create files");
632  return;
633  }
634  rc = sysfs_create_link(
635  &adev->class_dev->kobj, &adev->pci_dev->dev.kobj, "device");
636  if (rc) {
637  dev_err(pdev(adev), "failed to create symlink %s\n", "device");
638  }
639  dev_dbg(pdev(adev), "9");
640 }
641 
643 {
644  sysfs_remove_files(&adev->pci_dev->dev.kobj, class_attrs);
645 }
AFHBA_DEV::sfp
enum AFHBA_DEV::SFP sfp
DMA_DATA_FIFO_FULL
#define DMA_DATA_FIFO_FULL
Definition: acq-fiber-hba.h:350
AFHBA_STREAM_DEV::push_dma_timeouts
int push_dma_timeouts
Definition: afhba_stream_drv.h:113
HOST_MON_USR_TEMP
#define HOST_MON_USR_TEMP
Definition: acq-fiber-hba.h:265
afhba_lookupDeviceFromClass
struct AFHBA_DEV * afhba_lookupDeviceFromClass(struct device *dev)
Definition: afhba_devman.c:52
DATA_FIFO_STAT
#define DATA_FIFO_STAT(DIR, SHL)
Definition: afhba_sysfs.c:57
HOST_PCIE_LATSTATS_1
#define HOST_PCIE_LATSTATS_1
Definition: acq-fiber-hba.h:201
DESC_FIFO_STAT
#define DESC_FIFO_STAT(DIR, SHL)
Definition: afhba_sysfs.c:75
AFHBA_AURORA_STAT_CHANNEL_UP
#define AFHBA_AURORA_STAT_CHANNEL_UP
Definition: acq-fiber-hba.h:255
AURORA_CONTROL_REG
#define AURORA_CONTROL_REG(sfp)
Definition: acq-fiber-hba.h:214
afhba_remove_sysfs
void afhba_remove_sysfs(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:600
pdev
#define pdev(adev)
Definition: acq-fiber-hba.h:176
FPGA_REVISION_REG
#define FPGA_REVISION_REG
Definition: acq-fiber-hba.h:189
afhba_read_reg
u32 afhba_read_reg(struct AFHBA_DEV *adev, int regoff)
Definition: afhba_core.c:48
DMA_DATA_FIFO_COUNT
#define DMA_DATA_FIFO_COUNT
Definition: acq-fiber-hba.h:353
AFHBA_DEV::major
int major
Definition: acq-fiber-hba.h:118
AFHBA_AURORA_STAT_SOFT_ERR
#define AFHBA_AURORA_STAT_SOFT_ERR
Definition: acq-fiber-hba.h:253
AFHBA_STREAM_DEV::shot
int shot
Definition: afhba_stream_drv.h:150
ERRLAT
#define ERRLAT(yy)
Definition: afhba_sysfs.c:358
DMA_DESCR_ADDR
#define DMA_DESCR_ADDR
Definition: acq-fiber-hba.h:344
afhba_remove_sysfs_class
void afhba_remove_sysfs_class(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:642
AFHBA_AURORA_STAT_LANE_UP
#define AFHBA_AURORA_STAT_LANE_UP
Definition: acq-fiber-hba.h:256
AURORA_STATUS_REG
#define AURORA_STATUS_REG(sfp)
Definition: acq-fiber-hba.h:215
DMA_CTRL_PULL_SHL
#define DMA_CTRL_PULL_SHL
Definition: acq-fiber-hba.h:335
DMA_DESCR_INTEN
#define DMA_DESCR_INTEN
Definition: acq-fiber-hba.h:345
afhba_create_sysfs
void afhba_create_sysfs(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:590
AFHBA_STREAM_DEV::pull_dma_timeouts
int pull_dma_timeouts
Definition: afhba_stream_drv.h:114
AFHBA_AURORA_STAT_SFP_PRESENTn
#define AFHBA_AURORA_STAT_SFP_PRESENTn
Definition: acq-fiber-hba.h:249
DMA_CTRL_EN
#define DMA_CTRL_EN
Definition: acq-fiber-hba.h:338
HOST_MON_REG
#define HOST_MON_REG
Definition: acq-fiber-hba.h:206
DMA_DATA_FIFO_UNDER
#define DMA_DATA_FIFO_UNDER
Definition: acq-fiber-hba.h:351
DMA_CTRL_PUSH_SHL
#define DMA_CTRL_PUSH_SHL
Definition: acq-fiber-hba.h:336
DMA_DATA_FIFO_OVER
#define DMA_DATA_FIFO_OVER
Definition: acq-fiber-hba.h:352
DMA_DATA_FIFO_COUNT_SHL
#define DMA_DATA_FIFO_COUNT_SHL
Definition: acq-fiber-hba.h:354
DMA_PULL_DESC_STA_RD
#define DMA_PULL_DESC_STA_RD(adev)
Definition: afhba_stream_drv.h:241
AFHBA_AURORA_STAT_HARD_ERR
#define AFHBA_AURORA_STAT_HARD_ERR
Definition: acq-fiber-hba.h:252
AFHBA_DEV::stream_dev
struct AFHBA_STREAM_DEV * stream_dev
Definition: acq-fiber-hba.h:143
AFHBA_AURORA_STAT_SFP_LOS
#define AFHBA_AURORA_STAT_SFP_LOS
Definition: acq-fiber-hba.h:250
DMA_LATEST
#define DMA_LATEST(DIR, RD)
Definition: afhba_sysfs.c:148
afhba_create_sysfs_class
void afhba_create_sysfs_class(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:624
HOST_PCIE_LATSTATS_2
#define HOST_PCIE_LATSTATS_2
Definition: acq-fiber-hba.h:202
DMA_PUSH_DESC_STA_RD
#define DMA_PUSH_DESC_STA_RD(adev)
Definition: afhba_stream_drv.h:240
DMA_DATA_FIFO_EMPTY
#define DMA_DATA_FIFO_EMPTY
Definition: acq-fiber-hba.h:349
afhba_stream_drv.h
HOST_MON_OVER_TEMP
#define HOST_MON_OVER_TEMP
Definition: acq-fiber-hba.h:266
AFHBA_DEV::class_dev
struct device * class_dev
Definition: acq-fiber-hba.h:116
AFHBA_AURORA_CTRL_CLR
#define AFHBA_AURORA_CTRL_CLR
Definition: acq-fiber-hba.h:245
DMA_TEST_RD
#define DMA_TEST_RD(adev)
Definition: afhba_stream_drv.h:211
HOST_COUNTER_REG
#define HOST_COUNTER_REG
Definition: acq-fiber-hba.h:198
DMA_CTRL
#define DMA_CTRL(DIR, SHL)
Definition: afhba_sysfs.c:115
AFHBA_DEV
Definition: acq-fiber-hba.h:111
DMA_DESCR_LEN_BYTES
#define DMA_DESCR_LEN_BYTES(descr)
Definition: acq-fiber-hba.h:356
AFHBA_STREAM_DEV::job
struct AFHBA_STREAM_DEV::JOB job
HOST_TEST_REG
#define HOST_TEST_REG
Definition: acq-fiber-hba.h:197
getFlags
char * getFlags(u32 stat, char buf[], int maxbuf)
Definition: afhba_sysfs.c:222
DMA_CTRL_FIFO_RST
#define DMA_CTRL_FIFO_RST
Definition: acq-fiber-hba.h:339
DMA_DESCR_ID
#define DMA_DESCR_ID
Definition: acq-fiber-hba.h:347
AFHBA_STREAM_DEV::buffer_len
int buffer_len
Definition: afhba_stream_drv.h:83
AFHBA_AURORA_STAT_SFP_TX_FAULT
#define AFHBA_AURORA_STAT_SFP_TX_FAULT
Definition: acq-fiber-hba.h:251
AFHBA_STREAM_DEV::comms_init_done
int comms_init_done
Definition: afhba_stream_drv.h:141
DMA_CTRL_LOW_LAT
#define DMA_CTRL_LOW_LAT
Definition: acq-fiber-hba.h:340
afhba_write_reg
void afhba_write_reg(struct AFHBA_DEV *adev, int regoff, u32 value)
Definition: afhba_core.c:40
AFHBA_STREAM_DEV
Definition: afhba_stream_drv.h:66
assert
#define assert(p)
Definition: acq-fiber-hba.h:55
AFHBA_AURORA_STAT_ERR
#define AFHBA_AURORA_STAT_ERR
Definition: acq-fiber-hba.h:258
afs_reset_buffers
int afs_reset_buffers(struct AFHBA_DEV *adev)
Definition: afhba_stream_drv.c:1390
AFHBA_STREAM_DEV::pid
unsigned pid
Definition: afhba_stream_drv.h:132
AFHBA_AURORA_STAT_FRAME_ERR
#define AFHBA_AURORA_STAT_FRAME_ERR
Definition: acq-fiber-hba.h:254
HOST_MON_VOLT_ALARM
#define HOST_MON_VOLT_ALARM
Definition: acq-fiber-hba.h:267
DMA_TEST_WR
#define DMA_TEST_WR(adev, value)
Definition: afhba_stream_drv.h:208
HOST_MON_TEMP_SHL
#define HOST_MON_TEMP_SHL
Definition: acq-fiber-hba.h:264
DMA_CTRL_RECYCLE
#define DMA_CTRL_RECYCLE
Definition: acq-fiber-hba.h:341
acq-fiber-hba.h
afs_comms_init
int afs_comms_init(struct AFHBA_DEV *adev)
Definition: afhba_stream_drv.c:749
u32
unsigned u32
Definition: local.h:60
AFHBA_DEV::pci_dev
struct pci_dev * pci_dev
Definition: acq-fiber-hba.h:115
buffer_len
int buffer_len
Definition: afhba_stream_drv.c:77