Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 33bc227e4e48ddadcf2eacb381c19df338f0a6c8 140 lines 4.8 kB view raw
1/* 2 * Definitions for talking to the Open Firmware PROM on 3 * Power Macintosh computers. 4 * 5 * Copyright (C) 1996 Paul Mackerras. 6 */ 7#ifdef __KERNEL__ 8#ifndef _PPC_PROM_H 9#define _PPC_PROM_H 10 11#include <linux/config.h> 12#include <linux/types.h> 13 14typedef u32 phandle; 15typedef u32 ihandle; 16 17struct address_range { 18 unsigned int space; 19 unsigned int address; 20 unsigned int size; 21}; 22 23struct interrupt_info { 24 int line; 25 int sense; /* +ve/-ve logic, edge or level, etc. */ 26}; 27 28struct reg_property { 29 unsigned int address; 30 unsigned int size; 31}; 32 33struct property { 34 char *name; 35 int length; 36 unsigned char *value; 37 struct property *next; 38}; 39 40/* 41 * Note: don't change this structure for now or you'll break BootX ! 42 */ 43struct device_node { 44 char *name; 45 char *type; 46 phandle node; 47 int n_addrs; 48 struct address_range *addrs; 49 int n_intrs; 50 struct interrupt_info *intrs; 51 char *full_name; 52 struct property *properties; 53 struct device_node *parent; 54 struct device_node *child; 55 struct device_node *sibling; 56 struct device_node *next; /* next device of same type */ 57 struct device_node *allnext; /* next in list of all nodes */ 58}; 59 60struct prom_args; 61typedef void (*prom_entry)(struct prom_args *); 62 63/* OBSOLETE: Old style node lookup */ 64extern struct device_node *find_devices(const char *name); 65extern struct device_node *find_type_devices(const char *type); 66extern struct device_node *find_path_device(const char *path); 67extern struct device_node *find_compatible_devices(const char *type, 68 const char *compat); 69extern struct device_node *find_all_nodes(void); 70 71/* New style node lookup */ 72extern struct device_node *of_find_node_by_name(struct device_node *from, 73 const char *name); 74extern struct device_node *of_find_node_by_type(struct device_node *from, 75 const char *type); 76extern struct device_node *of_find_compatible_node(struct device_node *from, 77 const char *type, const char *compat); 78extern struct device_node *of_find_node_by_path(const char *path); 79extern struct device_node *of_find_all_nodes(struct device_node *prev); 80extern struct device_node *of_get_parent(const struct device_node *node); 81extern struct device_node *of_get_next_child(const struct device_node *node, 82 struct device_node *prev); 83extern struct device_node *of_node_get(struct device_node *node); 84extern void of_node_put(struct device_node *node); 85 86/* Other Prototypes */ 87extern void abort(void); 88extern unsigned long prom_init(int, int, prom_entry); 89extern void prom_print(const char *msg); 90extern void relocate_nodes(void); 91extern void finish_device_tree(void); 92extern int device_is_compatible(struct device_node *device, const char *); 93extern int machine_is_compatible(const char *compat); 94extern unsigned char *get_property(struct device_node *node, const char *name, 95 int *lenp); 96extern int prom_add_property(struct device_node* np, struct property* prop); 97extern void prom_get_irq_senses(unsigned char *, int, int); 98extern int prom_n_addr_cells(struct device_node* np); 99extern int prom_n_size_cells(struct device_node* np); 100 101extern struct resource* 102request_OF_resource(struct device_node* node, int index, const char* name_postfix); 103extern int release_OF_resource(struct device_node* node, int index); 104 105extern void print_properties(struct device_node *node); 106extern int call_rtas(const char *service, int nargs, int nret, 107 unsigned long *outputs, ...); 108 109/* 110 * PCI <-> OF matching functions 111 */ 112struct pci_bus; 113struct pci_dev; 114extern int pci_device_from_OF_node(struct device_node *node, 115 u8* bus, u8* devfn); 116extern struct device_node* pci_busdev_to_OF_node(struct pci_bus *, int); 117extern struct device_node* pci_device_to_OF_node(struct pci_dev *); 118extern void pci_create_OF_bus_map(void); 119 120/* 121 * When we call back to the Open Firmware client interface, we usually 122 * have to do that before the kernel is relocated to its final location 123 * (this is because we can't use OF after we have overwritten the 124 * exception vectors with our exception handlers). These macros assist 125 * in performing the address calculations that we need to do to access 126 * data when the kernel is running at an address that is different from 127 * the address that the kernel is linked at. The reloc_offset() function 128 * returns the difference between these two addresses and the macros 129 * simplify the process of adding or subtracting this offset to/from 130 * pointer values. See arch/ppc/kernel/prom.c for how these are used. 131 */ 132extern unsigned long reloc_offset(void); 133extern unsigned long add_reloc_offset(unsigned long); 134extern unsigned long sub_reloc_offset(unsigned long); 135 136#define PTRRELOC(x) ((typeof(x))add_reloc_offset((unsigned long)(x))) 137#define PTRUNRELOC(x) ((typeof(x))sub_reloc_offset((unsigned long)(x))) 138 139#endif /* _PPC_PROM_H */ 140#endif /* __KERNEL__ */