Commit 50405fa2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: base support for dynamic update of OF device, tree from Nathan Lynch

From: Anton Blanchard <anton@samba.org>

base support for dynamic update of OF device, tree from Nathan Lynch
parent 40a4a0aa
This diff is collapsed.
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/proc_fs.h>
#include <asm/atomic.h>
#define PTRRELOC(x) ((typeof(x))((unsigned long)(x) - offset)) #define PTRRELOC(x) ((typeof(x))((unsigned long)(x) - offset))
#define PTRUNRELOC(x) ((typeof(x))((unsigned long)(x) + offset)) #define PTRUNRELOC(x) ((typeof(x))((unsigned long)(x) + offset))
...@@ -144,8 +146,44 @@ struct device_node { ...@@ -144,8 +146,44 @@ struct device_node {
struct device_node *sibling; struct device_node *sibling;
struct device_node *next; /* next device of same type */ struct device_node *next; /* next device of same type */
struct device_node *allnext; /* next in list of all nodes */ struct device_node *allnext; /* next in list of all nodes */
struct proc_dir_entry *pde; /* this node's proc directory */
struct proc_dir_entry *name_link; /* name symlink */
struct proc_dir_entry *addr_link; /* addr symlink */
atomic_t _users; /* reference count */
unsigned long _flags;
}; };
/* flag descriptions */
#define OF_STALE 0 /* node is slated for deletion */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_IS_STALE(x) test_bit(OF_STALE, &x->_flags)
#define OF_MARK_STALE(x) set_bit(OF_STALE, &x->_flags)
#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
/*
* Until 32-bit ppc can add proc_dir_entries to its device_node
* definition, we cannot refer to pde, name_link, and addr_link
* in arch-independent code.
*/
#define HAVE_ARCH_DEVTREE_FIXUPS
static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
{
dn->pde = de;
}
static void inline set_node_name_link(struct device_node *dn, struct proc_dir_entry *de)
{
dn->name_link = de;
}
static void inline set_node_addr_link(struct device_node *dn, struct proc_dir_entry *de)
{
dn->addr_link = de;
}
typedef u32 prom_arg_t; typedef u32 prom_arg_t;
struct prom_args { struct prom_args {
...@@ -196,6 +234,10 @@ extern struct device_node *of_get_next_child(const struct device_node *node, ...@@ -196,6 +234,10 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
extern struct device_node *of_node_get(struct device_node *node); extern struct device_node *of_node_get(struct device_node *node);
extern void of_node_put(struct device_node *node); extern void of_node_put(struct device_node *node);
/* For updating the device tree at runtime */
extern int of_add_node(const char *path, struct property *proplist);
extern int of_remove_node(struct device_node *np);
/* Other Prototypes */ /* Other Prototypes */
extern void abort(void); extern void abort(void);
extern unsigned long prom_init(unsigned long, unsigned long, unsigned long, extern unsigned long prom_init(unsigned long, unsigned long, unsigned long,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment