prom.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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_irq.h>
  21. #include <linux/of_fdt.h>
  22. #include <linux/proc_fs.h>
  23. #include <linux/platform_device.h>
  24. #include <asm/irq.h>
  25. #include <asm/atomic.h>
  26. #define HAVE_ARCH_DEVTREE_FIXUPS
  27. /* Other Prototypes */
  28. extern int early_uartlite_console(void);
  29. #ifdef CONFIG_PCI
  30. /*
  31. * PCI <-> OF matching functions
  32. * (XXX should these be here?)
  33. */
  34. struct pci_bus;
  35. struct pci_dev;
  36. extern int pci_device_from_OF_node(struct device_node *node,
  37. u8 *bus, u8 *devfn);
  38. extern struct device_node *pci_busdev_to_OF_node(struct pci_bus *bus,
  39. int devfn);
  40. extern struct device_node *pci_device_to_OF_node(struct pci_dev *dev);
  41. extern void pci_create_OF_bus_map(void);
  42. #endif
  43. /*
  44. * OF address retreival & translation
  45. */
  46. /* Translate an OF address block into a CPU physical address
  47. */
  48. extern u64 of_translate_address(struct device_node *np, const u32 *addr);
  49. /* Extract an address from a device, returns the region size and
  50. * the address space flags too. The PCI version uses a BAR number
  51. * instead of an absolute index
  52. */
  53. extern const u32 *of_get_address(struct device_node *dev, int index,
  54. u64 *size, unsigned int *flags);
  55. extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
  56. u64 *size, unsigned int *flags);
  57. /* Get an address as a resource. Note that if your address is
  58. * a PIO address, the conversion will fail if the physical address
  59. * can't be internally converted to an IO token with
  60. * pci_address_to_pio(), that is because it's either called to early
  61. * or it can't be matched to any host bridge IO space
  62. */
  63. extern int of_address_to_resource(struct device_node *dev, int index,
  64. struct resource *r);
  65. extern int of_pci_address_to_resource(struct device_node *dev, int bar,
  66. struct resource *r);
  67. /* Parse the ibm,dma-window property of an OF node into the busno, phys and
  68. * size parameters.
  69. */
  70. void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
  71. unsigned long *busno, unsigned long *phys, unsigned long *size);
  72. extern void kdump_move_device_tree(void);
  73. /* CPU OF node matching */
  74. struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
  75. /* Get the MAC address */
  76. extern const void *of_get_mac_address(struct device_node *np);
  77. /**
  78. * of_irq_map_pci - Resolve the interrupt for a PCI device
  79. * @pdev: the device whose interrupt is to be resolved
  80. * @out_irq: structure of_irq filled by this function
  81. *
  82. * This function resolves the PCI interrupt for a given PCI device. If a
  83. * device-node exists for a given pci_dev, it will use normal OF tree
  84. * walking. If not, it will implement standard swizzling and walk up the
  85. * PCI tree until an device-node is found, at which point it will finish
  86. * resolving using the OF tree walking.
  87. */
  88. struct pci_dev;
  89. extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
  90. /**
  91. * of_iomap - Maps the memory mapped IO for a given device_node
  92. * @device: the device whose io range will be mapped
  93. * @index: index of the io range
  94. *
  95. * Returns a pointer to the mapped memory
  96. */
  97. extern void __iomem *of_iomap(struct device_node *device, int index);
  98. #endif /* __ASSEMBLY__ */
  99. #endif /* __KERNEL__ */
  100. #endif /* _ASM_MICROBLAZE_PROM_H */