Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC]: Add iomap interfaces.
  [OPENPROM]: Rewrite driver to use in-kernel device tree.
  [OPENPROMFS]: Rewrite using in-kernel device tree and seq_file.
  [SPARC]: Add unique device_node IDs and a ".node" property.
  [SPARC]: Add of_set_property() interface.
  [SPARC64]: Export auxio_register to modules.
  [SPARC64]: Add missing interfaces to dma-mapping.h
  [SPARC64]: Export _PAGE_IE to modules.
  [SPARC64]: Allow floppy driver to build modular.
  [SPARC]: Export x_bus_type to modules.
  [RIOWATCHDOG]: Fix the build.
  [CPWATCHDOG]: Fix the build.
  [PARPORT] sunbpp: Fix typo.
  [MTD] sun_uflash: Port to new EBUS device layer.
This commit is contained in:
Linus Torvalds 2006-06-26 10:08:32 -07:00
commit 8871e73fdb
20 changed files with 1081 additions and 1391 deletions

View File

@ -138,6 +138,7 @@ struct bus_type ebus_bus_type = {
.suspend = of_device_suspend,
.resume = of_device_resume,
};
EXPORT_SYMBOL(ebus_bus_type);
#endif
#ifdef CONFIG_SBUS
@ -149,6 +150,7 @@ struct bus_type sbus_bus_type = {
.suspend = of_device_suspend,
.resume = of_device_resume,
};
EXPORT_SYMBOL(sbus_bus_type);
#endif
static int __init of_bus_driver_init(void)

View File

@ -27,6 +27,11 @@
static struct device_node *allnodes;
/* use when traversing tree through the allnext, child, sibling,
* or parent members of struct device_node.
*/
static DEFINE_RWLOCK(devtree_lock);
int of_device_is_compatible(struct device_node *device, const char *compat)
{
const char* cp;
@ -185,6 +190,54 @@ int of_getintprop_default(struct device_node *np, const char *name, int def)
}
EXPORT_SYMBOL(of_getintprop_default);
int of_set_property(struct device_node *dp, const char *name, void *val, int len)
{
struct property **prevp;
void *new_val;
int err;
new_val = kmalloc(len, GFP_KERNEL);
if (!new_val)
return -ENOMEM;
memcpy(new_val, val, len);
err = -ENODEV;
write_lock(&devtree_lock);
prevp = &dp->properties;
while (*prevp) {
struct property *prop = *prevp;
if (!strcmp(prop->name, name)) {
void *old_val = prop->value;
int ret;
ret = prom_setprop(dp->node, name, val, len);
err = -EINVAL;
if (ret >= 0) {
prop->value = new_val;
prop->length = len;
if (OF_IS_DYNAMIC(prop))
kfree(old_val);
OF_MARK_DYNAMIC(prop);
err = 0;
}
break;
}
prevp = &(*prevp)->next;
}
write_unlock(&devtree_lock);
/* XXX Upate procfs if necessary... */
return err;
}
EXPORT_SYMBOL(of_set_property);
static unsigned int prom_early_allocated;
static void * __init prom_early_alloc(unsigned long size)
@ -354,7 +407,9 @@ static char * __init build_full_name(struct device_node *dp)
return n;
}
static struct property * __init build_one_prop(phandle node, char *prev)
static unsigned int unique_id;
static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
{
static struct property *tmp = NULL;
struct property *p;
@ -364,10 +419,17 @@ static struct property * __init build_one_prop(phandle node, char *prev)
p = tmp;
memset(p, 0, sizeof(*p) + 32);
tmp = NULL;
} else
} else {
p = prom_early_alloc(sizeof(struct property) + 32);
p->unique_id = unique_id++;
}
p->name = (char *) (p + 1);
if (special_name) {
p->length = special_len;
p->value = prom_early_alloc(special_len);
memcpy(p->value, special_val, special_len);
} else {
if (prev == NULL) {
prom_firstprop(node, p->name);
} else {
@ -381,8 +443,10 @@ static struct property * __init build_one_prop(phandle node, char *prev)
if (p->length <= 0) {
p->length = 0;
} else {
p->value = prom_early_alloc(p->length);
len = prom_getproperty(node, p->name, p->value, p->length);
p->value = prom_early_alloc(p->length + 1);
prom_getproperty(node, p->name, p->value, p->length);
((unsigned char *)p->value)[p->length] = '\0';
}
}
return p;
}
@ -391,9 +455,14 @@ static struct property * __init build_prop_list(phandle node)
{
struct property *head, *tail;
head = tail = build_one_prop(node, NULL);
head = tail = build_one_prop(node, NULL,
".node", &node, sizeof(node));
tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
tail = tail->next;
while(tail) {
tail->next = build_one_prop(node, tail->name);
tail->next = build_one_prop(node, tail->name,
NULL, NULL, 0);
tail = tail->next;
}
@ -422,6 +491,7 @@ static struct device_node * __init create_node(phandle node)
return NULL;
dp = prom_early_alloc(sizeof(*dp));
dp->unique_id = unique_id++;
kref_init(&dp->kref);

View File

@ -9,3 +9,5 @@ lib-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \
strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \
copy_user.o locks.o atomic.o atomic32.o bitops.o \
lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o
obj-y += iomap.o

48
arch/sparc/lib/iomap.c Normal file
View File

@ -0,0 +1,48 @@
/*
* Implement the sparc iomap interfaces
*/
#include <linux/pci.h>
#include <linux/module.h>
#include <asm/io.h>
/* Create a virtual mapping cookie for an IO port range */
void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
return (void __iomem *) (unsigned long) port;
}
void ioport_unmap(void __iomem *addr)
{
/* Nothing to do */
}
EXPORT_SYMBOL(ioport_map);
EXPORT_SYMBOL(ioport_unmap);
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
unsigned long start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
/* What? */
return NULL;
}
void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{
/* nothing to do */
}
EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap);

