pci.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. *
  4. * Copyright (C) 2003, 04, 11 Ralf Baechle (ralf@linux-mips.org)
  5. * Copyright (C) 2011 Wind River Systems,
  6. * written by Ralf Baechle (ralf@linux-mips.org)
  7. */
  8. #include <linux/bug.h>
  9. #include <linux/kernel.h>
  10. #include <linux/mm.h>
  11. #include <linux/memblock.h>
  12. #include <linux/export.h>
  13. #include <linux/init.h>
  14. #include <linux/types.h>
  15. #include <linux/pci.h>
  16. #include <linux/of_address.h>
  17. #include <asm/cpu-info.h>
  18. unsigned long PCIBIOS_MIN_IO;
  19. EXPORT_SYMBOL(PCIBIOS_MIN_IO);
  20. unsigned long PCIBIOS_MIN_MEM;
  21. EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
  22. static int __init pcibios_set_cache_line_size(void)
  23. {
  24. unsigned int lsize;
  25. /*
  26. * Set PCI cacheline size to that of the highest level in the
  27. * cache hierarchy.
  28. */
  29. lsize = cpu_dcache_line_size();
  30. lsize = cpu_scache_line_size() ? : lsize;
  31. lsize = cpu_tcache_line_size() ? : lsize;
  32. BUG_ON(!lsize);
  33. pci_dfl_cache_line_size = lsize >> 2;
  34. pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
  35. return 0;
  36. }
  37. arch_initcall(pcibios_set_cache_line_size);
  38. void pci_resource_to_user(const struct pci_dev *dev, int bar,
  39. const struct resource *rsrc, resource_size_t *start,
  40. resource_size_t *end)
  41. {
  42. phys_addr_t size = resource_size(rsrc);
  43. *start = fixup_bigphys_addr(rsrc->start, size);
  44. *end = rsrc->start + size - 1;
  45. }