Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/rust/helpers/pci.c
49348 views
1
// SPDX-License-Identifier: GPL-2.0
2
3
#include <linux/pci.h>
4
5
u16 rust_helper_pci_dev_id(struct pci_dev *dev)
6
{
7
return PCI_DEVID(dev->bus->number, dev->devfn);
8
}
9
10
resource_size_t rust_helper_pci_resource_start(struct pci_dev *pdev, int bar)
11
{
12
return pci_resource_start(pdev, bar);
13
}
14
15
resource_size_t rust_helper_pci_resource_len(struct pci_dev *pdev, int bar)
16
{
17
return pci_resource_len(pdev, bar);
18
}
19
20
bool rust_helper_dev_is_pci(const struct device *dev)
21
{
22
return dev_is_pci(dev);
23
}
24
25
#ifndef CONFIG_PCI_MSI
26
int rust_helper_pci_alloc_irq_vectors(struct pci_dev *dev,
27
unsigned int min_vecs,
28
unsigned int max_vecs,
29
unsigned int flags)
30
{
31
return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
32
}
33
34
void rust_helper_pci_free_irq_vectors(struct pci_dev *dev)
35
{
36
pci_free_irq_vectors(dev);
37
}
38
39
int rust_helper_pci_irq_vector(struct pci_dev *pdev, unsigned int nvec)
40
{
41
return pci_irq_vector(pdev, nvec);
42
}
43
#endif
44
45