Merge tag 'topic/core-stuff-2014-08-15' of git://anongit.freedesktop.org/drm-intel...
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / radeon / radeon_ucode.h
index 4e7c3269b183644ea87c4879d764eac7fb246e80..dc4576e4d8ad161e7a4d59866ac4be9b244ec5c7 100644 (file)
 #define HAWAII_SMC_UCODE_START       0x20000
 #define HAWAII_SMC_UCODE_SIZE        0x1FDEC
 
+struct common_firmware_header {
+       uint32_t size_bytes; /* size of the entire header+image(s) in bytes */
+       uint32_t header_size_bytes; /* size of just the header in bytes */
+       uint16_t header_version_major; /* header version */
+       uint16_t header_version_minor; /* header version */
+       uint16_t ip_version_major; /* IP version */
+       uint16_t ip_version_minor; /* IP version */
+       uint32_t ucode_version;
+       uint32_t ucode_size_bytes; /* size of ucode in bytes */
+       uint32_t ucode_array_offset_bytes; /* payload offset from the start of the header */
+       uint32_t crc32;  /* crc32 checksum of the payload */
+};
+
+/* version_major=1, version_minor=0 */
+struct mc_firmware_header_v1_0 {
+       struct common_firmware_header header;
+       uint32_t io_debug_size_bytes; /* size of debug array in dwords */
+       uint32_t io_debug_array_offset_bytes; /* payload offset from the start of the header */
+};
+
+/* version_major=1, version_minor=0 */
+struct smc_firmware_header_v1_0 {
+       struct common_firmware_header header;
+       uint32_t ucode_start_addr;
+};
+
+/* version_major=1, version_minor=0 */
+struct gfx_firmware_header_v1_0 {
+       struct common_firmware_header header;
+       uint32_t ucode_feature_version;
+       uint32_t jt_offset; /* jt location */
+       uint32_t jt_size;  /* size of jt */
+};
+
+/* version_major=1, version_minor=0 */
+struct rlc_firmware_header_v1_0 {
+       struct common_firmware_header header;
+       uint32_t ucode_feature_version;
+       uint32_t save_and_restore_offset;
+       uint32_t clear_state_descriptor_offset;
+       uint32_t avail_scratch_ram_locations;
+       uint32_t master_pkt_description_offset;
+};
+
+/* version_major=1, version_minor=0 */
+struct sdma_firmware_header_v1_0 {
+       struct common_firmware_header header;
+       uint32_t ucode_feature_version;
+       uint32_t ucode_change_version;
+       uint32_t jt_offset; /* jt location */
+       uint32_t jt_size; /* size of jt */
+};
+
+/* header is fixed size */
+union radeon_firmware_header {
+       struct common_firmware_header common;
+       struct mc_firmware_header_v1_0 mc;
+       struct smc_firmware_header_v1_0 smc;
+       struct gfx_firmware_header_v1_0 gfx;
+       struct rlc_firmware_header_v1_0 rlc;
+       struct sdma_firmware_header_v1_0 sdma;
+       uint8_t raw[0x100];
+};
+
+void radeon_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
+void radeon_ucode_print_smc_hdr(const struct common_firmware_header *hdr);
+void radeon_ucode_print_gfx_hdr(const struct common_firmware_header *hdr);
+void radeon_ucode_print_rlc_hdr(const struct common_firmware_header *hdr);
+void radeon_ucode_print_sdma_hdr(const struct common_firmware_header *hdr);
+int radeon_ucode_validate(const struct firmware *fw);
+
 #endif