View File

@ -6,6 +6,7 @@
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/ioport.h>
@ -16,8 +17,8 @@
#include <asm/ebus.h>
#include <asm/auxio.h>
/* This cannot be static, as it is referenced in irq.c */
void __iomem *auxio_register = NULL;
EXPORT_SYMBOL(auxio_register);
enum auxio_type {
AUXIO_TYPE_NODEV,

View File

@ -563,67 +563,6 @@ void handler_irq(int irq, struct pt_regs *regs)
irq_exit();
}
#ifdef CONFIG_BLK_DEV_FD
extern irqreturn_t floppy_interrupt(int, void *, struct pt_regs *);
/* XXX No easy way to include asm/floppy.h XXX */
extern unsigned char *pdma_vaddr;
extern unsigned long pdma_size;
extern volatile int doing_pdma;
extern unsigned long fdc_status;
irqreturn_t sparc_floppy_irq(int irq, void *dev_cookie, struct pt_regs *regs)
{
if (likely(doing_pdma)) {
void __iomem *stat = (void __iomem *) fdc_status;
unsigned char *vaddr = pdma_vaddr;
unsigned long size = pdma_size;
u8 val;
while (size) {
val = readb(stat);
if (unlikely(!(val & 0x80))) {
pdma_vaddr = vaddr;
pdma_size = size;
return IRQ_HANDLED;
}
if (unlikely(!(val & 0x20))) {
pdma_vaddr = vaddr;
pdma_size = size;
doing_pdma = 0;
goto main_interrupt;
}
if (val & 0x40) {
/* read */
*vaddr++ = readb(stat + 1);
} else {
unsigned char data = *vaddr++;
/* write */
writeb(data, stat + 1);
}
size--;
}
pdma_vaddr = vaddr;
pdma_size = size;
/* Send Terminal Count pulse to floppy controller. */
val = readb(auxio_register);
val |= AUXIO_AUX1_FTCNT;
writeb(val, auxio_register);
val &= ~AUXIO_AUX1_FTCNT;
writeb(val, auxio_register);
doing_pdma = 0;
}
main_interrupt:
return floppy_interrupt(irq, dev_cookie, regs);
}
EXPORT_SYMBOL(sparc_floppy_irq);
#endif
struct sun5_timer {
u64 count0;
u64 limit0;

View File

@ -138,6 +138,7 @@ struct bus_type isa_bus_type = {
.suspend = of_device_suspend,
.resume = of_device_resume,
};
EXPORT_SYMBOL(isa_bus_type);
struct bus_type ebus_bus_type = {
.name = "ebus",
@ -147,6 +148,7 @@ struct bus_type ebus_bus_type = {
.suspend = of_device_suspend,
.resume = of_device_resume,
};
EXPORT_SYMBOL(ebus_bus_type);
#endif
#ifdef CONFIG_SBUS
@ -158,6 +160,7 @@ struct bus_type sbus_bus_type = {
.suspend = of_device_suspend,
.resume = of_device_resume,
};
EXPORT_SYMBOL(sbus_bus_type);
#endif
static int __init of_bus_driver_init(void)

View File

@ -27,6 +27,11 @@
static struct device_node *allnodes;
/* use when traversing tree through the allnext, child, sibling,
* or parent members of struct device_node.
*/
static DEFINE_RWLOCK(devtree_lock);
int of_device_is_compatible(struct device_node *device, const char *compat)
{
const char* cp;
@ -185,6 +190,54 @@ int of_getintprop_default(struct device_node *np, const char *name, int def)
}
EXPORT_SYMBOL(of_getintprop_default);
int of_set_property(struct device_node *dp, const char *name, void *val, int len)
{
struct property **prevp;
void *new_val;
int err;
new_val = kmalloc(len, GFP_KERNEL);
if (!new_val)
return -ENOMEM;
memcpy(new_val, val, len);
err = -ENODEV;
write_lock(&devtree_lock);
prevp = &dp->properties;
while (*prevp) {
struct property *prop = *prevp;
if (!strcmp(prop->name, name)) {
void *old_val = prop->value;
int ret;
ret = prom_setprop(dp->node, name, val, len);
err = -EINVAL;
if (ret >= 0) {
prop->value = new_val;
prop->length = len;
if (OF_IS_DYNAMIC(prop))
kfree(old_val);
OF_MARK_DYNAMIC(prop);
err = 0;
}
break;
}
prevp = &(*prevp)->next;
}
write_unlock(&devtree_lock);
/* XXX Upate procfs if necessary... */
return err;
}
EXPORT_SYMBOL(of_set_property);
static unsigned int prom_early_allocated;
static void * __init prom_early_alloc(unsigned long size)
@ -531,7 +584,9 @@ static char * __init build_full_name(struct device_node *dp)
return n;
}
static struct property * __init build_one_prop(phandle node, char *prev)
static unsigned int unique_id;
static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
{
static struct property *tmp = NULL;
struct property *p;
@ -540,10 +595,18 @@ static struct property * __init build_one_prop(phandle node, char *prev)
p = tmp;
memset(p, 0, sizeof(*p) + 32);
tmp = NULL;
} else
} else {
p = prom_early_alloc(sizeof(struct property) + 32);
p->unique_id = unique_id++;
}
p->name = (char *) (p + 1);
if (special_name) {
strcpy(p->name, special_name);
p->length = special_len;
p->value = prom_early_alloc(special_len);
memcpy(p->value, special_val, special_len);
} else {
if (prev == NULL) {
prom_firstprop(node, p->name);
} else {
@ -557,8 +620,10 @@ static struct property * __init build_one_prop(phandle node, char *prev)
if (p->length <= 0) {
p->length = 0;
} else {
p->value = prom_early_alloc(p->length);
p->value = prom_early_alloc(p->length + 1);
prom_getproperty(node, p->name, p->value, p->length);
((unsigned char *)p->value)[p->length] = '\0';
}
}
return p;
}
@ -567,9 +632,14 @@ static struct property * __init build_prop_list(phandle node)
{
struct property *head, *tail;
head = tail = build_one_prop(node, NULL);
head = tail = build_one_prop(node, NULL,
".node", &node, sizeof(node));
tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
tail = tail->next;
while(tail) {
tail->next = build_one_prop(node, tail->name);
tail->next = build_one_prop(node, tail->name,
NULL, NULL, 0);
tail = tail->next;
}
@ -598,6 +668,7 @@ static struct device_node * __init create_node(phandle node)
return NULL;
dp = prom_early_alloc(sizeof(*dp));
dp->unique_id = unique_id++;
kref_init(&dp->kref);

View File

@ -1568,6 +1568,7 @@ pgprot_t PAGE_EXEC __read_mostly;
unsigned long pg_iobits __read_mostly;
unsigned long _PAGE_IE __read_mostly;
EXPORT_SYMBOL(_PAGE_IE);
unsigned long _PAGE_E __read_mostly;
EXPORT_SYMBOL(_PAGE_E);

View File

@ -18,6 +18,7 @@
#include <linux/ioport.h>
#include <asm/ebus.h>
#include <asm/oplib.h>
#include <asm/prom.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@ -30,21 +31,17 @@
#define UFLASH_WINDOW_SIZE 0x200000
#define UFLASH_BUSWIDTH 1 /* EBus is 8-bit */
MODULE_AUTHOR
("Eric Brower <ebrower@usa.net>");
MODULE_DESCRIPTION
("User-programmable flash device on Sun Microsystems boardsets");
MODULE_SUPPORTED_DEVICE
("userflash");
MODULE_LICENSE
("GPL");
MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets");
MODULE_SUPPORTED_DEVICE("userflash");
MODULE_LICENSE("GPL");
MODULE_VERSION("2.0");
static LIST_HEAD(device_list);
struct uflash_dev {
char *name; /* device name */
struct map_info map; /* mtd map info */
struct mtd_info *mtd; /* mtd info */
struct list_head list;
};
@ -54,122 +51,120 @@ struct map_info uflash_map_templ = {
.bankwidth = UFLASH_BUSWIDTH,
};
int uflash_devinit(struct linux_ebus_device* edev)
int uflash_devinit(struct linux_ebus_device *edev, struct device_node *dp)
{
int iTmp, nregs;
struct linux_prom_registers regs[2];
struct uflash_dev *pdev;
struct uflash_dev *up;
struct resource *res;
iTmp = prom_getproperty(
edev->prom_node, "reg", (void *)regs, sizeof(regs));
if ((iTmp % sizeof(regs[0])) != 0) {
printk("%s: Strange reg property size %d\n",
UFLASH_DEVNAME, iTmp);
return -ENODEV;
}
res = &edev->resource[0];
nregs = iTmp / sizeof(regs[0]);
if (nregs != 1) {
if (edev->num_addrs != 1) {
/* Non-CFI userflash device-- once I find one we
* can work on supporting it.
*/
printk("%s: unsupported device at 0x%lx (%d regs): " \
"email ebrower@usa.net\n",
UFLASH_DEVNAME, edev->resource[0].start, nregs);
dp->full_name, res->start, edev->num_addrs);
return -ENODEV;
}
if(0 == (pdev = kmalloc(sizeof(struct uflash_dev), GFP_KERNEL))) {
printk("%s: unable to kmalloc new device\n", UFLASH_DEVNAME);
return(-ENOMEM);
}
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
if (!up)
return -ENOMEM;
/* copy defaults and tweak parameters */
memcpy(&pdev->map, &uflash_map_templ, sizeof(uflash_map_templ));
pdev->map.size = regs[0].reg_size;
memcpy(&up->map, &uflash_map_templ, sizeof(uflash_map_templ));
up->map.size = (res->end - res->start) + 1UL;
iTmp = prom_getproplen(edev->prom_node, "model");
pdev->name = kmalloc(iTmp, GFP_KERNEL);
prom_getstring(edev->prom_node, "model", pdev->name, iTmp);
if(0 != pdev->name && 0 < strlen(pdev->name)) {
pdev->map.name = pdev->name;
}
pdev->map.phys = edev->resource[0].start;
pdev->map.virt = ioremap_nocache(edev->resource[0].start, pdev->map.size);
if(0 == pdev->map.virt) {
printk("%s: failed to map device\n", __FUNCTION__);
kfree(pdev->name);
kfree(pdev);
return(-1);
up->name = of_get_property(dp, "model", NULL);
if (up->name && 0 < strlen(up->name))
up->map.name = up->name;
up->map.phys = res->start;
up->map.virt = ioremap_nocache(res->start, up->map.size);
if (!up->map.virt) {
printk("%s: Failed to map device.\n", dp->full_name);
kfree(up);
return -EINVAL;
}
simple_map_init(&pdev->map);
simple_map_init(&up->map);
/* MTD registration */
pdev->mtd = do_map_probe("cfi_probe", &pdev->map);
if(0 == pdev->mtd) {
iounmap(pdev->map.virt);
kfree(pdev->name);
kfree(pdev);
return(-ENXIO);
up->mtd = do_map_probe("cfi_probe", &up->map);
if (!up->mtd) {
iounmap(up->map.virt);
kfree(up);
return -ENXIO;
}
list_add(&pdev->list, &device_list);
up->mtd->owner = THIS_MODULE;
pdev->mtd->owner = THIS_MODULE;
add_mtd_device(up->mtd);
add_mtd_device(pdev->mtd);
return(0);
dev_set_drvdata(&edev->ofdev.dev, up);
return 0;
}
static int __devinit uflash_probe(struct of_device *dev, const struct of_device_id *match)
{
struct linux_ebus_device *edev = to_ebus_device(&dev->dev);
struct device_node *dp = dev->node;
if (of_find_property(dp, "user", NULL))
return -ENODEV;
return uflash_devinit(edev, dp);
}
static int __devexit uflash_remove(struct of_device *dev)
{
struct uflash_dev *up = dev_get_drvdata(&dev->dev);
if (up->mtd) {
del_mtd_device(up->mtd);
map_destroy(up->mtd);
}
if (up->map.virt) {
iounmap(up->map.virt);
up->map.virt = NULL;
}
kfree(up);
return 0;
}
static struct of_device_id uflash_match[] = {
{
.name = UFLASH_OBPNAME,
},
{},
};
MODULE_DEVICE_TABLE(of, uflash_match);
static struct of_platform_driver uflash_driver = {
.name = UFLASH_DEVNAME,
.match_table = uflash_match,
.probe = uflash_probe,
.remove = __devexit_p(uflash_remove),
};
static int __init uflash_init(void)
{
struct linux_ebus *ebus = NULL;
struct linux_ebus_device *edev = NULL;
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, UFLASH_OBPNAME)) {
if(0 > prom_getproplen(edev->prom_node, "user")) {
DEBUG(2, "%s: ignoring device at 0x%lx\n",
UFLASH_DEVNAME, edev->resource[0].start);
} else {
uflash_devinit(edev);
}
}
}
return of_register_driver(&uflash_driver, &ebus_bus_type);
}
if(list_empty(&device_list)) {
printk("%s: unable to locate device\n", UFLASH_DEVNAME);
return -ENODEV;
}
return(0);
}
static void __exit uflash_cleanup(void)
static void __exit uflash_exit(void)
{
struct list_head *udevlist;
struct uflash_dev *udev;
list_for_each(udevlist, &device_list) {
udev = list_entry(udevlist, struct uflash_dev, list);
DEBUG(2, "%s: removing device %s\n",
UFLASH_DEVNAME, udev->name);
if(0 != udev->mtd) {
del_mtd_device(udev->mtd);
map_destroy(udev->mtd);
}
if(0 != udev->map.virt) {
iounmap(udev->map.virt);
udev->map.virt = NULL;
}
kfree(udev->name);
kfree(udev);
}
of_unregister_driver(&uflash_driver);
}
module_init(uflash_init);
module_exit(uflash_cleanup);
module_exit(uflash_exit);

