prom.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Definitions for talking to the Open Firmware PROM on
  3. * Power Macintosh computers.
  4. *
  5. * Copyright (C) 1996-2005 Paul Mackerras.
  6. *
  7. * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. */
  14. #include <linux/of.h> /* linux/of.h gets to determine #include ordering */
  15. #ifndef _ASM_MICROBLAZE_PROM_H
  16. #define _ASM_MICROBLAZE_PROM_H
  17. #ifdef __KERNEL__
  18. #ifndef __ASSEMBLY__
  19. #include <linux/types.h>
  20. #include <linux/of_address.h>
  21. #include <linux/of_irq.h>
  22. #include <linux/of_fdt.h>
  23. #include <linux/proc_fs.h>
  24. #include <linux/platform_device.h>
  25. #include <asm/irq.h>
  26. #include <asm/atomic.h>
  27. #define HAVE_ARCH_DEVTREE_FIXUPS
  28. /* Other Prototypes */
  29. extern int early_uartlite_console(void);
  30. #ifdef CONFIG_PCI
  31. /*
  32. * PCI <-> OF matching functions
  33. * (XXX should these be here?)
  34. */
  35. struct pci_bus;
  36. struct pci_dev;
  37. extern int pci_device_from_OF_node(struct device_node *node,
  38. u8 *bus, u8 *devfn);
  39. extern struct device_node *pci_busdev_to_OF_node(struct pci_bus *bus,
  40. int devfn);
  41. extern struct device_node *pci_device_to_OF_node(struct pci_dev *dev);
  42. extern void pci_create_OF_bus_map(void);
  43. #endif
  44. /*
  45. * OF address retreival & translation
  46. */
  47. /* Translate an OF address block into a CPU physical address
  48. */
  49. extern u64 of_translate_address(struct device_node *np, const u32 *addr);
  50. /* Extract an address from a device, returns the region size and
  51. * the address space flags too. The PCI version uses a BAR number
  52. * instead of an absolute index
  53. */
  54. extern const u32 *of_get_address(struct device_node *dev, int index,
  55. u64 *size, unsigned int *flags);
  56. extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
  57. u64 *size, unsigned int *flags);
  58. extern int of_pci_address_to_resource(struct device_node *dev, int bar,
  59. struct resource *r);
  60. #ifdef CONFIG_PCI
  61. extern unsigned long pci_address_to_pio(phys_addr_t address);
  62. #else
  63. static inline unsigned long pci_address_to_pio(phys_addr_t address)
  64. {
  65. return (unsigned long)-1;
  66. }
  67. #endif /* CONFIG_PCI */
  68. /* Parse the ibm,dma-window property of an OF node into the busno, phys and
  69. * size parameters.
  70. */
  71. void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
  72. unsigned long *busno, unsigned long *phys, unsigned long *size);
  73. extern void kdump_move_device_tree(void);
  74. /* CPU OF node matching */
  75. struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
  76. /* Get the MAC address */
  77. extern const void *of_get_mac_address(struct device_node *np);
  78. /**
  79. * of_irq_map_pci - Resolve the interrupt for a PCI device
  80. * @pdev: the device whose interrupt is to be resolved
  81. * @out_irq: structure of_irq filled by this function
  82. *
  83. * This function resolves the PCI interrupt for a given PCI device. If a
  84. * device-node exists for a given pci_dev, it will use normal OF tree
  85. * walking. If not, it will implement standard swizzling and walk up the
  86. * PCI tree until an device-node is found, at which point it will finish
  87. * resolving using the OF tree walking.
  88. */
  89. struct pci_dev;
  90. extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
  91. #endif /* __ASSEMBLY__ */
  92. #endif /* __KERNEL__ */
  93. #endif /* _ASM_MICROBLAZE_PROM_H */