[615] | 1 | #ifndef _LINUX_OF_H
|
---|
| 2 | #define _LINUX_OF_H
|
---|
| 3 | /*
|
---|
| 4 | * Definitions for talking to the Open Firmware PROM on
|
---|
| 5 | * Power Macintosh and other computers.
|
---|
| 6 | *
|
---|
| 7 | * Copyright (C) 1996-2005 Paul Mackerras.
|
---|
| 8 | *
|
---|
| 9 | * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
|
---|
| 10 | * Updates for SPARC64 by David S. Miller
|
---|
| 11 | * Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp.
|
---|
| 12 | *
|
---|
| 13 | * This program is free software; you can redistribute it and/or
|
---|
| 14 | * modify it under the terms of the GNU General Public License
|
---|
| 15 | * as published by the Free Software Foundation; either version
|
---|
| 16 | * 2 of the License, or (at your option) any later version.
|
---|
| 17 | */
|
---|
| 18 | #include <linux/types.h>
|
---|
| 19 | #include <linux/bitops.h>
|
---|
| 20 | #include <linux/errno.h>
|
---|
| 21 | #include <linux/kobject.h>
|
---|
| 22 | #include <linux/mod_devicetable.h>
|
---|
| 23 | #include <linux/spinlock.h>
|
---|
| 24 | //#include <linux/topology.h>
|
---|
| 25 | #include <linux/notifier.h>
|
---|
| 26 | //#include <linux/property.h>
|
---|
| 27 | #include <linux/list.h>
|
---|
| 28 |
|
---|
| 29 |
|
---|
[772] | 30 | struct device_node {
|
---|
| 31 | const char *name;
|
---|
| 32 | // phandle phandle;
|
---|
| 33 | const char *full_name;
|
---|
| 34 | // struct fwnode_handle fwnode;
|
---|
| 35 |
|
---|
| 36 | struct property *properties;
|
---|
| 37 | struct property *deadprops; /* removed properties */
|
---|
| 38 | struct device_node *parent;
|
---|
| 39 | struct device_node *child;
|
---|
| 40 | struct device_node *sibling;
|
---|
| 41 | struct kobject kobj;
|
---|
| 42 | unsigned long _flags;
|
---|
| 43 | void *data;
|
---|
| 44 | };
|
---|
[615] | 45 | struct property {
|
---|
| 46 | char *name;
|
---|
| 47 | int length;
|
---|
| 48 | void *value;
|
---|
| 49 | struct property *next;
|
---|
| 50 | unsigned long _flags;
|
---|
| 51 | unsigned int unique_id;
|
---|
| 52 | // struct bin_attribute attr;
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | static inline struct property *of_find_property(const struct device_node *np,
|
---|
| 56 | const char *name,
|
---|
| 57 | int *lenp)
|
---|
| 58 | {
|
---|
| 59 | return NULL;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | /**
|
---|
| 63 | * of_property_read_bool - Findfrom a property
|
---|
| 64 | * @np: device node from which the property value is to be read.
|
---|
| 65 | * @propname: name of the property to be searched.
|
---|
| 66 | *
|
---|
| 67 | * Search for a property in a device node.
|
---|
| 68 | * Returns true if the property exists false otherwise.
|
---|
| 69 | */
|
---|
| 70 | static inline bool of_property_read_bool(const struct device_node *np,
|
---|
| 71 | const char *propname)
|
---|
| 72 | {
|
---|
| 73 | struct property *prop = of_find_property(np, propname, NULL);
|
---|
| 74 |
|
---|
| 75 | return prop ? true : false;
|
---|
| 76 | }
|
---|
[772] | 77 | extern void of_node_put(struct device_node *node);
|
---|
[615] | 78 |
|
---|
| 79 | #endif /* _LINUX_OF_H */
|
---|