raspberrypi-firmware.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright © 2015 Broadcom
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef __SOC_RASPBERRY_FIRMWARE_H__
  9. #define __SOC_RASPBERRY_FIRMWARE_H__
  10. #include <linux/types.h>
  11. #include <linux/of_device.h>
  12. struct rpi_firmware;
  13. enum rpi_firmware_property_status {
  14. RPI_FIRMWARE_STATUS_REQUEST = 0,
  15. RPI_FIRMWARE_STATUS_SUCCESS = 0x80000000,
  16. RPI_FIRMWARE_STATUS_ERROR = 0x80000001,
  17. };
  18. /**
  19. * struct rpi_firmware_property_tag_header - Firmware property tag header
  20. * @tag: One of enum_mbox_property_tag.
  21. * @buf_size: The number of bytes in the value buffer following this
  22. * struct.
  23. * @req_resp_size: On submit, the length of the request (though it doesn't
  24. * appear to be currently used by the firmware). On return,
  25. * the length of the response (always 4 byte aligned), with
  26. * the low bit set.
  27. */
  28. struct rpi_firmware_property_tag_header {
  29. u32 tag;
  30. u32 buf_size;
  31. u32 req_resp_size;
  32. };
  33. enum rpi_firmware_property_tag {
  34. RPI_FIRMWARE_PROPERTY_END = 0,
  35. RPI_FIRMWARE_GET_FIRMWARE_REVISION = 0x00000001,
  36. RPI_FIRMWARE_SET_CURSOR_INFO = 0x00008010,
  37. RPI_FIRMWARE_SET_CURSOR_STATE = 0x00008011,
  38. RPI_FIRMWARE_GET_BOARD_MODEL = 0x00010001,
  39. RPI_FIRMWARE_GET_BOARD_REVISION = 0x00010002,
  40. RPI_FIRMWARE_GET_BOARD_MAC_ADDRESS = 0x00010003,
  41. RPI_FIRMWARE_GET_BOARD_SERIAL = 0x00010004,
  42. RPI_FIRMWARE_GET_ARM_MEMORY = 0x00010005,
  43. RPI_FIRMWARE_GET_VC_MEMORY = 0x00010006,
  44. RPI_FIRMWARE_GET_CLOCKS = 0x00010007,
  45. RPI_FIRMWARE_GET_POWER_STATE = 0x00020001,
  46. RPI_FIRMWARE_GET_TIMING = 0x00020002,
  47. RPI_FIRMWARE_SET_POWER_STATE = 0x00028001,
  48. RPI_FIRMWARE_GET_CLOCK_STATE = 0x00030001,
  49. RPI_FIRMWARE_GET_CLOCK_RATE = 0x00030002,
  50. RPI_FIRMWARE_GET_VOLTAGE = 0x00030003,
  51. RPI_FIRMWARE_GET_MAX_CLOCK_RATE = 0x00030004,
  52. RPI_FIRMWARE_GET_MAX_VOLTAGE = 0x00030005,
  53. RPI_FIRMWARE_GET_TEMPERATURE = 0x00030006,
  54. RPI_FIRMWARE_GET_MIN_CLOCK_RATE = 0x00030007,
  55. RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008,
  56. RPI_FIRMWARE_GET_TURBO = 0x00030009,
  57. RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a,
  58. RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c,
  59. RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d,
  60. RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e,
  61. RPI_FIRMWARE_RELEASE_MEMORY = 0x0003000f,
  62. RPI_FIRMWARE_EXECUTE_CODE = 0x00030010,
  63. RPI_FIRMWARE_EXECUTE_QPU = 0x00030011,
  64. RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012,
  65. RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014,
  66. RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020,
  67. RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001,
  68. RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002,
  69. RPI_FIRMWARE_SET_VOLTAGE = 0x00038003,
  70. RPI_FIRMWARE_SET_TURBO = 0x00038009,
  71. /* Dispmanx TAGS */
  72. RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001,
  73. RPI_FIRMWARE_FRAMEBUFFER_BLANK = 0x00040002,
  74. RPI_FIRMWARE_FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003,
  75. RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004,
  76. RPI_FIRMWARE_FRAMEBUFFER_GET_DEPTH = 0x00040005,
  77. RPI_FIRMWARE_FRAMEBUFFER_GET_PIXEL_ORDER = 0x00040006,
  78. RPI_FIRMWARE_FRAMEBUFFER_GET_ALPHA_MODE = 0x00040007,
  79. RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH = 0x00040008,
  80. RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009,
  81. RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a,
  82. RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b,
  83. RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001,
  84. RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003,
  85. RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004,
  86. RPI_FIRMWARE_FRAMEBUFFER_TEST_DEPTH = 0x00044005,
  87. RPI_FIRMWARE_FRAMEBUFFER_TEST_PIXEL_ORDER = 0x00044006,
  88. RPI_FIRMWARE_FRAMEBUFFER_TEST_ALPHA_MODE = 0x00044007,
  89. RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009,
  90. RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a,
  91. RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b,
  92. RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003,
  93. RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004,
  94. RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005,
  95. RPI_FIRMWARE_FRAMEBUFFER_SET_PIXEL_ORDER = 0x00048006,
  96. RPI_FIRMWARE_FRAMEBUFFER_SET_ALPHA_MODE = 0x00048007,
  97. RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009,
  98. RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a,
  99. RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b,
  100. RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001,
  101. RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001,
  102. };
  103. int rpi_firmware_property(struct rpi_firmware *fw,
  104. u32 tag, void *data, size_t len);
  105. int rpi_firmware_property_list(struct rpi_firmware *fw,
  106. void *data, size_t tag_size);
  107. struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node);
  108. #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */