prom.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef _SPARC64_PROM_H
  2. #define _SPARC64_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 SPARC64 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 of_irq_controller;
  37. struct device_node {
  38. const char *name;
  39. const char *type;
  40. phandle node;
  41. char *path_component_name;
  42. char *full_name;
  43. struct property *properties;
  44. struct property *deadprops; /* removed properties */
  45. struct device_node *parent;
  46. struct device_node *child;
  47. struct device_node *sibling;
  48. struct device_node *next; /* next device of same type */
  49. struct device_node *allnext; /* next in list of all nodes */
  50. struct proc_dir_entry *pde; /* this node's proc directory */
  51. struct kref kref;
  52. unsigned long _flags;
  53. void *data;
  54. unsigned int unique_id;
  55. struct of_irq_controller *irq_trans;
  56. };
  57. struct of_irq_controller {
  58. unsigned int (*irq_build)(struct device_node *, unsigned int, void *);
  59. void *data;
  60. };
  61. #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
  62. #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
  63. extern struct device_node *of_find_node_by_cpuid(int cpuid);
  64. extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
  65. extern int of_getintprop_default(struct device_node *np,
  66. const char *name,
  67. int def);
  68. extern int of_find_in_proplist(const char *list, const char *match, int len);
  69. extern void prom_build_devicetree(void);
  70. /* Dummy ref counting routines - to be implemented later */
  71. static inline struct device_node *of_node_get(struct device_node *node)
  72. {
  73. return node;
  74. }
  75. static inline void of_node_put(struct device_node *node)
  76. {
  77. }
  78. /*
  79. * NB: This is here while we transition from using asm/prom.h
  80. * to linux/of.h
  81. */
  82. #include <linux/of.h>
  83. extern struct device_node *of_console_device;
  84. extern char *of_console_path;
  85. extern char *of_console_options;
  86. #endif /* __KERNEL__ */
  87. #endif /* _SPARC64_PROM_H */