firmware.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics.
  3. * Kyungmin Park <kyungmin.park@samsung.com>
  4. * Tomasz Figa <t.figa@samsung.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARM_FIRMWARE_H
  11. #define __ASM_ARM_FIRMWARE_H
  12. #include <linux/bug.h>
  13. /*
  14. * struct firmware_ops
  15. *
  16. * A structure to specify available firmware operations.
  17. *
  18. * A filled up structure can be registered with register_firmware_ops().
  19. */
  20. struct firmware_ops {
  21. /*
  22. * Enters CPU idle mode
  23. */
  24. int (*do_idle)(void);
  25. /*
  26. * Sets boot address of specified physical CPU
  27. */
  28. int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr);
  29. /*
  30. * Boots specified physical CPU
  31. */
  32. int (*cpu_boot)(int cpu);
  33. /*
  34. * Initializes L2 cache
  35. */
  36. int (*l2x0_init)(void);
  37. };
  38. /* Global pointer for current firmware_ops structure, can't be NULL. */
  39. extern const struct firmware_ops *firmware_ops;
  40. /*
  41. * call_firmware_op(op, ...)
  42. *
  43. * Checks if firmware operation is present and calls it,
  44. * otherwise returns -ENOSYS
  45. */
  46. #define call_firmware_op(op, ...) \
  47. ((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : (-ENOSYS))
  48. /*
  49. * register_firmware_ops(ops)
  50. *
  51. * A function to register platform firmware_ops struct.
  52. */
  53. static inline void register_firmware_ops(const struct firmware_ops *ops)
  54. {
  55. BUG_ON(!ops);
  56. firmware_ops = ops;
  57. }
  58. #endif