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