pci.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Code borrowed from powerpc/kernel/pci-common.c
  3. *
  4. * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
  5. * Copyright (C) 2014 ARM Ltd.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. */
  12. #include <linux/acpi.h>
  13. #include <linux/init.h>
  14. #include <linux/io.h>
  15. #include <linux/kernel.h>
  16. #include <linux/mm.h>
  17. #include <linux/of_pci.h>
  18. #include <linux/of_platform.h>
  19. #include <linux/slab.h>
  20. #include <asm/pci-bridge.h>
  21. /*
  22. * Called after each bus is probed, but before its children are examined
  23. */
  24. void pcibios_fixup_bus(struct pci_bus *bus)
  25. {
  26. /* nothing to do, expected to be removed in the future */
  27. }
  28. /*
  29. * We don't have to worry about legacy ISA devices, so nothing to do here
  30. */
  31. resource_size_t pcibios_align_resource(void *data, const struct resource *res,
  32. resource_size_t size, resource_size_t align)
  33. {
  34. return res->start;
  35. }
  36. /**
  37. * pcibios_enable_device - Enable I/O and memory.
  38. * @dev: PCI device to be enabled
  39. * @mask: bitmask of BARs to enable
  40. */
  41. int pcibios_enable_device(struct pci_dev *dev, int mask)
  42. {
  43. if (pci_has_flag(PCI_PROBE_ONLY))
  44. return 0;
  45. return pci_enable_resources(dev, mask);
  46. }
  47. /*
  48. * Try to assign the IRQ number from DT when adding a new device
  49. */
  50. int pcibios_add_device(struct pci_dev *dev)
  51. {
  52. dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
  53. return 0;
  54. }
  55. /*
  56. * raw_pci_read/write - Platform-specific PCI config space access.
  57. */
  58. int raw_pci_read(unsigned int domain, unsigned int bus,
  59. unsigned int devfn, int reg, int len, u32 *val)
  60. {
  61. return -ENXIO;
  62. }
  63. int raw_pci_write(unsigned int domain, unsigned int bus,
  64. unsigned int devfn, int reg, int len, u32 val)
  65. {
  66. return -ENXIO;
  67. }
  68. #ifdef CONFIG_ACPI
  69. /* Root bridge scanning */
  70. struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
  71. {
  72. /* TODO: Should be revisited when implementing PCI on ACPI */
  73. return NULL;
  74. }
  75. #endif