/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to driver/base.h

  • Committer: Suren A. Chilingaryan
  • Date: 2011-02-13 02:07:11 UTC
  • Revision ID: csa@dside.dyndns.org-20110213020711-y9bjh3n4ke6p4t4n
Initial import

Show diffs side-by-side

added added

removed removed

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