prom.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #define of_node_cmp(s1, s2) strcmp((s1), (s2))
  26. typedef u32 phandle;
  27. typedef u32 ihandle;
  28. struct property {
  29. char *name;
  30. int length;
  31. void *value;
  32. struct property *next;
  33. unsigned long _flags;
  34. unsigned int unique_id;
  35. };
  36. struct device_node {
  37. const char *name;
  38. const char *type;
  39. phandle node;
  40. char *path_component_name;
  41. char *full_name;
  42. struct property *properties;
  43. struct property *deadprops; /* removed properties */
  44. struct device_node *parent;
  45. struct device_node *child;
  46. struct device_node *sibling;
  47. struct device_node *next; /* next device of same type */
  48. struct device_node *allnext; /* next in list of all nodes */
  49. struct proc_dir_entry *pde; /* this node's proc directory */
  50. struct kref kref;
  51. unsigned long _flags;
  52. void *data;
  53. unsigned int unique_id;
  54. };
  55. #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
  56. #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
  57. extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
  58. extern int of_getintprop_default(struct device_node *np,
  59. const char *name,
  60. int def);
  61. extern int of_find_in_proplist(const char *list, const char *match, int len);
  62. extern void prom_build_devicetree(void);
  63. /* Dummy ref counting routines - to be implemented later */
  64. static inline struct device_node *of_node_get(struct device_node *node)
  65. {
  66. return node;
  67. }
  68. static inline void of_node_put(struct device_node *node)
  69. {
  70. }
  71. /*
  72. * NB: This is here while we transition from using asm/prom.h
  73. * to linux/of.h
  74. */
  75. #include <linux/of.h>
  76. extern struct device_node *of_console_device;
  77. extern char *of_console_path;
  78. extern char *of_console_options;
  79. #endif /* __KERNEL__ */
  80. #endif /* _SPARC_PROM_H */