of_device_common.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef _OF_DEVICE_COMMON_H
  2. #define _OF_DEVICE_COMMON_H
  3. static inline u64 of_read_addr(const u32 *cell, int size)
  4. {
  5. u64 r = 0;
  6. while (size--)
  7. r = (r << 32) | *(cell++);
  8. return r;
  9. }
  10. void of_bus_default_count_cells(struct device_node *dev, int *addrc,
  11. int *sizec);
  12. int of_out_of_range(const u32 *addr, const u32 *base,
  13. const u32 *size, int na, int ns);
  14. int of_bus_default_map(u32 *addr, const u32 *range, int na, int ns, int pna);
  15. unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags);
  16. int of_bus_sbus_match(struct device_node *np);
  17. void of_bus_sbus_count_cells(struct device_node *child, int *addrc, int *sizec);
  18. /* Max address size we deal with */
  19. #define OF_MAX_ADDR_CELLS 4
  20. struct of_bus {
  21. const char *name;
  22. const char *addr_prop_name;
  23. int (*match)(struct device_node *parent);
  24. void (*count_cells)(struct device_node *child,
  25. int *addrc, int *sizec);
  26. int (*map)(u32 *addr, const u32 *range,
  27. int na, int ns, int pna);
  28. unsigned long (*get_flags)(const u32 *addr, unsigned long);
  29. };
  30. #endif /* _OF_DEVICE_COMMON_H */