Path: blob/master/drivers/gpu/drm/amd/include/discovery.h
26517 views
/*1* Copyright 2018 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*21*/2223#ifndef _DISCOVERY_H_24#define _DISCOVERY_H_2526#define PSP_HEADER_SIZE 25627#define BINARY_SIGNATURE 0x2821140728#define DISCOVERY_TABLE_SIGNATURE 0x5344504929#define GC_TABLE_ID 0x434730#define HARVEST_TABLE_SIGNATURE 0x5652414831#define VCN_INFO_TABLE_ID 0x004E435632#define MALL_INFO_TABLE_ID 0x4C4C414D33#define NPS_INFO_TABLE_ID 0x0053504E3435typedef enum {36IP_DISCOVERY = 0,37GC,38HARVEST_INFO,39VCN_INFO,40MALL_INFO,41NPS_INFO,42TOTAL_TABLES = 643} table;4445#pragma pack(1)4647typedef struct table_info48{49uint16_t offset; /* Byte offset */50uint16_t checksum; /* Byte sum of the table */51uint16_t size; /* Table size */52uint16_t padding;53} table_info;5455typedef struct binary_header56{57/* psp structure should go at the top of this structure */58uint32_t binary_signature; /* 0x7, 0x14, 0x21, 0x28 */59uint16_t version_major;60uint16_t version_minor;61uint16_t binary_checksum; /* Byte sum of the binary after this field */62uint16_t binary_size; /* Binary Size*/63table_info table_list[TOTAL_TABLES];64} binary_header;6566typedef struct die_info67{68uint16_t die_id;69uint16_t die_offset; /* Points to the corresponding die_header structure */70} die_info;717273typedef struct ip_discovery_header74{75uint32_t signature; /* Table Signature */76uint16_t version; /* Table Version */77uint16_t size; /* Table Size */78uint32_t id; /* Table ID */79uint16_t num_dies; /* Number of Dies */80die_info die_info[16]; /* list die information for up to 16 dies */81union {82uint16_t padding[1]; /* version <= 3 */83struct { /* version == 4 */84uint8_t base_addr_64_bit : 1; /* ip structures are using 64 bit base address */85uint8_t reserved : 7;86uint8_t reserved2;87};88};89} ip_discovery_header;9091typedef struct ip92{93uint16_t hw_id; /* Hardware ID */94uint8_t number_instance; /* instance of the IP */95uint8_t num_base_address; /* Number of Base Addresses */96uint8_t major; /* HCID Major */97uint8_t minor; /* HCID Minor */98uint8_t revision; /* HCID Revision */99#if defined(__BIG_ENDIAN)100uint8_t reserved : 4; /* Placeholder field */101uint8_t harvest : 4; /* Harvest */102#else103uint8_t harvest : 4; /* Harvest */104uint8_t reserved : 4; /* Placeholder field */105#endif106uint32_t base_address[]; /* variable number of Addresses */107} ip;108109typedef struct ip_v3110{111uint16_t hw_id; /* Hardware ID */112uint8_t instance_number; /* Instance number for the IP */113uint8_t num_base_address; /* Number of base addresses*/114uint8_t major; /* Hardware ID.major version */115uint8_t minor; /* Hardware ID.minor version */116uint8_t revision; /* Hardware ID.revision version */117#if defined(__BIG_ENDIAN)118uint8_t variant : 4; /* HW variant */119uint8_t sub_revision : 4; /* HCID Sub-Revision */120#else121uint8_t sub_revision : 4; /* HCID Sub-Revision */122uint8_t variant : 4; /* HW variant */123#endif124uint32_t base_address[]; /* Base Address list. Corresponds to the num_base_address field*/125} ip_v3;126127typedef struct ip_v4 {128uint16_t hw_id; /* Hardware ID */129uint8_t instance_number; /* Instance number for the IP */130uint8_t num_base_address; /* Number of base addresses*/131uint8_t major; /* Hardware ID.major version */132uint8_t minor; /* Hardware ID.minor version */133uint8_t revision; /* Hardware ID.revision version */134#if defined(LITTLEENDIAN_CPU)135uint8_t sub_revision : 4; /* HCID Sub-Revision */136uint8_t variant : 4; /* HW variant */137#elif defined(BIGENDIAN_CPU)138uint8_t variant : 4; /* HW variant */139uint8_t sub_revision : 4; /* HCID Sub-Revision */140#endif141union {142DECLARE_FLEX_ARRAY(uint32_t, base_address); /* 32-bit Base Address list. Corresponds to the num_base_address field*/143DECLARE_FLEX_ARRAY(uint64_t, base_address_64); /* 64-bit Base Address list. Corresponds to the num_base_address field*/144} __packed;145} ip_v4;146147typedef struct die_header148{149uint16_t die_id;150uint16_t num_ips;151} die_header;152153typedef struct ip_structure154{155ip_discovery_header* header;156struct die157{158die_header *die_header;159union160{161ip *ip_list;162ip_v3 *ip_v3_list;163ip_v4 *ip_v4_list;164}; /* IP list. Variable size*/165} die;166} ip_structure;167168struct gpu_info_header {169uint32_t table_id; /* table ID */170uint16_t version_major; /* table version */171uint16_t version_minor; /* table version */172uint32_t size; /* size of the entire header+data in bytes */173};174175struct gc_info_v1_0 {176struct gpu_info_header header;177178uint32_t gc_num_se;179uint32_t gc_num_wgp0_per_sa;180uint32_t gc_num_wgp1_per_sa;181uint32_t gc_num_rb_per_se;182uint32_t gc_num_gl2c;183uint32_t gc_num_gprs;184uint32_t gc_num_max_gs_thds;185uint32_t gc_gs_table_depth;186uint32_t gc_gsprim_buff_depth;187uint32_t gc_parameter_cache_depth;188uint32_t gc_double_offchip_lds_buffer;189uint32_t gc_wave_size;190uint32_t gc_max_waves_per_simd;191uint32_t gc_max_scratch_slots_per_cu;192uint32_t gc_lds_size;193uint32_t gc_num_sc_per_se;194uint32_t gc_num_sa_per_se;195uint32_t gc_num_packer_per_sc;196uint32_t gc_num_gl2a;197};198199struct gc_info_v1_1 {200struct gpu_info_header header;201202uint32_t gc_num_se;203uint32_t gc_num_wgp0_per_sa;204uint32_t gc_num_wgp1_per_sa;205uint32_t gc_num_rb_per_se;206uint32_t gc_num_gl2c;207uint32_t gc_num_gprs;208uint32_t gc_num_max_gs_thds;209uint32_t gc_gs_table_depth;210uint32_t gc_gsprim_buff_depth;211uint32_t gc_parameter_cache_depth;212uint32_t gc_double_offchip_lds_buffer;213uint32_t gc_wave_size;214uint32_t gc_max_waves_per_simd;215uint32_t gc_max_scratch_slots_per_cu;216uint32_t gc_lds_size;217uint32_t gc_num_sc_per_se;218uint32_t gc_num_sa_per_se;219uint32_t gc_num_packer_per_sc;220uint32_t gc_num_gl2a;221uint32_t gc_num_tcp_per_sa;222uint32_t gc_num_sdp_interface;223uint32_t gc_num_tcps;224};225226struct gc_info_v1_2 {227struct gpu_info_header header;228uint32_t gc_num_se;229uint32_t gc_num_wgp0_per_sa;230uint32_t gc_num_wgp1_per_sa;231uint32_t gc_num_rb_per_se;232uint32_t gc_num_gl2c;233uint32_t gc_num_gprs;234uint32_t gc_num_max_gs_thds;235uint32_t gc_gs_table_depth;236uint32_t gc_gsprim_buff_depth;237uint32_t gc_parameter_cache_depth;238uint32_t gc_double_offchip_lds_buffer;239uint32_t gc_wave_size;240uint32_t gc_max_waves_per_simd;241uint32_t gc_max_scratch_slots_per_cu;242uint32_t gc_lds_size;243uint32_t gc_num_sc_per_se;244uint32_t gc_num_sa_per_se;245uint32_t gc_num_packer_per_sc;246uint32_t gc_num_gl2a;247uint32_t gc_num_tcp_per_sa;248uint32_t gc_num_sdp_interface;249uint32_t gc_num_tcps;250uint32_t gc_num_tcp_per_wpg;251uint32_t gc_tcp_l1_size;252uint32_t gc_num_sqc_per_wgp;253uint32_t gc_l1_instruction_cache_size_per_sqc;254uint32_t gc_l1_data_cache_size_per_sqc;255uint32_t gc_gl1c_per_sa;256uint32_t gc_gl1c_size_per_instance;257uint32_t gc_gl2c_per_gpu;258};259260struct gc_info_v1_3 {261struct gpu_info_header header;262uint32_t gc_num_se;263uint32_t gc_num_wgp0_per_sa;264uint32_t gc_num_wgp1_per_sa;265uint32_t gc_num_rb_per_se;266uint32_t gc_num_gl2c;267uint32_t gc_num_gprs;268uint32_t gc_num_max_gs_thds;269uint32_t gc_gs_table_depth;270uint32_t gc_gsprim_buff_depth;271uint32_t gc_parameter_cache_depth;272uint32_t gc_double_offchip_lds_buffer;273uint32_t gc_wave_size;274uint32_t gc_max_waves_per_simd;275uint32_t gc_max_scratch_slots_per_cu;276uint32_t gc_lds_size;277uint32_t gc_num_sc_per_se;278uint32_t gc_num_sa_per_se;279uint32_t gc_num_packer_per_sc;280uint32_t gc_num_gl2a;281uint32_t gc_num_tcp_per_sa;282uint32_t gc_num_sdp_interface;283uint32_t gc_num_tcps;284uint32_t gc_num_tcp_per_wpg;285uint32_t gc_tcp_l1_size;286uint32_t gc_num_sqc_per_wgp;287uint32_t gc_l1_instruction_cache_size_per_sqc;288uint32_t gc_l1_data_cache_size_per_sqc;289uint32_t gc_gl1c_per_sa;290uint32_t gc_gl1c_size_per_instance;291uint32_t gc_gl2c_per_gpu;292uint32_t gc_tcp_size_per_cu;293uint32_t gc_tcp_cache_line_size;294uint32_t gc_instruction_cache_size_per_sqc;295uint32_t gc_instruction_cache_line_size;296uint32_t gc_scalar_data_cache_size_per_sqc;297uint32_t gc_scalar_data_cache_line_size;298uint32_t gc_tcc_size;299uint32_t gc_tcc_cache_line_size;300};301302struct gc_info_v2_0 {303struct gpu_info_header header;304305uint32_t gc_num_se;306uint32_t gc_num_cu_per_sh;307uint32_t gc_num_sh_per_se;308uint32_t gc_num_rb_per_se;309uint32_t gc_num_tccs;310uint32_t gc_num_gprs;311uint32_t gc_num_max_gs_thds;312uint32_t gc_gs_table_depth;313uint32_t gc_gsprim_buff_depth;314uint32_t gc_parameter_cache_depth;315uint32_t gc_double_offchip_lds_buffer;316uint32_t gc_wave_size;317uint32_t gc_max_waves_per_simd;318uint32_t gc_max_scratch_slots_per_cu;319uint32_t gc_lds_size;320uint32_t gc_num_sc_per_se;321uint32_t gc_num_packer_per_sc;322};323324struct gc_info_v2_1 {325struct gpu_info_header header;326327uint32_t gc_num_se;328uint32_t gc_num_cu_per_sh;329uint32_t gc_num_sh_per_se;330uint32_t gc_num_rb_per_se;331uint32_t gc_num_tccs;332uint32_t gc_num_gprs;333uint32_t gc_num_max_gs_thds;334uint32_t gc_gs_table_depth;335uint32_t gc_gsprim_buff_depth;336uint32_t gc_parameter_cache_depth;337uint32_t gc_double_offchip_lds_buffer;338uint32_t gc_wave_size;339uint32_t gc_max_waves_per_simd;340uint32_t gc_max_scratch_slots_per_cu;341uint32_t gc_lds_size;342uint32_t gc_num_sc_per_se;343uint32_t gc_num_packer_per_sc;344/* new for v2_1 */345uint32_t gc_num_tcp_per_sh;346uint32_t gc_tcp_size_per_cu;347uint32_t gc_num_sdp_interface;348uint32_t gc_num_cu_per_sqc;349uint32_t gc_instruction_cache_size_per_sqc;350uint32_t gc_scalar_data_cache_size_per_sqc;351uint32_t gc_tcc_size;352};353354typedef struct harvest_info_header {355uint32_t signature; /* Table Signature */356uint32_t version; /* Table Version */357} harvest_info_header;358359typedef struct harvest_info {360uint16_t hw_id; /* Hardware ID */361uint8_t number_instance; /* Instance of the IP */362uint8_t reserved; /* Reserved for alignment */363} harvest_info;364365typedef struct harvest_table {366harvest_info_header header;367harvest_info list[32];368} harvest_table;369370struct mall_info_header {371uint32_t table_id; /* table ID */372uint16_t version_major; /* table version */373uint16_t version_minor; /* table version */374uint32_t size_bytes; /* size of the entire header+data in bytes */375};376377struct mall_info_v1_0 {378struct mall_info_header header;379uint32_t mall_size_per_m;380uint32_t m_s_present;381uint32_t m_half_use;382uint32_t m_mall_config;383uint32_t reserved[5];384};385386struct mall_info_v2_0 {387struct mall_info_header header;388uint32_t mall_size_per_umc;389uint32_t reserved[8];390};391392#define VCN_INFO_TABLE_MAX_NUM_INSTANCES 4393394struct vcn_info_header {395uint32_t table_id; /* table ID */396uint16_t version_major; /* table version */397uint16_t version_minor; /* table version */398uint32_t size_bytes; /* size of the entire header+data in bytes */399};400401struct vcn_instance_info_v1_0402{403uint32_t instance_num; /* VCN IP instance number. 0 - VCN0; 1 - VCN1 etc*/404union _fuse_data {405struct {406uint32_t av1_disabled : 1;407uint32_t vp9_disabled : 1;408uint32_t hevc_disabled : 1;409uint32_t h264_disabled : 1;410uint32_t reserved : 28;411} bits;412uint32_t all_bits;413} fuse_data;414uint32_t reserved[2];415};416417struct vcn_info_v1_0 {418struct vcn_info_header header;419uint32_t num_of_instances; /* number of entries used in instance_info below*/420struct vcn_instance_info_v1_0 instance_info[VCN_INFO_TABLE_MAX_NUM_INSTANCES];421uint32_t reserved[4];422};423424#define NPS_INFO_TABLE_MAX_NUM_INSTANCES 12425426struct nps_info_header {427uint32_t table_id; /* table ID */428uint16_t version_major; /* table version */429uint16_t version_minor; /* table version */430uint32_t size_bytes; /* size of the entire header+data in bytes = 0x000000D4 (212) */431};432433struct nps_instance_info_v1_0 {434uint64_t base_address;435uint64_t limit_address;436};437438struct nps_info_v1_0 {439struct nps_info_header header;440uint32_t nps_type;441uint32_t count;442struct nps_instance_info_v1_0443instance_info[NPS_INFO_TABLE_MAX_NUM_INSTANCES];444};445446#pragma pack()447448#endif449450451