Files
linux/rust/helpers/pci.c
T
Alistair Popple b6a37d1d46 rust: Add several miscellaneous PCI helpers
Add bindings to obtain a PCI device's resource start address, bus/
device function, revision ID and subsystem device and vendor IDs.

These will be used by the nova-core GPU driver which is currently in
development.

Reviewed-by: Alexandre Courbot <[email protected]>
Cc: Danilo Krummrich <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Krzysztof Wilczyński <[email protected]>
Cc: Miguel Ojeda <[email protected]>
Cc: Alex Gaynor <[email protected]>
Cc: Boqun Feng <[email protected]>
Cc: Gary Guo <[email protected]>
Cc: Björn Roy Baron <[email protected]>
Cc: Benno Lossin <[email protected]>
Cc: Andreas Hindborg <[email protected]>
Cc: Alice Ryhl <[email protected]>
Cc: Trevor Gross <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: John Hubbard <[email protected]>
Cc: Alexandre Courbot <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Alistair Popple <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danilo Krummrich <[email protected]>
2025-08-15 20:25:42 +02:00

32 lines
630 B
C

// SPDX-License-Identifier: GPL-2.0
#include <linux/pci.h>
u16 rust_helper_pci_dev_id(struct pci_dev *dev)
{
return PCI_DEVID(dev->bus->number, dev->devfn);
}
resource_size_t rust_helper_pci_resource_start(struct pci_dev *pdev, int bar)
{
return pci_resource_start(pdev, bar);
}
resource_size_t rust_helper_pci_resource_len(struct pci_dev *pdev, int bar)
{
return pci_resource_len(pdev, bar);
}
bool rust_helper_dev_is_pci(const struct device *dev)
{
return dev_is_pci(dev);
}
#ifndef CONFIG_PCI_MSI
int rust_helper_pci_irq_vector(struct pci_dev *pdev, unsigned int nvec)
{
return pci_irq_vector(pdev, nvec);
}
#endif