Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 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 | |
Grant Likely | 9d24c88 | 2009-10-15 10:57:44 -0600 | [diff] [blame] | 15 | #include <linux/of.h> /* linux/of.h gets to determine #include ordering */ |
| 16 | |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 17 | #ifndef _ASM_MICROBLAZE_PROM_H |
| 18 | #define _ASM_MICROBLAZE_PROM_H |
| 19 | #ifdef __KERNEL__ |
John Williams | 909964e | 2009-06-22 14:02:09 +1000 | [diff] [blame] | 20 | #ifndef __ASSEMBLY__ |
| 21 | |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 22 | #include <linux/types.h> |
Grant Likely | 6b884a8 | 2010-06-08 07:48:09 -0600 | [diff] [blame^] | 23 | #include <linux/of_address.h> |
Grant Likely | e387344 | 2010-06-18 11:09:59 -0600 | [diff] [blame] | 24 | #include <linux/of_irq.h> |
Grant Likely | d8678b5 | 2009-10-15 10:57:53 -0600 | [diff] [blame] | 25 | #include <linux/of_fdt.h> |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 26 | #include <linux/proc_fs.h> |
| 27 | #include <linux/platform_device.h> |
| 28 | #include <asm/irq.h> |
| 29 | #include <asm/atomic.h> |
| 30 | |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 31 | #define HAVE_ARCH_DEVTREE_FIXUPS |
| 32 | |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 33 | /* Other Prototypes */ |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 34 | extern int early_uartlite_console(void); |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 35 | |
Michal Simek | a6475c1 | 2010-01-18 15:27:10 +0100 | [diff] [blame] | 36 | #ifdef CONFIG_PCI |
| 37 | /* |
| 38 | * PCI <-> OF matching functions |
| 39 | * (XXX should these be here?) |
| 40 | */ |
| 41 | struct pci_bus; |
| 42 | struct pci_dev; |
| 43 | extern int pci_device_from_OF_node(struct device_node *node, |
| 44 | u8 *bus, u8 *devfn); |
| 45 | extern struct device_node *pci_busdev_to_OF_node(struct pci_bus *bus, |
| 46 | int devfn); |
| 47 | extern struct device_node *pci_device_to_OF_node(struct pci_dev *dev); |
| 48 | extern void pci_create_OF_bus_map(void); |
| 49 | #endif |
| 50 | |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 51 | /* |
| 52 | * OF address retreival & translation |
| 53 | */ |
| 54 | |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 55 | /* Translate an OF address block into a CPU physical address |
| 56 | */ |
| 57 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); |
| 58 | |
| 59 | /* Extract an address from a device, returns the region size and |
| 60 | * the address space flags too. The PCI version uses a BAR number |
| 61 | * instead of an absolute index |
| 62 | */ |
| 63 | extern const u32 *of_get_address(struct device_node *dev, int index, |
| 64 | u64 *size, unsigned int *flags); |
| 65 | extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, |
| 66 | u64 *size, unsigned int *flags); |
| 67 | |
| 68 | /* Get an address as a resource. Note that if your address is |
| 69 | * a PIO address, the conversion will fail if the physical address |
| 70 | * can't be internally converted to an IO token with |
| 71 | * pci_address_to_pio(), that is because it's either called to early |
| 72 | * or it can't be matched to any host bridge IO space |
| 73 | */ |
| 74 | extern int of_address_to_resource(struct device_node *dev, int index, |
| 75 | struct resource *r); |
| 76 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
| 77 | struct resource *r); |
| 78 | |
| 79 | /* Parse the ibm,dma-window property of an OF node into the busno, phys and |
| 80 | * size parameters. |
| 81 | */ |
| 82 | void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, |
| 83 | unsigned long *busno, unsigned long *phys, unsigned long *size); |
| 84 | |
| 85 | extern void kdump_move_device_tree(void); |
| 86 | |
| 87 | /* CPU OF node matching */ |
| 88 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); |
| 89 | |
| 90 | /* Get the MAC address */ |
| 91 | extern const void *of_get_mac_address(struct device_node *np); |
| 92 | |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 93 | /** |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 94 | * of_irq_map_pci - Resolve the interrupt for a PCI device |
| 95 | * @pdev: the device whose interrupt is to be resolved |
| 96 | * @out_irq: structure of_irq filled by this function |
| 97 | * |
| 98 | * This function resolves the PCI interrupt for a given PCI device. If a |
| 99 | * device-node exists for a given pci_dev, it will use normal OF tree |
| 100 | * walking. If not, it will implement standard swizzling and walk up the |
| 101 | * PCI tree until an device-node is found, at which point it will finish |
| 102 | * resolving using the OF tree walking. |
| 103 | */ |
| 104 | struct pci_dev; |
| 105 | extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); |
| 106 | |
John Williams | 909964e | 2009-06-22 14:02:09 +1000 | [diff] [blame] | 107 | #endif /* __ASSEMBLY__ */ |
Michal Simek | 12e8414 | 2009-03-27 14:25:12 +0100 | [diff] [blame] | 108 | #endif /* __KERNEL__ */ |
| 109 | #endif /* _ASM_MICROBLAZE_PROM_H */ |