base.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef _PCIDRIVER_BASE_H
  2. #define _PCIDRIVER_BASE_H
  3. #include "sysfs.h"
  4. /**
  5. *
  6. * This file contains prototypes and data structures for internal use of the pciDriver.
  7. *
  8. *
  9. */
  10. /* prototypes for file_operations */
  11. static struct file_operations pcidriver_fops;
  12. int pcidriver_mmap( struct file *filp, struct vm_area_struct *vmap );
  13. int pcidriver_open(struct inode *inode, struct file *filp );
  14. int pcidriver_release(struct inode *inode, struct file *filp);
  15. /* prototypes for device operations */
  16. static struct pci_driver pcidriver_driver;
  17. static int __devinit pcidriver_probe(struct pci_dev *pdev, const struct pci_device_id *id);
  18. static void __devexit pcidriver_remove(struct pci_dev *pdev);
  19. /* prototypes for module operations */
  20. static int __init pcidriver_init(void);
  21. static void pcidriver_exit(void);
  22. /*
  23. * This is the table of PCI devices handled by this driver by default
  24. * If you want to add devices dynamically to this list, do:
  25. *
  26. * echo "vendor device" > /sys/bus/pci/drivers/pciDriver/new_id
  27. * where vendor and device are in hex, without leading '0x'.
  28. *
  29. * The IDs themselves can be found in common.h
  30. *
  31. * For more info, see <kernel-source>/Documentation/pci.txt
  32. *
  33. * __devinitdata is applied because the kernel does not need those
  34. * tables any more after boot is finished on systems which don't
  35. * support hotplug.
  36. *
  37. */
  38. static const __devinitdata struct pci_device_id pcidriver_ids[] = {
  39. { PCI_DEVICE( MPRACE1_VENDOR_ID , MPRACE1_DEVICE_ID ) }, // mpRACE-1
  40. { PCI_DEVICE( PCIXTEST_VENDOR_ID , PCIXTEST_DEVICE_ID ) }, // pcixTest
  41. { PCI_DEVICE( PCIEPLDA_VENDOR_ID , PCIEPLDA_DEVICE_ID ) }, // PCIePLDA
  42. { PCI_DEVICE( PCIEABB_VENDOR_ID , PCIEABB_DEVICE_ID ) }, // PCIeABB
  43. { PCI_DEVICE( PCIXPG4_VENDOR_ID , PCIXPG4_DEVICE_ID ) }, // PCI-X PROGRAPE 4
  44. { PCI_DEVICE( PCI64PG4_VENDOR_ID , PCI64PG4_DEVICE_ID ) }, // PCI-64 PROGRAPE 4
  45. { PCI_DEVICE( PCIE_XILINX_VENDOR_ID, PCIE_ML605_DEVICE_ID ) }, // PCI-E Xilinx ML605
  46. {0,0,0,0},
  47. };
  48. /* prototypes for internal driver functions */
  49. int pcidriver_pci_read( pcidriver_privdata_t *privdata, pci_cfg_cmd *pci_cmd );
  50. int pcidriver_pci_write( pcidriver_privdata_t *privdata, pci_cfg_cmd *pci_cmd );
  51. int pcidriver_pci_info( pcidriver_privdata_t *privdata, pci_board_info *pci_info );
  52. int pcidriver_mmap_pci( pcidriver_privdata_t *privdata, struct vm_area_struct *vmap , int bar );
  53. int pcidriver_mmap_kmem( pcidriver_privdata_t *privdata, struct vm_area_struct *vmap );
  54. /*************************************************************************/
  55. /* Static data */
  56. /* Hold the allocated major & minor numbers */
  57. static dev_t pcidriver_devt;
  58. /* Number of devices allocated */
  59. static atomic_t pcidriver_deviceCount;
  60. /* Sysfs attributes */
  61. static DEVICE_ATTR(mmap_mode, (S_IRUGO | S_IWUGO), pcidriver_show_mmap_mode, pcidriver_store_mmap_mode);
  62. static DEVICE_ATTR(mmap_area, (S_IRUGO | S_IWUGO), pcidriver_show_mmap_area, pcidriver_store_mmap_area);
  63. static DEVICE_ATTR(kmem_count, S_IRUGO, pcidriver_show_kmem_count, NULL);
  64. static DEVICE_ATTR(kbuffers, S_IRUGO, pcidriver_show_kbuffers, NULL);
  65. static DEVICE_ATTR(kmem_alloc, S_IWUGO, NULL, pcidriver_store_kmem_alloc);
  66. static DEVICE_ATTR(kmem_free, S_IWUGO, NULL, pcidriver_store_kmem_free);
  67. static DEVICE_ATTR(umappings, S_IRUGO, pcidriver_show_umappings, NULL);
  68. static DEVICE_ATTR(umem_unmap, S_IWUGO, NULL, pcidriver_store_umem_unmap);
  69. #ifdef ENABLE_IRQ
  70. static DEVICE_ATTR(irq_count, S_IRUGO, pcidriver_show_irq_count, NULL);
  71. static DEVICE_ATTR(irq_queues, S_IRUGO, pcidriver_show_irq_queues, NULL);
  72. #endif
  73. #endif