prom.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef _SPARC_PROM_H
  2. #define _SPARC_PROM_H
  3. #ifdef __KERNEL__
  4. /*
  5. * Definitions for talking to the Open Firmware PROM on
  6. * Power Macintosh computers.
  7. *
  8. * Copyright (C) 1996-2005 Paul Mackerras.
  9. *
  10. * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
  11. * Updates for SPARC32 by David S. Miller
  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/proc_fs.h>
  20. #include <asm/atomic.h>
  21. #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2
  22. #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
  23. #define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l))
  24. #define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
  25. typedef u32 phandle;
  26. typedef u32 ihandle;
  27. struct property {
  28. char *name;
  29. int length;
  30. void *value;
  31. struct property *next;
  32. unsigned long _flags;
  33. unsigned int unique_id;
  34. };
  35. struct device_node {
  36. const char *name;
  37. const char *type;
  38. phandle node;
  39. char *path_component_name;
  40. char *full_name;
  41. struct property *properties;
  42. struct property *deadprops; /* removed properties */
  43. struct device_node *parent;
  44. struct device_node *child;
  45. struct device_node *sibling;
  46. struct device_node *next; /* next device of same type */
  47. struct device_node *allnext; /* next in list of all nodes */
  48. struct proc_dir_entry *pde; /* this node's proc directory */
  49. struct kref kref;
  50. unsigned long _flags;
  51. void *data;
  52. unsigned int unique_id;
  53. };
  54. #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
  55. #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
  56. extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
  57. extern int of_getintprop_default(struct device_node *np,
  58. const char *name,
  59. int def);
  60. extern void prom_build_devicetree(void);
  61. /* Dummy ref counting routines - to be implemented later */
  62. static inline struct device_node *of_node_get(struct device_node *node)
  63. {
  64. return node;
  65. }
  66. static inline void of_node_put(struct device_node *node)
  67. {
  68. }
  69. /*
  70. * NB: This is here while we transition from using asm/prom.h
  71. * to linux/of.h
  72. */
  73. #include <linux/of.h>
  74. #endif /* __KERNEL__ */
  75. #endif /* _SPARC_PROM_H */