pci.c 933 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Code borrowed from powerpc/kernel/pci-common.c
  4. *
  5. * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
  6. * Copyright (C) 2014 ARM Ltd.
  7. */
  8. #include <linux/pci.h>
  9. /*
  10. * raw_pci_read/write - Platform-specific PCI config space access.
  11. */
  12. int raw_pci_read(unsigned int domain, unsigned int bus,
  13. unsigned int devfn, int reg, int len, u32 *val)
  14. {
  15. struct pci_bus *b = pci_find_bus(domain, bus);
  16. if (!b)
  17. return PCIBIOS_DEVICE_NOT_FOUND;
  18. return b->ops->read(b, devfn, reg, len, val);
  19. }
  20. int raw_pci_write(unsigned int domain, unsigned int bus,
  21. unsigned int devfn, int reg, int len, u32 val)
  22. {
  23. struct pci_bus *b = pci_find_bus(domain, bus);
  24. if (!b)
  25. return PCIBIOS_DEVICE_NOT_FOUND;
  26. return b->ops->write(b, devfn, reg, len, val);
  27. }
  28. #ifdef CONFIG_NUMA
  29. int pcibus_to_node(struct pci_bus *bus)
  30. {
  31. return dev_to_node(&bus->dev);
  32. }
  33. EXPORT_SYMBOL(pcibus_to_node);
  34. #endif