prom.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include <linux/of.h> /* linux/of.h gets to determine #include ordering */
  2. #ifndef _POWERPC_PROM_H
  3. #define _POWERPC_PROM_H
  4. #ifdef __KERNEL__
  5. /*
  6. * Definitions for talking to the Open Firmware PROM on
  7. * Power Macintosh computers.
  8. *
  9. * Copyright (C) 1996-2005 Paul Mackerras.
  10. *
  11. * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License
  15. * as published by the Free Software Foundation; either version
  16. * 2 of the License, or (at your option) any later version.
  17. */
  18. #include <linux/types.h>
  19. #include <asm/irq.h>
  20. #include <asm/atomic.h>
  21. #define HAVE_ARCH_DEVTREE_FIXUPS
  22. #ifdef CONFIG_PPC32
  23. /*
  24. * PCI <-> OF matching functions
  25. * (XXX should these be here?)
  26. */
  27. struct pci_bus;
  28. struct pci_dev;
  29. extern int pci_device_from_OF_node(struct device_node *node,
  30. u8* bus, u8* devfn);
  31. extern struct device_node* pci_busdev_to_OF_node(struct pci_bus *, int);
  32. extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
  33. extern void pci_create_OF_bus_map(void);
  34. #endif
  35. /*
  36. * OF address retreival & translation
  37. */
  38. /* Translate a DMA address from device space to CPU space */
  39. extern u64 of_translate_dma_address(struct device_node *dev,
  40. const __be32 *in_addr);
  41. #ifdef CONFIG_PCI
  42. extern unsigned long pci_address_to_pio(phys_addr_t address);
  43. #define pci_address_to_pio pci_address_to_pio
  44. #endif /* CONFIG_PCI */
  45. /* Parse the ibm,dma-window property of an OF node into the busno, phys and
  46. * size parameters.
  47. */
  48. void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
  49. unsigned long *busno, unsigned long *phys, unsigned long *size);
  50. extern void kdump_move_device_tree(void);
  51. /* CPU OF node matching */
  52. struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
  53. /* cache lookup */
  54. struct device_node *of_find_next_cache_node(struct device_node *np);
  55. #ifdef CONFIG_NUMA
  56. extern int of_node_to_nid(struct device_node *device);
  57. #else
  58. static inline int of_node_to_nid(struct device_node *device) { return 0; }
  59. #endif
  60. #define of_node_to_nid of_node_to_nid
  61. /**
  62. * of_irq_map_pci - Resolve the interrupt for a PCI device
  63. * @pdev: the device whose interrupt is to be resolved
  64. * @out_irq: structure of_irq filled by this function
  65. *
  66. * This function resolves the PCI interrupt for a given PCI device. If a
  67. * device-node exists for a given pci_dev, it will use normal OF tree
  68. * walking. If not, it will implement standard swizzling and walk up the
  69. * PCI tree until an device-node is found, at which point it will finish
  70. * resolving using the OF tree walking.
  71. */
  72. struct pci_dev;
  73. struct of_irq;
  74. extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
  75. extern void of_instantiate_rtc(void);
  76. /* These includes are put at the bottom because they may contain things
  77. * that are overridden by this file. Ideally they shouldn't be included
  78. * by this file, but there are a bunch of .c files that currently depend
  79. * on it. Eventually they will be cleaned up. */
  80. #include <linux/of_fdt.h>
  81. #include <linux/of_address.h>
  82. #include <linux/of_irq.h>
  83. #include <linux/platform_device.h>
  84. #endif /* __KERNEL__ */
  85. #endif /* _POWERPC_PROM_H */