AFHBA404
AFHBA404 connects ACQ2106 to PCI-Express
acq-fiber-hba.c
Go to the documentation of this file.
1 /* ------------------------------------------------------------------------- *
2  * acq-fiber-hba.c
3  * ------------------------------------------------------------------------- *
4  * Copyright (C) 2014 Peter Milne, D-TACQ Solutions Ltd
5  * <peter dot milne at D hyphen TACQ dot com>
6  * www.d-tacq.com
7  * Created on: 10 Aug 2014
8  * Author: pgm
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of Version 2 of the GNU General Public License *
12  * as published by the Free Software Foundation; *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the Free Software *
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 /* ------------------------------------------------------------------------- */
23 
24 
25 
26 
27 #include "acq-fiber-hba.h"
28 
29 
30 char afhba_driver_name[] = "afhba";
31 char afhba__driver_string[] = "D-TACQ ACQ-FIBER-HBA Driver for ACQ400";
32 char afhba__driver_version[] = "B1113";
33 char afhba__copyright[] = "Copyright (c) 2010/2014 D-TACQ Solutions Ltd";
34 
35 
36 struct class* afhba_device_class;
37 
39 
40 
41 const char* afhba_devnames[MAXDEV];
42 
43 
44 #ifndef EXPORT_SYMTAB
45 #define EXPORT_SYMTAB
46 #include <linux/module.h>
47 #endif
48 
49 int afhba_debug = 0;
51 
52 /* deprecated: only retained for load script compatibility */
53 int ll_mode_only = 1;
55 
56 
57 #include "d-tacq_pci_id.h"
58 
59 int afhba4_stream = 0;
61 
62 int afhba_nports = 4;
64 
67 
68 extern int buffer_len;
69 
70 static int MAP2BAR(struct AFHBA_DEV *adev, int imap)
71 {
72  return imap;
73 }
74 
75 static int minor2bar(struct AFHBA_DEV *adev, int iminor)
76 {
77  switch(iminor){
78  default:
79  dev_err(pdev(adev), "bad call minor2bar %d", iminor); /* fallthru */
80  case MINOR_REGREAD:
81  return REGS_BAR;
82  case MINOR_REMOTE:
83  return REMOTE_BAR;
84  }
85 
86 }
87 #define VALID_BAR(bar) ((bar) != NO_BAR)
88 
89 
90 ssize_t bar_read(
91  struct file *file, char *buf, size_t count, loff_t *f_pos, int BAR)
92 {
93  struct AFHBA_DEV *adev = PD(file)->dev;
94  int ii;
95  int rc;
96  void *va = adev->mappings[BAR].va;
97  int len = adev->mappings[BAR].len;
98 
99  dev_dbg(pdev(adev), "01 adev %p va %p name %s", adev, va, adev->name);
100 
101  if (count > len){
102  count = len;
103  }
104  if (*f_pos >= len){
105  return 0;
106  }else{
107  va += *f_pos;
108  }
109 
110  for (ii = 0; ii < count/sizeof(u32); ++ii){
111  u32 reg = readl(va + ii*sizeof(u32));
112  rc = copy_to_user(buf+ii*sizeof(u32), &reg, sizeof(u32));
113  if (rc){
114  return -1;
115  }
116  }
117  *f_pos += count;
118  return count;
119 }
120 
121 
122 
123 
124 ssize_t bar_write(
125  struct file *file, const char *buf, size_t count, loff_t *f_pos,
126  int BAR, int OFFSET)
127 {
128  struct AFHBA_DEV *adev = PD(file)->dev;
129  int LEN = adev->mappings[BAR].len;
130  u32 data;
131  void *va = adev->mappings[BAR].va + OFFSET;
132  int rc = copy_from_user(&data, buf, min(count, sizeof(u32)));
133 
134  int ii;
135  if (rc){
136  return -1;
137  }
138  if (*f_pos > LEN){
139  return -1;
140  }else if (count + *f_pos > LEN){
141  count = LEN - *f_pos;
142  }
143 
144  for (ii = 0; ii < count; ii += sizeof(u32)){
145  u32 readval = readl(va+ii);
146  dev_dbg(pdev(adev), "writing %p = 0x%08x was 0x%08x",
147  va+ii, data+ii, readval);
148 
149  writel(data+ii, va+ii);
150  }
151 
152  *f_pos += count;
153  return count;
154 }
155 
156 int afhba_open(struct inode *inode, struct file *file)
157 {
158  struct AFHBA_DEV *adev = afhba_lookupDevice(MAJOR(inode->i_rdev));
159 
160  dev_dbg(pdev(adev), "01");
161  if (adev == 0){
162  return -ENODEV;
163  }else{
164  file->private_data = kmalloc(PSZ, GFP_KERNEL);
165  PD(file)->dev = adev;
166  PD(file)->minor = MINOR(inode->i_rdev);
167  INIT_LIST_HEAD(&PD(file)->my_buffers);
168 
169  dev_dbg(pdev(adev), "33: minor %d", PD(file)->minor);
170 
171  switch((PD(file)->minor)){
172  case MINOR_REGREAD:
173  case MINOR_REMOTE:
174  return 0;
175  default:
176  if (adev->stream_fops != 0){
177  file->f_op = adev->stream_fops;
178  return file->f_op->open(inode, file);
179  }else{
180  dev_err(pdev(adev),"99 adev %p name %s", adev, adev->name);
181  return -ENODEV;
182  }
183  }
184  }
185 }
186 ssize_t afhba_read(struct file *file, char __user *buf, size_t count, loff_t *f_pos)
187 {
188  struct AFHBA_DEV *adev = DEV(file);
189  return bar_read(file, buf, count, f_pos, minor2bar(adev, PD(file)->minor));
190 }
191 
192 ssize_t afhba_write(
193  struct file *file, const char *buf, size_t count, loff_t *f_pos)
194 {
195  return bar_write(file, buf, count, f_pos, REGS_BAR, 0);
196 }
197 int afhba_mmap_bar(struct file* file, struct vm_area_struct* vma)
198 {
199  struct AFHBA_DEV *adev = PD(file)->dev;
200  int bar = minor2bar(adev, PD(file)->minor);
201  unsigned long vsize = vma->vm_end - vma->vm_start;
202  unsigned long psize = adev->mappings[bar].len;
203  unsigned pfn = adev->mappings[bar].pa >> PAGE_SHIFT;
204 
205  dev_dbg(pdev(adev), "%c vsize %lu psize %lu %s",
206  'D', vsize, psize, vsize>psize? "EINVAL": "OK");
207 
208  if (vsize > psize){
209  return -EINVAL; /* request too big */
210  }
211  if (io_remap_pfn_range(
212  vma, vma->vm_start, pfn, vsize, vma->vm_page_prot)){
213  return -EAGAIN;
214  }else{
215  return 0;
216  }
217 }
218 
219 int afhba_mmap_hb(struct file* file, struct vm_area_struct* vma)
220 {
221  struct AFHBA_DEV *adev = PD(file)->dev;
222  struct HostBuffer* hb = adev->hb1;
223  unsigned long vsize = vma->vm_end - vma->vm_start;
224  unsigned long psize = buffer_len;
225  unsigned pfn = hb->pa >> PAGE_SHIFT;
226 
227  dev_dbg(pdev(adev), "%c vsize %lu psize %lu %s",
228  'D', vsize, psize, vsize>psize? "EINVAL": "OK");
229 
230  if (vsize > psize){
231  return -EINVAL; /* request too big */
232  }
233  if (io_remap_pfn_range(
234  vma, vma->vm_start, pfn, vsize, vma->vm_page_prot)){
235  return -EAGAIN;
236  }else{
237  return 0;
238  }
239 }
240 
241 int afhba_release(struct inode *inode, struct file *file)
242 {
243  struct AFHBA_DEV *adev = PD(file)->dev;
244  dev_dbg(pdev(adev), "01");
245  kfree(file->private_data);
246  return 0;
247 }
248 
249 void afhba_map(struct AFHBA_DEV *adev)
250 {
251  struct pci_dev *dev = adev->pci_dev;
252  int imap;
253  int nmappings = 0;
254 
255  for (imap = 0; nmappings < adev->map_count; ++imap){
256  struct PciMapping* mp = adev->mappings+imap;
257  int bar = MAP2BAR(adev, imap);
258 
259  dev_dbg(pdev(adev), "[%d] ", imap);
260  if (VALID_BAR(bar)){
261  if (adev->peer != 0 && adev->peer->mappings[imap].va != 0){
262  adev->mappings[imap] = adev->peer->mappings[imap];
263  }else{
264  snprintf(mp->name, SZM1(mp->name), "afhba.%d.%d", adev->idx, bar);
265 
266  mp->pa = pci_resource_start(dev,bar)&
267  PCI_BASE_ADDRESS_MEM_MASK;
268  mp->len = pci_resource_len(dev, bar);
269  mp->region = request_mem_region(
270  mp->pa, mp->len, mp->name);
271  mp->va = ioremap(mp->pa, mp->len);
272 
273  dev_dbg(pdev(adev), "BAR %d va:%p", bar, mp->va);
274  }
275  ++nmappings;
276  }
277  }
278 
279  dev_dbg(pdev(adev), "99 nmappings %d", nmappings);
280 }
281 
282 
283 
284 static int getOrder(int len)
285 {
286  int order;
287  len /= PAGE_SIZE;
288 
289  for (order = 0; 1 << order < len; ++order){
290  ;
291  }
292  return order;
293 }
294 
295 
296 static void init_buffers(struct AFHBA_DEV* adev)
297 {
298  int order = getOrder(buffer_len);
299  int ii = 0;
300  struct HostBuffer* hb = adev->hb1 = kmalloc(sizeof(struct HostBuffer)*1, GFP_KERNEL);
301  void *buf = (void*)__get_free_pages(GFP_KERNEL|GFP_DMA32, order);
302 
303  if (!buf){
304  dev_err(pdev(adev), "failed to allocate buffer %d", ii);
305  return;
306  }
307 
308  dev_dbg(pdev(adev), "buffer %2d allocated at %p, map it", ii, buf);
309 
310  hb->ibuf = 0;
311  hb->pa = dma_map_single(&adev->pci_dev->dev, buf,
312  buffer_len, PCI_DMA_FROMDEVICE);
313  hb->va = buf;
314  hb->len = buffer_len;
315 
316  dev_dbg(pdev(adev), "buffer %2d allocated, map done", ii);
317 
318  hb->bstate = BS_EMPTY;
319 
320  dev_info(pdev(adev), "hb1 [%d] %p %08x %d %08x", ii,
321  adev->hb1->va, adev->hb1->pa,
322  adev->hb1->len, adev->hb1->descr);
323 }
324 
325 
326 struct AFHBA_DEV *adevCreate(struct pci_dev *dev)
327 {
328  static int idx;
329  struct AFHBA_DEV *adev = kzalloc(sizeof(struct AFHBA_DEV), GFP_KERNEL);
330 
331  static u64 dma_mask = DMA_BIT_MASK(32);
332 
333  adev->pci_dev = dev;
334  adev->idx = idx++;
335  dev->dev.dma_mask = &dma_mask;
336  adev->remote_com_bar = NO_BAR;
337 
338  return adev;
339 }
340 
341 void adevDelete(struct AFHBA_DEV* adev)
342 {
343  kfree(adev);
344 }
345 
346 #include <linux/pci_regs.h>
347 
348 #define AFHBA_PCI_CMD (PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY)
349 
350 void force_busmaster_mode(struct AFHBA_DEV* adev)
351 {
352  u16 cmd;
353 
354  /* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */
355  pci_read_config_word( adev->pci_dev, PCI_COMMAND, &cmd);
356  if ((cmd & AFHBA_PCI_CMD) != AFHBA_PCI_CMD) {
357  u16 new_cmd = cmd | AFHBA_PCI_CMD;
358  pci_write_config_word( adev->pci_dev, PCI_COMMAND, new_cmd);
359  dev_info(pdev(adev), "ENABLE BUS MASTER transactions %04x to %04x",
360  cmd, new_cmd);
361  }
362 }
363 
364 int _afhba_probe(struct AFHBA_DEV* adev, int remote_bar,
365  int (*stream_drv_init)(struct AFHBA_DEV* adev))
366 {
367  static struct file_operations afhba_fops = {
368  .open = afhba_open,
369  .release = afhba_release,
370  .read = afhba_read,
371  .write = afhba_write,
372  //.mmap = afhba_mmap_bar
373  .mmap = afhba_mmap_hb
374  };
375 
376  int rc;
377 
378  snprintf(adev->name, SZM1(adev->name), "afhba.%d", adev->idx);
379  afhba_devnames[adev->idx] = adev->name;
380  snprintf(adev->mon_name, SZM1(adev->name), "afhba-mon.%d", adev->idx);
381 
382 
383  rc = register_chrdev(0, adev->name, &afhba_fops);
384  if (rc < 0){
385  dev_err(pdev(adev), "can't get major");
386  kfree(adev);
387  return rc;
388  }else{
389  adev->major = rc;
390  }
391 
392  afhba_map(adev);
393  adev->remote = adev->mappings[remote_bar].va;
394  init_buffers(adev);
395  afhba_registerDevice(adev);
396  afhba_createDebugfs(adev);
397 
398  rc = pci_enable_device(adev->pci_dev);
399  if (rc != 0){
400  dev_warn(pdev(adev), "pci_enabled_device returned %d", rc);
401  }
402  force_busmaster_mode(adev);
403 
404  dev_dbg(pdev(adev), "pci_enable_device returns %d", rc);
405  dev_info(pdev(adev), "FPGA revision: %08x",
407 
408  adev->class_dev = device_create(
409  afhba_device_class, /* cls */
410  NULL, /* cls_parent */
411  adev->idx, /* "devt" */
412  &adev->pci_dev->dev, /* device */
413  adev->name);
415 
416  dev_dbg(pdev(adev), "calling afhba_create_sysfs()");
417  afhba_create_sysfs(adev);
418 
419  dev_dbg(pdev(adev), "calling stream_drv_init()");
420  stream_drv_init(adev);
421 
422  dev_dbg(pdev(adev), "99 rc %d", rc);
423  return rc;
424 }
425 
427 {
428  dev_warn(pdev(adev), "null_stream_drv_init STUB");
429  return 0;
430 }
431 #define STREAM afhba_stream_drv_init
432 #define NOSTREAM null_stream_drv_init
433 
434 int afhba2_probe(struct AFHBA_DEV *adev)
435 {
436  int rc;
437  dev_info(pdev(adev), "AFHBA 4G 2-port firmware detected");
438  adev->map_count = MAP_COUNT_4G2;
439  adev->remote_com_bar = MAP_COUNT_4G2 -1;
440  adev->sfp = SFP_A;
441 
442  if ((rc = _afhba_probe(adev, REMOTE_BAR, STREAM)) != 0){
443  dev_err(pdev(adev), "ERROR failed to create first device");
444  return rc;
445  }else{
446  struct AFHBA_DEV *adev2 = adevCreate(adev->pci_dev);
447  adev2->map_count = MAP_COUNT_4G2;
448  adev2->peer = adev;
449  adev2->sfp = SFP_B;
450 
451  if ((rc = _afhba_probe(adev2, REMOTE_BAR2, STREAM)) != 0){
452  dev_err(pdev(adev2), "ERROR failed to create second device");
453  return rc;
454  }
455  return rc;
456  }
457 }
458 int afhba4_probe(struct AFHBA_DEV *adev)
459 {
460  int (*_init)(struct AFHBA_DEV* adev) = afhba4_stream? STREAM: NOSTREAM;
461  int rc;
462  int ib;
463 
464  dev_info(pdev(adev), "AFHBA404 detected");
465  adev->map_count = MAP_COUNT_4G4;
466  adev->remote_com_bar = MAP_COUNT_4G4-1;
467  if (bad_bios_bar_limit){
468  dev_warn(pdev(adev), "limiting BAR count to bad_bios_bar_limit=%d",
471  }
472  adev->sfp = SFP_A;
473  adev->ACR = AURORA_CONTROL_REGA;
474  rc = _afhba_probe(adev, REMOTE_BAR, _init);
475  if (rc!=0) return rc;
476 
477 
478  for (ib = 1; ib < afhba_nports; ++ib){
479  struct AFHBA_DEV *adev2 = adevCreate(adev->pci_dev);
480  adev2->map_count = MAP_COUNT_4G4;
481  adev2->peer = adev;
482  adev2->sfp = SFP_A+ib;
483  adev2->ACR = AURORA_CONTROL_REGA + ib*0x10;
484  if ((rc = _afhba_probe(adev2, REMOTE_BAR+ib, _init)) != 0){
485  dev_err(pdev(adev2), "ERROR failed to create device %d", ib);
486  return rc;
487  }
488  }
489  return 0;
490 }
491 int afhba_mtca_probe(struct AFHBA_DEV *adev)
492 {
493  int (*_init)(struct AFHBA_DEV* adev) = afhba4_stream? STREAM: NOSTREAM;
494 
495  dev_info(pdev(adev), "AFHBA404 detected %s", afhba4_stream? "STREAM": "NOSTREAM");
496  adev->map_count = MAP_COUNT_4G1;
497  adev->remote_com_bar = MAP_COUNT_4G1-1;
498  if (bad_bios_bar_limit){
499  dev_warn(pdev(adev), "limiting BAR count to bad_bios_bar_limit=%d",
502  }
503  adev->sfp = SFP_A;
504  adev->ACR = AURORA_CONTROL_REGA;
505  return _afhba_probe(adev, REMOTE_BAR, _init);
506 }
507 
508 int afhba_probe(struct pci_dev *dev, const struct pci_device_id *ent)
509 {
510  struct AFHBA_DEV *adev = adevCreate(dev);
511 
512  dev_info(pdev(adev), "AFHBA: subdevice : %04x\n", ent->subdevice);
513  switch(ent->subdevice){
514  case PCI_SUBDID_FHBA_2G:
515  dev_err(pdev(adev), "AFHBA 2G FIRMWARE detected %04x", ent->subdevice);
516  adevDelete(adev);
517  return -1;
519  dev_err(pdev(adev), "AFHBA 4G OBSOLETE FIRMWARE detected %04x", ent->subdevice);
520  adevDelete(adev);
521  return -1;
522  case PCI_SUBDID_FHBA_4G:
523  dev_info(pdev(adev), "AFHBA 4G single port firmware detected");
524  adev->map_count = MAP_COUNT_4G1;
525  adev->sfp = SFP_A;
526  return _afhba_probe(adev, REMOTE_BAR, STREAM);
527  case PCI_SUBDID_FHBA_4G2:
528  return afhba2_probe(adev);
529  case PCI_SUBDID_FHBA_4G4:
530  return afhba4_probe(adev);
531  case PCI_SUBDID_HBA_KMCU:
532  dev_info(pdev(adev), "KMCU detected");
533  return afhba_mtca_probe(adev);
535  dev_info(pdev(adev), "KMCU2 detected");
536  return afhba_mtca_probe(adev);
537  default:
538  return -ENODEV;
539  }
540 }
541 void afhba_remove (struct pci_dev *dev)
542 {
543  struct AFHBA_DEV *adev = afhba_lookupDevicePci(dev);
544 
545  if (adev){
546  afhba_stream_drv_del(adev);
547  afhba_removeDebugfs(adev);
548  afhba_remove_sysfs(adev);
550  }
551  pci_disable_device(dev);
552 
553 }
554 /*
555  *
556  * { Vendor ID, Device ID, SubVendor ID, SubDevice ID,
557  * Class, Class Mask, String Index }
558  */
559 static struct pci_device_id afhba_pci_tbl[] = {
574  { }
575 };
576 static struct pci_driver afhba_driver = {
577  .name = afhba_driver_name,
578  .id_table = afhba_pci_tbl,
579  .probe = afhba_probe,
580 // .remove = __devexit_p(afhba_remove),
581  .remove = afhba_remove
582 };
583 
584 int __init afhba_init_module(void)
585 {
586  int rc;
587 
588  printk(KERN_INFO "%s %s %s\n%s\n",
592 
593  afhba_device_class = class_create(THIS_MODULE, "afhba");
594  rc = pci_register_driver(&afhba_driver);
595  return rc;
596 }
597 
599 {
600  class_destroy(afhba_device_class);
601  pci_unregister_driver(&afhba_driver);
602 }
603 
606 
608 
609 MODULE_DEVICE_TABLE(pci, afhba_pci_tbl);
611 MODULE_AUTHOR("Peter.Milne@d-tacq.com");
612 MODULE_DESCRIPTION("D-TACQ ACQ-FIBER-HBA Driver for ACQ400");
PAGE_SIZE
#define PAGE_SIZE
Definition: AcqHw.cpp:32
AFHBA_DEV::sfp
enum AFHBA_DEV::SFP sfp
AFHBA_DEV::PciMapping::va
void * va
Definition: acq-fiber-hba.h:125
HostBuffer::pa
u32 pa
Definition: acq-fiber-hba.h:97
afhba_registerDevice
int afhba_registerDevice(struct AFHBA_DEV *tdev)
Definition: afhba_devman.c:27
afhba_write
ssize_t afhba_write(struct file *file, const char *buf, size_t count, loff_t *f_pos)
Definition: acq-fiber-hba.c:192
afhba_remove_sysfs
void afhba_remove_sysfs(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:600
PCI_SUBDID_HBA_KMCU
#define PCI_SUBDID_HBA_KMCU
Definition: d-tacq_pci_id.h:22
pdev
#define pdev(adev)
Definition: acq-fiber-hba.h:176
d-tacq_pci_id.h
afhba_read
ssize_t afhba_read(struct file *file, char __user *buf, size_t count, loff_t *f_pos)
Definition: acq-fiber-hba.c:186
FPGA_REVISION_REG
#define FPGA_REVISION_REG
Definition: acq-fiber-hba.h:189
bad_bios_bar_limit
int bad_bios_bar_limit
Definition: acq-fiber-hba.c:65
HostBuffer::BS_EMPTY
@ BS_EMPTY
Definition: acq-fiber-hba.h:103
MINOR_REMOTE
#define MINOR_REMOTE
Definition: afhba_minor.h:20
AFHBA_DEV::ACR
unsigned ACR
Definition: acq-fiber-hba.h:135
AFHBA_DEV::mon_name
char mon_name[16]
Definition: acq-fiber-hba.h:113
afhba_read_reg
u32 afhba_read_reg(struct AFHBA_DEV *adev, int regoff)
Definition: afhba_core.c:48
SZM1
#define SZM1(field)
Definition: acq-fiber-hba.h:153
afhba_lookupDevice
struct AFHBA_DEV * afhba_lookupDevice(int major)
Definition: afhba_devman.c:39
AFHBA_DEV::major
int major
Definition: acq-fiber-hba.h:118
AFHBA_DEV::remote_com_bar
int remote_com_bar
Definition: acq-fiber-hba.h:130
afhba_release
int afhba_release(struct inode *inode, struct file *file)
Definition: acq-fiber-hba.c:241
_afhba_probe
int _afhba_probe(struct AFHBA_DEV *adev, int remote_bar, int(*stream_drv_init)(struct AFHBA_DEV *adev))
Definition: acq-fiber-hba.c:364
force_busmaster_mode
void force_busmaster_mode(struct AFHBA_DEV *adev)
Definition: acq-fiber-hba.c:350
afhba_lookupDevicePci
struct AFHBA_DEV * afhba_lookupDevicePci(struct pci_dev *pci_dev)
Definition: afhba_devman.c:65
afhba_map
void afhba_map(struct AFHBA_DEV *adev)
Definition: acq-fiber-hba.c:249
null_stream_drv_init
int null_stream_drv_init(struct AFHBA_DEV *adev)
Definition: acq-fiber-hba.c:426
afhba_init_module
int __init afhba_init_module(void)
Definition: acq-fiber-hba.c:584
u16
unsigned short u16
Definition: local.h:61
afhba_create_sysfs_class
void afhba_create_sysfs_class(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:624
AFHBA_DEV::hb1
struct HostBuffer * hb1
Definition: acq-fiber-hba.h:141
PCI_DEVICE_ID_DTACQ_PCIE
#define PCI_DEVICE_ID_DTACQ_PCIE
Definition: d-tacq_pci_id.h:14
HostBuffer::ibuf
int ibuf
Definition: acq-fiber-hba.h:95
afhba_probe
int afhba_probe(struct pci_dev *dev, const struct pci_device_id *ent)
Definition: acq-fiber-hba.c:508
afhba_mmap_bar
int afhba_mmap_bar(struct file *file, struct vm_area_struct *vma)
Definition: acq-fiber-hba.c:197
AFHBA_DEV::PciMapping::len
unsigned len
Definition: acq-fiber-hba.h:126
AFHBA_DEV::SFP_A
@ SFP_A
Definition: acq-fiber-hba.h:134
PCI_SUBDID_FHBA_4G
#define PCI_SUBDID_FHBA_4G
Definition: d-tacq_pci_id.h:19
NOSTREAM
#define NOSTREAM
Definition: acq-fiber-hba.c:432
REGS_BAR
#define REGS_BAR
Definition: acq-fiber-hba.h:181
adevDelete
void adevDelete(struct AFHBA_DEV *adev)
Definition: acq-fiber-hba.c:341
HostBuffer::bstate
enum HostBuffer::BSTATE bstate
afhba_nports
int afhba_nports
Definition: acq-fiber-hba.c:62
AFHBA_DEV::peer
struct AFHBA_DEV * peer
Definition: acq-fiber-hba.h:132
afhba_driver_name
char afhba_driver_name[]
Definition: acq-fiber-hba.c:30
PCI_SUBDID_FHBA_4G_OLD
#define PCI_SUBDID_FHBA_4G_OLD
Definition: d-tacq_pci_id.h:18
afhba_mmap_hb
int afhba_mmap_hb(struct file *file, struct vm_area_struct *vma)
Definition: acq-fiber-hba.c:219
PCI_VENDOR_ID_XILINX
#define PCI_VENDOR_ID_XILINX
Definition: d-tacq_pci_id.h:11
PD
#define PD(file)
Definition: acq-fiber-hba.h:173
afhba2_probe
int afhba2_probe(struct AFHBA_DEV *adev)
Definition: acq-fiber-hba.c:434
PCI_SUBVID_DTACQ
#define PCI_SUBVID_DTACQ
Definition: d-tacq_pci_id.h:16
MODULE_DEVICE_TABLE
MODULE_DEVICE_TABLE(pci, afhba_pci_tbl)
VALID_BAR
#define VALID_BAR(bar)
Definition: acq-fiber-hba.c:87
PSZ
#define PSZ
Definition: acq-fiber-hba.h:172
afhba_create_sysfs
void afhba_create_sysfs(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:590
ib
int ib
Definition: InlineDataHandlerMuxAO_LLC.cpp:57
afhba_createDebugfs
void afhba_createDebugfs(struct AFHBA_DEV *adev)
Definition: afhba_debugfs.c:35
afhba_remove_sysfs_class
void afhba_remove_sysfs_class(struct AFHBA_DEV *adev)
Definition: afhba_sysfs.c:642
MODULE_LICENSE
MODULE_LICENSE("GPL")
MAP_COUNT_4G1
#define MAP_COUNT_4G1
Definition: acq-fiber-hba.h:79
bar_write
ssize_t bar_write(struct file *file, const char *buf, size_t count, loff_t *f_pos, int BAR, int OFFSET)
Definition: acq-fiber-hba.c:124
afhba_devices
struct list_head afhba_devices
AFHBA_DEV::idx
int idx
Definition: acq-fiber-hba.h:117
REMOTE_BAR
#define REMOTE_BAR
Definition: acq-fiber-hba.h:182
AFHBA_DEV::class_dev
struct device * class_dev
Definition: acq-fiber-hba.h:116
PCI_SUBDID_HBA_KMCU2
#define PCI_SUBDID_HBA_KMCU2
Definition: d-tacq_pci_id.h:23
PCI_SUBDID_FHBA_4G2
#define PCI_SUBDID_FHBA_4G2
Definition: d-tacq_pci_id.h:20
EXPORT_SYMBOL_GPL
EXPORT_SYMBOL_GPL(afhba_devices)
afhba_device_class
struct class * afhba_device_class
Definition: acq-fiber-hba.c:36
HostBuffer::descr
u32 descr
Definition: acq-fiber-hba.h:100
module_init
module_init(afhba_init_module)
PCI_SUBDID_FHBA_2G
#define PCI_SUBDID_FHBA_2G
Definition: d-tacq_pci_id.h:17
PCI_DEVICE_ID_XILINX_PCIE
#define PCI_DEVICE_ID_XILINX_PCIE
Definition: d-tacq_pci_id.h:12
MAP_COUNT_4G4
#define MAP_COUNT_4G4
Definition: acq-fiber-hba.h:82
AFHBA_DEV
Definition: acq-fiber-hba.h:111
MODULE_DESCRIPTION
MODULE_DESCRIPTION("D-TACQ ACQ-FIBER-HBA Driver for ACQ400")
HostBuffer::va
void * va
Definition: acq-fiber-hba.h:96
MAXDEV
#define MAXDEV
Definition: acq-fiber-hba.h:65
afhba__driver_version
char afhba__driver_version[]
Definition: acq-fiber-hba.c:32
afhba__copyright
char afhba__copyright[]
Definition: acq-fiber-hba.c:33
REMOTE_BAR2
#define REMOTE_BAR2
Definition: acq-fiber-hba.h:183
afhba_stream_drv_del
int afhba_stream_drv_del(struct AFHBA_DEV *adev)
Definition: afhba_stream_drv.c:2246
afhba_removeDebugfs
void afhba_removeDebugfs(struct AFHBA_DEV *adev)
Definition: afhba_debugfs.c:90
AFHBA_DEV::map_count
int map_count
Definition: acq-fiber-hba.h:120
DEV
#define DEV(file)
Definition: acq-fiber-hba.h:174
MINOR_REGREAD
#define MINOR_REGREAD
Definition: afhba_minor.h:14
afhba4_stream
int afhba4_stream
Definition: acq-fiber-hba.c:59
afhba_debug
int afhba_debug
Definition: acq-fiber-hba.c:49
afhba_remove
void afhba_remove(struct pci_dev *dev)
Definition: acq-fiber-hba.c:541
afhba__driver_string
char afhba__driver_string[]
Definition: acq-fiber-hba.c:31
AFHBA_DEV::name
char name[16]
Definition: acq-fiber-hba.h:112
afhba4_probe
int afhba4_probe(struct AFHBA_DEV *adev)
Definition: acq-fiber-hba.c:458
AFHBA_DEV::PciMapping::pa
u32 pa
Definition: acq-fiber-hba.h:124
ll_mode_only
int ll_mode_only
Definition: acq-fiber-hba.c:53
AFHBA_PCI_CMD
#define AFHBA_PCI_CMD
Definition: acq-fiber-hba.c:348
AURORA_CONTROL_REGA
#define AURORA_CONTROL_REGA
Definition: acq-fiber-hba.h:209
AFHBA_DEV::remote
void * remote
Definition: acq-fiber-hba.h:133
PCI_SUBDID_FHBA_4G4
#define PCI_SUBDID_FHBA_4G4
Definition: d-tacq_pci_id.h:21
HostBuffer::len
int len
Definition: acq-fiber-hba.h:98
AFHBA_DEV::mappings
struct AFHBA_DEV::PciMapping mappings[MAP_COUNT_MAX]
module_exit
module_exit(afhba_exit_module)
AFHBA_DEV::SFP_B
@ SFP_B
Definition: acq-fiber-hba.h:134
afhba_mtca_probe
int afhba_mtca_probe(struct AFHBA_DEV *adev)
Definition: acq-fiber-hba.c:491
module_param
module_param(afhba_debug, int, 0644)
NO_BAR
#define NO_BAR
Definition: acq-fiber-hba.h:184
HostBuffer
Definition: acq-fiber-hba.h:94
bar_read
ssize_t bar_read(struct file *file, char *buf, size_t count, loff_t *f_pos, int BAR)
Definition: acq-fiber-hba.c:90
adevCreate
struct AFHBA_DEV * adevCreate(struct pci_dev *dev)
Definition: acq-fiber-hba.c:326
afhba_open
int afhba_open(struct inode *inode, struct file *file)
Definition: acq-fiber-hba.c:156
acq-fiber-hba.h
MODULE_AUTHOR
MODULE_AUTHOR("Peter.Milne@d-tacq.com")
afhba_devnames
const char * afhba_devnames[MAXDEV]
Definition: acq-fiber-hba.c:41
afhba_exit_module
void afhba_exit_module(void)
Definition: acq-fiber-hba.c:598
STREAM
Definition: rtm-t-stream.cpp:54
LIST_HEAD
LIST_HEAD(afhba_devices)
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
MAP_COUNT_4G2
#define MAP_COUNT_4G2
Definition: acq-fiber-hba.h:80
AFHBA_DEV::stream_fops
struct file_operations * stream_fops
Definition: acq-fiber-hba.h:144