[PATCH] Add CMSPAR to termbits.h for powerpc and alpha
[safe/jmp/linux-2.6] / include / asm-powerpc / prom.h
index 7587bf5..97ef1cd 100644 (file)
@@ -65,49 +65,11 @@ struct boot_param_header
 typedef u32 phandle;
 typedef u32 ihandle;
 
-struct address_range {
-       unsigned long space;
-       unsigned long address;
-       unsigned long size;
-};
-
 struct interrupt_info {
        int     line;
        int     sense;          /* +ve/-ve logic, edge or level, etc. */
 };
 
-struct pci_address {
-       u32 a_hi;
-       u32 a_mid;
-       u32 a_lo;
-};
-
-struct isa_address {
-       u32 a_hi;
-       u32 a_lo;
-};
-
-struct isa_range {
-       struct isa_address isa_addr;
-       struct pci_address pci_addr;
-       unsigned int size;
-};
-
-struct reg_property {
-       unsigned long address;
-       unsigned long size;
-};
-
-struct reg_property32 {
-       unsigned int address;
-       unsigned int size;
-};
-
-struct reg_property64 {
-       u64 address;
-       u64 size;
-};
-
 struct property {
        char    *name;
        int     length;
@@ -120,13 +82,12 @@ struct device_node {
        char    *type;
        phandle node;
        phandle linux_phandle;
-       int     n_addrs;
-       struct  address_range *addrs;
        int     n_intrs;
        struct  interrupt_info *intrs;
        char    *full_name;
 
        struct  property *properties;
+       struct  property *deadprops; /* removed properties */
        struct  device_node *parent;
        struct  device_node *child;
        struct  device_node *sibling;
@@ -165,8 +126,14 @@ extern struct device_node *find_all_nodes(void);
 /* New style node lookup */
 extern struct device_node *of_find_node_by_name(struct device_node *from,
        const char *name);
+#define for_each_node_by_name(dn, name) \
+       for (dn = of_find_node_by_name(NULL, name); dn; \
+            dn = of_find_node_by_name(dn, name))
 extern struct device_node *of_find_node_by_type(struct device_node *from,
        const char *type);
+#define for_each_node_by_type(dn, type) \
+       for (dn = of_find_node_by_type(NULL, type); dn; \
+            dn = of_find_node_by_type(dn, type))
 extern struct device_node *of_find_compatible_node(struct device_node *from,
        const char *type, const char *compat);
 extern struct device_node *of_find_node_by_path(const char *path);
@@ -175,16 +142,21 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev);
 extern struct device_node *of_get_parent(const struct device_node *node);
 extern struct device_node *of_get_next_child(const struct device_node *node,
                                             struct device_node *prev);
+extern struct property *of_find_property(struct device_node *np,
+                                        const char *name,
+                                        int *lenp);
 extern struct device_node *of_node_get(struct device_node *node);
 extern void of_node_put(struct device_node *node);
 
 /* For scanning the flat device-tree at boot time */
-int __init of_scan_flat_dt(int (*it)(unsigned long node,
-                                    const char *uname, int depth,
-                                    void *data),
-                          void *data);
-void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
-                                unsigned long *size);
+extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
+                                           const char *uname, int depth,
+                                           void *data),
+                                 void *data);
+extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
+                                       unsigned long *size);
+extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
+extern unsigned long __init of_get_flat_dt_root(void);
 
 /* For updating the device tree at runtime */
 extern void of_attach_node(struct device_node *);
@@ -203,7 +175,11 @@ extern int prom_n_addr_cells(struct device_node* np);
 extern int prom_n_size_cells(struct device_node* np);
 extern int prom_n_intr_cells(struct device_node* np);
 extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
-extern void prom_add_property(struct device_node* np, struct property* prop);
+extern int prom_add_property(struct device_node* np, struct property* prop);
+extern int prom_remove_property(struct device_node *np, struct property *prop);
+extern int prom_update_property(struct device_node *np,
+                               struct property *newprop,
+                               struct property *oldprop);
 
 #ifdef CONFIG_PPC32
 /*
@@ -223,5 +199,38 @@ extern struct resource *request_OF_resource(struct device_node* node,
                                int index, const char* name_postfix);
 extern int release_OF_resource(struct device_node* node, int index);
 
+
+/*
+ * OF address retreival & translation
+ */
+
+
+/* Translate an OF address block into a CPU physical address
+ */
+#define OF_BAD_ADDR    ((u64)-1)
+extern u64 of_translate_address(struct device_node *np, u32 *addr);
+
+/* Extract an address from a device, returns the region size and
+ * the address space flags too. The PCI version uses a BAR number
+ * instead of an absolute index
+ */
+extern u32 *of_get_address(struct device_node *dev, int index,
+                          u64 *size, unsigned int *flags);
+extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
+                              u64 *size, unsigned int *flags);
+
+/* Get an address as a resource. Note that if your address is
+ * a PIO address, the conversion will fail if the physical address
+ * can't be internally converted to an IO token with
+ * pci_address_to_pio(), that is because it's either called to early
+ * or it can't be matched to any host bridge IO space
+ */
+extern int of_address_to_resource(struct device_node *dev, int index,
+                                 struct resource *r);
+extern int of_pci_address_to_resource(struct device_node *dev, int bar,
+                                     struct resource *r);
+
+extern void kdump_move_device_tree(void);
+
 #endif /* __KERNEL__ */
 #endif /* _POWERPC_PROM_H */