pci.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License as published by the
  4. * Free Software Foundation; either version 2 of the License, or (at your
  5. * option) any later version.
  6. *
  7. * Copyright (C) 2003, 04, 11 Ralf Baechle (ralf@linux-mips.org)
  8. * Copyright (C) 2011 Wind River Systems,
  9. * written by Ralf Baechle (ralf@linux-mips.org)
  10. */
  11. #include <linux/bug.h>
  12. #include <linux/kernel.h>
  13. #include <linux/mm.h>
  14. #include <linux/bootmem.h>
  15. #include <linux/export.h>
  16. #include <linux/init.h>
  17. #include <linux/types.h>
  18. #include <linux/pci.h>
  19. #include <linux/of_address.h>
  20. #include <asm/cpu-info.h>
  21. unsigned long PCIBIOS_MIN_IO;
  22. EXPORT_SYMBOL(PCIBIOS_MIN_IO);
  23. unsigned long PCIBIOS_MIN_MEM;
  24. EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
  25. static int __init pcibios_set_cache_line_size(void)
  26. {
  27. unsigned int lsize;
  28. /*
  29. * Set PCI cacheline size to that of the highest level in the
  30. * cache hierarchy.
  31. */
  32. lsize = cpu_dcache_line_size();
  33. lsize = cpu_scache_line_size() ? : lsize;
  34. lsize = cpu_tcache_line_size() ? : lsize;
  35. BUG_ON(!lsize);
  36. pci_dfl_cache_line_size = lsize >> 2;
  37. pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
  38. return 0;
  39. }
  40. arch_initcall(pcibios_set_cache_line_size);
  41. void pci_resource_to_user(const struct pci_dev *dev, int bar,
  42. const struct resource *rsrc, resource_size_t *start,
  43. resource_size_t *end)
  44. {
  45. phys_addr_t size = resource_size(rsrc);
  46. *start = fixup_bigphys_addr(rsrc->start, size);
  47. *end = rsrc->start + size - 1;
  48. }