View File

@ -389,7 +389,7 @@ static struct of_device_id bpp_match[] = {
{},
};
MODULE_DEVICE_TABLE(of, qec_sbus_match);
MODULE_DEVICE_TABLE(of, bpp_match);
static struct of_platform_driver bpp_sbus_driver = {
.name = "bpp",

View File

@ -755,7 +755,7 @@ static int __init wd_init(void)
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, WD_OBPNAME))
if (!strcmp(edev->ofdev.node->name, WD_OBPNAME))
goto ebus_done;
}
}

View File

@ -29,8 +29,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define PROMLIB_INTERNAL
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
@ -39,10 +37,10 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/miscdevice.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <asm/oplib.h>
#include <asm/prom.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/openpromio.h>
@ -51,15 +49,20 @@
#include <asm/pbm.h>
#endif
MODULE_AUTHOR("Thomas K. Dyas (tdyas@noc.rutgers.edu) and Eddie C. Dost (ecd@skynet.be)");
MODULE_DESCRIPTION("OPENPROM Configuration Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("1.0");
/* Private data kept by the driver for each descriptor. */
typedef struct openprom_private_data
{
int current_node; /* Current node for SunOS ioctls. */
int lastnode; /* Last valid node used by BSD ioctls. */
struct device_node *current_node; /* Current node for SunOS ioctls. */
struct device_node *lastnode; /* Last valid node used by BSD ioctls. */
} DATA;
/* ID of the PROM node containing all of the EEPROM options. */
static int options_node = 0;
static struct device_node *options_node;
/*
* Copy an openpromio structure into kernel space from user space.
@ -87,9 +90,8 @@ static int copyin(struct openpromio __user *info, struct openpromio **opp_p)
if (bufsize > OPROMMAXPARAM)
bufsize = OPROMMAXPARAM;
if (!(*opp_p = kmalloc(sizeof(int) + bufsize + 1, GFP_KERNEL)))
if (!(*opp_p = kzalloc(sizeof(int) + bufsize + 1, GFP_KERNEL)))
return -ENOMEM;
memset(*opp_p, 0, sizeof(int) + bufsize + 1);
if (copy_from_user(&(*opp_p)->oprom_array,
&info->oprom_array, bufsize)) {
@ -107,10 +109,9 @@ static int getstrings(struct openpromio __user *info, struct openpromio **opp_p)
if (!info || !opp_p)
return -EFAULT;
if (!(*opp_p = kmalloc(sizeof(int) + OPROMMAXPARAM + 1, GFP_KERNEL)))
if (!(*opp_p = kzalloc(sizeof(int) + OPROMMAXPARAM + 1, GFP_KERNEL)))
return -ENOMEM;
memset(*opp_p, 0, sizeof(int) + OPROMMAXPARAM + 1);
(*opp_p)->oprom_size = 0;
n = bufsize = 0;
@ -140,16 +141,164 @@ static int copyout(void __user *info, struct openpromio *opp, int len)
return 0;
}
static int opromgetprop(void __user *argp, struct device_node *dp, struct openpromio *op, int bufsize)
{
void *pval;
int len;
pval = of_get_property(dp, op->oprom_array, &len);
if (!pval || len <= 0 || len > bufsize)
return copyout(argp, op, sizeof(int));
memcpy(op->oprom_array, pval, len);
op->oprom_array[len] = '\0';
op->oprom_size = len;
return copyout(argp, op, sizeof(int) + bufsize);
}
static int opromnxtprop(void __user *argp, struct device_node *dp, struct openpromio *op, int bufsize)
{
struct property *prop;
int len;
if (op->oprom_array[0] == '\0') {
prop = dp->properties;
if (!prop)
return copyout(argp, op, sizeof(int));
len = strlen(prop->name);
} else {
prop = of_find_property(dp, op->oprom_array, NULL);
if (!prop ||
!prop->next ||
(len = strlen(prop->next->name)) + 1 > bufsize)
return copyout(argp, op, sizeof(int));
prop = prop->next;
}
memcpy(op->oprom_array, prop->name, len);
op->oprom_array[len] = '\0';
op->oprom_size = ++len;
return copyout(argp, op, sizeof(int) + bufsize);
}
static int opromsetopt(struct device_node *dp, struct openpromio *op, int bufsize)
{
char *buf = op->oprom_array + strlen(op->oprom_array) + 1;
int len = op->oprom_array + bufsize - buf;
return of_set_property(options_node, op->oprom_array, buf, len);
}
static int opromnext(void __user *argp, unsigned int cmd, struct device_node *dp, struct openpromio *op, int bufsize, DATA *data)
{
phandle ph;
BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
if (bufsize < sizeof(phandle))
return -EINVAL;
ph = *((int *) op->oprom_array);
if (ph) {
dp = of_find_node_by_phandle(ph);
if (!dp)
return -EINVAL;
switch (cmd) {
case OPROMNEXT:
dp = dp->sibling;
break;
case OPROMCHILD:
dp = dp->child;
break;
case OPROMSETCUR:
default:
break;
};
} else {
/* Sibling of node zero is the root node. */
if (cmd != OPROMNEXT)
return -EINVAL;
dp = of_find_node_by_path("/");
}
ph = 0;
if (dp)
ph = dp->node;
data->current_node = dp;
*((int *) op->oprom_array) = ph;
op->oprom_size = sizeof(phandle);
return copyout(argp, op, bufsize + sizeof(int));
}
static int oprompci2node(void __user *argp, struct device_node *dp, struct openpromio *op, int bufsize, DATA *data)
{
int err = -EINVAL;
if (bufsize >= 2*sizeof(int)) {
#ifdef CONFIG_PCI
struct pci_dev *pdev;
struct pcidev_cookie *pcp;
pdev = pci_find_slot (((int *) op->oprom_array)[0],
((int *) op->oprom_array)[1]);
pcp = pdev->sysdata;
if (pcp != NULL) {
dp = pcp->prom_node;
data->current_node = dp;
*((int *)op->oprom_array) = dp->node;
op->oprom_size = sizeof(int);
err = copyout(argp, op, bufsize + sizeof(int));
}
#endif
}
return err;
}
static int oprompath2node(void __user *argp, struct device_node *dp, struct openpromio *op, int bufsize, DATA *data)
{
dp = of_find_node_by_path(op->oprom_array);
data->current_node = dp;
*((int *)op->oprom_array) = dp->node;
op->oprom_size = sizeof(int);
return copyout(argp, op, bufsize + sizeof(int));
}
static int opromgetbootargs(void __user *argp, struct openpromio *op, int bufsize)
{
char *buf = saved_command_line;
int len = strlen(buf);
if (len > bufsize)
return -EINVAL;
strcpy(op->oprom_array, buf);
op->oprom_size = len;
return copyout(argp, op, bufsize + sizeof(int));
}
/*
* SunOS and Solaris /dev/openprom ioctl calls.
*/
static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg, int node)
unsigned int cmd, unsigned long arg,
struct device_node *dp)
{
DATA *data = (DATA *) file->private_data;
char buffer[OPROMMAXPARAM+1], *buf;
DATA *data = file->private_data;
struct openpromio *opp;
int bufsize, len, error = 0;
int bufsize, error = 0;
static int cnt;
void __user *argp = (void __user *)arg;
@ -164,119 +313,35 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
switch (cmd) {
case OPROMGETOPT:
case OPROMGETPROP:
len = prom_getproplen(node, opp->oprom_array);
if (len <= 0 || len > bufsize) {
error = copyout(argp, opp, sizeof(int));
break;
}
len = prom_getproperty(node, opp->oprom_array, buffer, bufsize);
memcpy(opp->oprom_array, buffer, len);
opp->oprom_array[len] = '\0';
opp->oprom_size = len;
error = copyout(argp, opp, sizeof(int) + bufsize);
error = opromgetprop(argp, dp, opp, bufsize);
break;
case OPROMNXTOPT:
case OPROMNXTPROP:
buf = prom_nextprop(node, opp->oprom_array, buffer);
len = strlen(buf);
if (len == 0 || len + 1 > bufsize) {
error = copyout(argp, opp, sizeof(int));
break;
}
memcpy(opp->oprom_array, buf, len);
opp->oprom_array[len] = '\0';
opp->oprom_size = ++len;
error = copyout(argp, opp, sizeof(int) + bufsize);
error = opromnxtprop(argp, dp, opp, bufsize);
break;
case OPROMSETOPT:
case OPROMSETOPT2:
buf = opp->oprom_array + strlen(opp->oprom_array) + 1;
len = opp->oprom_array + bufsize - buf;
error = prom_setprop(options_node, opp->oprom_array,
buf, len);
if (error < 0)
error = -EINVAL;
error = opromsetopt(dp, opp, bufsize);
break;
case OPROMNEXT:
case OPROMCHILD:
case OPROMSETCUR:
if (bufsize < sizeof(int)) {
error = -EINVAL;
break;
}
node = *((int *) opp->oprom_array);
switch (cmd) {
case OPROMNEXT: node = __prom_getsibling(node); break;
case OPROMCHILD: node = __prom_getchild(node); break;
case OPROMSETCUR: break;
}
data->current_node = node;
*((int *)opp->oprom_array) = node;
opp->oprom_size = sizeof(int);
error = copyout(argp, opp, bufsize + sizeof(int));
error = opromnext(argp, cmd, dp, opp, bufsize, data);
break;
case OPROMPCI2NODE:
error = -EINVAL;
if (bufsize >= 2*sizeof(int)) {
#ifdef CONFIG_PCI
struct pci_dev *pdev;
struct pcidev_cookie *pcp;
pdev = pci_find_slot (((int *) opp->oprom_array)[0],
((int *) opp->oprom_array)[1]);
pcp = pdev->sysdata;
if (pcp != NULL) {
node = pcp->prom_node->node;
data->current_node = node;
*((int *)opp->oprom_array) = node;
opp->oprom_size = sizeof(int);
error = copyout(argp, opp, bufsize + sizeof(int));
}
#endif
}
error = oprompci2node(argp, dp, opp, bufsize, data);
break;
case OPROMPATH2NODE:
node = prom_finddevice(opp->oprom_array);
data->current_node = node;
*((int *)opp->oprom_array) = node;
opp->oprom_size = sizeof(int);
error = copyout(argp, opp, bufsize + sizeof(int));
error = oprompath2node(argp, dp, opp, bufsize, data);
break;
case OPROMGETBOOTARGS:
buf = saved_command_line;
len = strlen(buf);
if (len > bufsize) {
error = -EINVAL;
break;
}
strcpy(opp->oprom_array, buf);
opp->oprom_size = len;
error = copyout(argp, opp, bufsize + sizeof(int));
error = opromgetbootargs(argp, opp, bufsize);
break;
case OPROMU2P:
@ -297,25 +362,14 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
return error;
}
/* Return nonzero if a specific node is in the PROM device tree. */
static int intree(int root, int node)
static struct device_node *get_node(phandle n, DATA *data)
{
for (; root != 0; root = prom_getsibling(root))
if (root == node || intree(prom_getchild(root),node))
return 1;
return 0;
}
struct device_node *dp = of_find_node_by_phandle(n);
/* Return nonzero if a specific node is "valid". */
static int goodnode(int n, DATA *data)
{
if (n == data->lastnode || n == prom_root_node || n == options_node)
return 1;
if (n == 0 || n == -1 || !intree(prom_root_node,n))
return 0;
data->lastnode = n;
return 1;
if (dp)
data->lastnode = dp;
return dp;
}
/* Copy in a whole string from userspace into kernelspace. */
@ -345,162 +399,187 @@ static int copyin_string(char __user *user, size_t len, char **ptr)
/*
* NetBSD /dev/openprom ioctl calls.
*/
static int opiocget(void __user *argp, DATA *data)
{
struct opiocdesc op;
struct device_node *dp;
char *str;
void *pval;
int err, len;
if (copy_from_user(&op, argp, sizeof(op)))
return -EFAULT;
dp = get_node(op.op_nodeid, data);
err = copyin_string(op.op_name, op.op_namelen, &str);
if (err)
return err;
pval = of_get_property(dp, str, &len);
err = 0;
if (!pval || len > op.op_buflen) {
err = -EINVAL;
} else {
op.op_buflen = len;
if (copy_to_user(argp, &op, sizeof(op)) ||
copy_to_user(op.op_buf, pval, len))
err = -EFAULT;
}
kfree(str);
return err;
}
static int opiocnextprop(void __user *argp, DATA *data)
{
struct opiocdesc op;
struct device_node *dp;
struct property *prop;
char *str;
int err, len;
if (copy_from_user(&op, argp, sizeof(op)))
return -EFAULT;
dp = get_node(op.op_nodeid, data);
if (!dp)
return -EINVAL;
err = copyin_string(op.op_name, op.op_namelen, &str);
if (err)
return err;
if (str[0] == '\0') {
prop = dp->properties;
} else {
prop = of_find_property(dp, str, NULL);
if (prop)
prop = prop->next;
}
kfree(str);
if (!prop)
len = 0;
else
len = prop->length;
if (len > op.op_buflen)
len = op.op_buflen;
if (copy_to_user(argp, &op, sizeof(op)))
return -EFAULT;
if (len &&
copy_to_user(op.op_buf, prop->value, len))
return -EFAULT;
return 0;
}
static int opiocset(void __user *argp, DATA *data)
{
struct opiocdesc op;
struct device_node *dp;
char *str, *tmp;
int err;
if (copy_from_user(&op, argp, sizeof(op)))
return -EFAULT;
dp = get_node(op.op_nodeid, data);
if (!dp)
return -EINVAL;
err = copyin_string(op.op_name, op.op_namelen, &str);
if (err)
return err;
err = copyin_string(op.op_buf, op.op_buflen, &tmp);
if (err) {
kfree(str);
return err;
}
err = of_set_property(dp, str, tmp, op.op_buflen);
kfree(str);
kfree(tmp);
return err;
}
static int opiocgetnext(unsigned int cmd, void __user *argp)
{
struct device_node *dp;
phandle nd;
BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
if (copy_from_user(&nd, argp, sizeof(phandle)))
return -EFAULT;
if (nd == 0) {
if (cmd != OPIOCGETNEXT)
return -EINVAL;
dp = of_find_node_by_path("/");
} else {
dp = of_find_node_by_phandle(nd);
nd = 0;
if (dp) {
if (cmd == OPIOCGETNEXT)
dp = dp->sibling;
else
dp = dp->child;
}
}
if (dp)
nd = dp->node;
if (copy_to_user(argp, &nd, sizeof(phandle)))
return -EFAULT;
return 0;
}
static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg)
{
DATA *data = (DATA *) file->private_data;
void __user *argp = (void __user *)arg;
struct opiocdesc op;
int error, node, len;
char *str, *tmp;
char buffer[64];
static int cnt;
int err;
switch (cmd) {
case OPIOCGET:
if (copy_from_user(&op, argp, sizeof(op)))
return -EFAULT;
if (!goodnode(op.op_nodeid,data))
return -EINVAL;
error = copyin_string(op.op_name, op.op_namelen, &str);
if (error)
return error;
len = prom_getproplen(op.op_nodeid,str);
if (len > op.op_buflen) {
kfree(str);
return -ENOMEM;
}
op.op_buflen = len;
if (len <= 0) {
kfree(str);
/* Verified by the above copy_from_user */
if (__copy_to_user(argp, &op,
sizeof(op)))
return -EFAULT;
return 0;
}
tmp = kmalloc(len + 1, GFP_KERNEL);
if (!tmp) {
kfree(str);
return -ENOMEM;
}
cnt = prom_getproperty(op.op_nodeid, str, tmp, len);
if (cnt <= 0) {
error = -EINVAL;
} else {
tmp[len] = '\0';
if (__copy_to_user(argp, &op, sizeof(op)) != 0 ||
copy_to_user(op.op_buf, tmp, len) != 0)
error = -EFAULT;
}
kfree(tmp);
kfree(str);
return error;
err = opiocget(argp, data);
break;
case OPIOCNEXTPROP:
if (copy_from_user(&op, argp, sizeof(op)))
return -EFAULT;
if (!goodnode(op.op_nodeid,data))
return -EINVAL;
error = copyin_string(op.op_name, op.op_namelen, &str);
if (error)
return error;
tmp = prom_nextprop(op.op_nodeid,str,buffer);
if (tmp) {
len = strlen(tmp);
if (len > op.op_buflen)
len = op.op_buflen;
else
op.op_buflen = len;
} else {
len = op.op_buflen = 0;
}
if (!access_ok(VERIFY_WRITE, argp, sizeof(op))) {
kfree(str);
return -EFAULT;
}
if (!access_ok(VERIFY_WRITE, op.op_buf, len)) {
kfree(str);
return -EFAULT;
}
error = __copy_to_user(argp, &op, sizeof(op));
if (!error) error = __copy_to_user(op.op_buf, tmp, len);
kfree(str);
return error;
err = opiocnextprop(argp, data);
break;
case OPIOCSET:
if (copy_from_user(&op, argp, sizeof(op)))
return -EFAULT;
if (!goodnode(op.op_nodeid,data))
return -EINVAL;
error = copyin_string(op.op_name, op.op_namelen, &str);
if (error)
return error;
error = copyin_string(op.op_buf, op.op_buflen, &tmp);
if (error) {
kfree(str);
return error;
}
len = prom_setprop(op.op_nodeid,str,tmp,op.op_buflen+1);
if (len != op.op_buflen)
return -EINVAL;
kfree(str);
kfree(tmp);
return 0;
err = opiocset(argp, data);
break;
case OPIOCGETOPTNODE:
if (copy_to_user(argp, &options_node, sizeof(int)))
BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
if (copy_to_user(argp, &options_node->node, sizeof(phandle)))
return -EFAULT;
return 0;
case OPIOCGETNEXT:
case OPIOCGETCHILD:
if (copy_from_user(&node, argp, sizeof(int)))
return -EFAULT;
if (cmd == OPIOCGETNEXT)
node = __prom_getsibling(node);
else
node = __prom_getchild(node);
if (__copy_to_user(argp, &node, sizeof(int)))
return -EFAULT;
return 0;
err = opiocgetnext(cmd, argp);
break;
default:
if (cnt++ < 10)
printk(KERN_INFO "openprom_bsd_ioctl: cmd 0x%X\n", cmd);
return -EINVAL;
}
};
return err;
}
@ -511,7 +590,6 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg)
{
DATA *data = (DATA *) file->private_data;
static int cnt;
switch (cmd) {
case OPROMGETOPT:
@ -563,10 +641,8 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
return openprom_bsd_ioctl(inode,file,cmd,arg);
default:
if (cnt++ < 10)
printk("openprom_ioctl: cmd 0x%X, arg 0x%lX\n", cmd, arg);
return -EINVAL;
}
};
}
static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
@ -594,9 +670,7 @@ static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
case OPROMSETCUR:
case OPROMPCI2NODE:
case OPROMPATH2NODE:
lock_kernel();
rval = openprom_ioctl(file->f_dentry->d_inode, file, cmd, arg);
lock_kernel();
break;
}
@ -607,12 +681,12 @@ static int openprom_open(struct inode * inode, struct file * file)
{
DATA *data;
data = (DATA *) kmalloc(sizeof(DATA), GFP_KERNEL);
data = kmalloc(sizeof(DATA), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->current_node = prom_root_node;
data->lastnode = prom_root_node;
data->current_node = of_find_node_by_path("/");
data->lastnode = data->current_node;
file->private_data = (void *) data;
return 0;
@ -634,24 +708,30 @@ static struct file_operations openprom_fops = {
};
static struct miscdevice openprom_dev = {
SUN_OPENPROM_MINOR, "openprom", &openprom_fops
.minor = SUN_OPENPROM_MINOR,
.name = "openprom",
.fops = &openprom_fops,
};
static int __init openprom_init(void)
{
int error;
struct device_node *dp;
int err;
error = misc_register(&openprom_dev);
if (error) {
printk(KERN_ERR "openprom: unable to get misc minor\n");
return error;
err = misc_register(&openprom_dev);
if (err)
return err;
dp = of_find_node_by_path("/");
dp = dp->child;
while (dp) {
if (!strcmp(dp->name, "options"))
break;
dp = dp->sibling;
}
options_node = dp;
options_node = prom_getchild(prom_root_node);
options_node = prom_searchsiblings(options_node,"options");
if (options_node == 0 || options_node == -1) {
printk(KERN_ERR "openprom: unable to find options node\n");
if (!options_node) {
misc_deregister(&openprom_dev);
return -EIO;
}
@ -666,4 +746,3 @@ static void __exit openprom_cleanup(void)
module_init(openprom_init);
module_exit(openprom_cleanup);
MODULE_LICENSE("GPL");

View File

@ -211,7 +211,7 @@ static int __init riowd_bbc_init(void)
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, "bbc"))
if (!strcmp(edev->ofdev.node->name, "bbc"))
goto found_bbc;
}
}
@ -238,7 +238,7 @@ static int __init riowd_init(void)
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
if (!strcmp(edev->prom_name, RIOWD_NAME))
if (!strcmp(edev->ofdev.node->name, RIOWD_NAME))
goto ebus_done;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -249,6 +249,22 @@ extern void __iomem *ioremap(unsigned long offset, unsigned long size);
#define ioremap_nocache(X,Y) ioremap((X),(Y))
extern void iounmap(volatile void __iomem *addr);
#define ioread8(X) readb(X)
#define ioread16(X) readw(X)
#define ioread32(X) readl(X)
#define iowrite8(val,X) writeb(val,X)
#define iowrite16(val,X) writew(val,X)
#define iowrite32(val,X) writel(val,X)
/* Create a virtual mapping cookie for an IO port range */
extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
extern void ioport_unmap(void __iomem *);
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
/*
* Bus number may be in res->flags... somewhere.
*/

View File

@ -35,6 +35,8 @@ struct property {
int length;
void *value;
struct property *next;
unsigned long _flags;
unsigned int unique_id;
};
struct device_node {
@ -58,8 +60,15 @@ struct device_node {
struct kref kref;
unsigned long _flags;
void *data;
unsigned int unique_id;
};
/* flag descriptions */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
{
dn->pde = de;
@ -88,6 +97,7 @@ extern struct property *of_find_property(struct device_node *np,
extern int of_device_is_compatible(struct device_node *device, const char *);
extern void *of_get_property(struct device_node *node, const char *name,
int *lenp);
extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
extern int of_getintprop_default(struct device_node *np,
const char *name,
int def);

View File

@ -162,4 +162,47 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
#endif /* PCI */
/* Now for the API extensions over the pci_ one */
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
#define dma_is_consistent(d) (1)
static inline int
dma_get_cache_alignment(void)
{
/* no easy way to get cache size on all processors, so return
* the maximum possible, to be safe */
return (1 << INTERNODE_CACHE_SHIFT);
}
static inline void
dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
unsigned long offset, size_t size,
enum dma_data_direction direction)
{
/* just sync everything, that's all the pci API can do */
dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
}
static inline void
dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
unsigned long offset, size_t size,
enum dma_data_direction direction)
{
/* just sync everything, that's all the pci API can do */
dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
}
static inline void
dma_cache_sync(void *vaddr, size_t size,
enum dma_data_direction direction)
{
/* could define this in terms of the dma_cache ... operations,
* but if you get this on a platform, you should convert the platform
* to using the generic device DMA API */
BUG();
}
#endif /* _ASM_SPARC64_DMA_MAPPING_H */

View File

@ -208,7 +208,55 @@ static void sun_fd_enable_dma(void)
pdma_areasize = pdma_size;
}
extern irqreturn_t sparc_floppy_irq(int, void *, struct pt_regs *);
irqreturn_t sparc_floppy_irq(int irq, void *dev_cookie, struct pt_regs *regs)
{
if (likely(doing_pdma)) {
void __iomem *stat = (void __iomem *) fdc_status;
unsigned char *vaddr = pdma_vaddr;
unsigned long size = pdma_size;
u8 val;
while (size) {
val = readb(stat);
if (unlikely(!(val & 0x80))) {
pdma_vaddr = vaddr;
pdma_size = size;
return IRQ_HANDLED;
}
if (unlikely(!(val & 0x20))) {
pdma_vaddr = vaddr;
pdma_size = size;
doing_pdma = 0;
goto main_interrupt;
}
if (val & 0x40) {
/* read */
*vaddr++ = readb(stat + 1);
} else {
unsigned char data = *vaddr++;
/* write */
writeb(data, stat + 1);
}
size--;
}
pdma_vaddr = vaddr;
pdma_size = size;
/* Send Terminal Count pulse to floppy controller. */
val = readb(auxio_register);
val |= AUXIO_AUX1_FTCNT;
writeb(val, auxio_register);
val &= ~AUXIO_AUX1_FTCNT;
writeb(val, auxio_register);
doing_pdma = 0;
}
main_interrupt:
return floppy_interrupt(irq, dev_cookie, regs);
}
static int sun_fd_request_irq(void)
{

View File

@ -35,6 +35,8 @@ struct property {
int length;
void *value;
struct property *next;
unsigned long _flags;
unsigned int unique_id;
};
struct device_node {
@ -58,8 +60,15 @@ struct device_node {
struct kref kref;
unsigned long _flags;
void *data;
unsigned int unique_id;
};
/* flag descriptions */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
{
dn->pde = de;
@ -88,6 +97,7 @@ extern struct property *of_find_property(struct device_node *np,
extern int of_device_is_compatible(struct device_node *device, const char *);
extern void *of_get_property(struct device_node *node, const char *name,
int *lenp);
extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
extern int of_getintprop_default(struct device_node *np,
const char *name,
int def);