/alps/pcitool

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to driver/ioctl.c

  • Committer: Vasilii Chernov
  • Date: 2016-03-02 07:48:24 UTC
  • mfrom: (359 pcitool)
  • mto: This revision was merged to the branch mainline in revision 367.
  • Revision ID: vchernov@inr.ru-20160302074824-gcpwar3f33n5353q
1. Merge with http://ufo.kit.edu/ufo/log/csa/pcitool 359 revision
2. Move api_server to html server

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
 */
97
97
static int ioctl_pci_config_read_write(pcidriver_privdata_t *privdata, unsigned int cmd, unsigned long arg)
98
98
{
 
99
#ifdef PCIDRIVER_DUMMY_DEVICE
 
100
        return -ENXIO;
 
101
#else /* PCIDRIVER_DUMMY_DEVICE */
99
102
        int ret;
100
103
        READ_FROM_USER(pci_cfg_cmd, pci_cmd);
101
104
 
133
136
        WRITE_TO_USER(pci_cfg_cmd, pci_cmd);
134
137
 
135
138
        return 0;
 
139
#endif /* PCIDRIVER_DUMMY_DEVICE */
136
140
}
137
141
 
138
142
/**
145
149
static int ioctl_pci_info(pcidriver_privdata_t *privdata, unsigned long arg)
146
150
{
147
151
        int ret;
 
152
 
 
153
#ifdef PCIDRIVER_DUMMY_DEVICE
 
154
        READ_FROM_USER(pcilib_board_info_t, pci_info);
 
155
        memset(&pci_info, 0, sizeof(pci_info));
 
156
        WRITE_TO_USER(pcilib_board_info_t, pci_info);
 
157
#else /* PCIDRIVER_DUMMY_DEVICE */
148
158
        int bar;
 
159
 
149
160
        READ_FROM_USER(pcilib_board_info_t, pci_info);
150
161
 
151
162
        pci_info.vendor_id = privdata->pdev->vendor;
168
179
        }
169
180
 
170
181
        WRITE_TO_USER(pcilib_board_info_t, pci_info);
 
182
#endif /* PCIDRIVER_DUMMY_DEVICE */
171
183
 
172
184
        return 0;
173
185
}
443
455
        int ret;
444
456
        pcilib_device_state_t info;
445
457
 
 
458
#ifdef PCIDRIVER_DUMMY_DEVICE
 
459
        memset(&info, 0, sizeof(info));
 
460
#else /* PCIDRIVER_DUMMY_DEVICE */
446
461
        info = (pcilib_device_state_t) {
447
462
            .iommu = iommu_present(privdata->pdev->dev.bus),
448
463
            .mps = pcidriver_pcie_get_mps(privdata->pdev),
449
464
            .readrq = pcie_get_readrq(privdata->pdev),
450
465
            .dma_mask = privdata->pdev->dma_mask
451
466
        };
 
467
#endif /* PCIDRIVER_DUMMY_DEVICE */
452
468
 
453
469
 
454
470
        WRITE_TO_USER(pcilib_device_state_t, info);
466
482
 */
467
483
static int ioctl_set_dma_mask(pcidriver_privdata_t *privdata, unsigned long arg)
468
484
{
 
485
#ifndef PCIDRIVER_DUMMY_DEVICE
469
486
        int err;
470
487
 
471
488
        if ((arg < 24) || (arg > 64))
476
493
            printk(KERN_ERR "pci_set_dma_mask(%lu) failed\n", arg);
477
494
            return err;
478
495
        }
 
496
#endif /* ! PCIDRIVER_DUMMY_DEVICE */
479
497
        
480
498
        return 0;
481
499
}
489
507
 */
490
508
static int ioctl_set_mps(pcidriver_privdata_t *privdata, unsigned long arg)
491
509
{
 
510
#ifndef PCIDRIVER_DUMMY_DEVICE
492
511
        int err;
493
512
 
494
513
        if ((arg != 128) && (arg != 256) && (arg != 512))
499
518
            printk(KERN_ERR "pcie_set_mps(%lu) failed\n", arg);
500
519
            return err;
501
520
        }
 
521
#endif /* ! PCIDRIVER_DUMMY_DEVICE */
502
522
        
503
523
        return 0;
504
524
}