drm/amdgpu: rework IP block registration (v2)
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 13 Oct 2016 21:41:13 +0000 (17:41 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Oct 2016 18:38:45 +0000 (14:38 -0400)
This makes it easier to replace specific IP blocks on
asics for handling virtual_dce, DAL, etc. and for building
IP lists for hw or tables.  This also stored the status
information in the same structure.

v2: split out spelling fix into a separate patch
    add a function to add IPs to the list

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
69 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/ci_dpm.c
drivers/gpu/drm/amd/amdgpu/cik.c
drivers/gpu/drm/amd/amdgpu/cik.h
drivers/gpu/drm/amd/amdgpu/cik_ih.c
drivers/gpu/drm/amd/amdgpu/cik_ih.h
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
drivers/gpu/drm/amd/amdgpu/cik_sdma.h
drivers/gpu/drm/amd/amdgpu/cz_dpm.c
drivers/gpu/drm/amd/amdgpu/cz_ih.c
drivers/gpu/drm/amd/amdgpu/cz_ih.h
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
drivers/gpu/drm/amd/amdgpu/dce_v6_0.h
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
drivers/gpu/drm/amd/amdgpu/dce_virtual.h
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.h
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.h
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.h
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.h
drivers/gpu/drm/amd/amdgpu/iceland_ih.c
drivers/gpu/drm/amd/amdgpu/iceland_ih.h
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.h
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.h
drivers/gpu/drm/amd/amdgpu/si.c
drivers/gpu/drm/amd/amdgpu/si.h
drivers/gpu/drm/amd/amdgpu/si_dma.c
drivers/gpu/drm/amd/amdgpu/si_dma.h
drivers/gpu/drm/amd/amdgpu/si_dpm.c
drivers/gpu/drm/amd/amdgpu/si_ih.c
drivers/gpu/drm/amd/amdgpu/si_ih.h
drivers/gpu/drm/amd/amdgpu/tonga_ih.c
drivers/gpu/drm/amd/amdgpu/tonga_ih.h
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.h
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.h
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.h
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
drivers/gpu/drm/amd/amdgpu/vce_v2_0.h
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
drivers/gpu/drm/amd/amdgpu/vce_v3_0.h
drivers/gpu/drm/amd/amdgpu/vi.c
drivers/gpu/drm/amd/amdgpu/vi.h

index e6f86b83652b03f95b2eacff864bd728dafb678f..1800ea139c98761fad93b3e7ebe1d625e55b41b1 100644 (file)
@@ -195,21 +195,38 @@ int amdgpu_wait_for_idle(struct amdgpu_device *adev,
 bool amdgpu_is_idle(struct amdgpu_device *adev,
                    enum amd_ip_block_type block_type);
 
+#define AMDGPU_MAX_IP_NUM 16
+
+struct amdgpu_ip_block_status {
+       bool valid;
+       bool sw;
+       bool hw;
+       bool late_initialized;
+       bool hang;
+};
+
 struct amdgpu_ip_block_version {
-       enum amd_ip_block_type type;
-       u32 major;
-       u32 minor;
-       u32 rev;
+       const enum amd_ip_block_type type;
+       const u32 major;
+       const u32 minor;
+       const u32 rev;
        const struct amd_ip_funcs *funcs;
 };
 
+struct amdgpu_ip_block {
+       struct amdgpu_ip_block_status status;
+       const struct amdgpu_ip_block_version *version;
+};
+
 int amdgpu_ip_block_version_cmp(struct amdgpu_device *adev,
                                enum amd_ip_block_type type,
                                u32 major, u32 minor);
 
-const struct amdgpu_ip_block_version * amdgpu_get_ip_block(
-                                       struct amdgpu_device *adev,
-                                       enum amd_ip_block_type type);
+struct amdgpu_ip_block * amdgpu_get_ip_block(struct amdgpu_device *adev,
+                                            enum amd_ip_block_type type);
+
+int amdgpu_ip_block_add(struct amdgpu_device *adev,
+                       const struct amdgpu_ip_block_version *ip_block_version);
 
 /* provided by hw blocks that can move/clear data.  e.g., gfx or sdma */
 struct amdgpu_buffer_funcs {
@@ -1271,14 +1288,6 @@ typedef void (*amdgpu_wreg_t)(struct amdgpu_device*, uint32_t, uint32_t);
 typedef uint32_t (*amdgpu_block_rreg_t)(struct amdgpu_device*, uint32_t, uint32_t);
 typedef void (*amdgpu_block_wreg_t)(struct amdgpu_device*, uint32_t, uint32_t, uint32_t);
 
-struct amdgpu_ip_block_status {
-       bool valid;
-       bool sw;
-       bool hw;
-       bool late_initialized;
-       bool hang;
-};
-
 struct amdgpu_device {
        struct device                   *dev;
        struct drm_device               *ddev;
@@ -1434,9 +1443,8 @@ struct amdgpu_device {
        /* GDS */
        struct amdgpu_gds               gds;
 
-       const struct amdgpu_ip_block_version *ip_blocks;
+       struct amdgpu_ip_block          ip_blocks[AMDGPU_MAX_IP_NUM];
        int                             num_ip_blocks;
-       struct amdgpu_ip_block_status   *ip_block_status;
        struct mutex    mn_lock;
        DECLARE_HASHTABLE(mn_hash, 7);
 
index 892d60fb225b56b25d7a44edec959ab56f45ed90..2f9f96cc9f65bad601cd11b970b976d170146d95 100644 (file)
@@ -265,14 +265,14 @@ static int acp_hw_init(void *handle)
 
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       const struct amdgpu_ip_block_version *ip_version =
+       const struct amdgpu_ip_block *ip_block =
                amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_ACP);
 
-       if (!ip_version)
+       if (!ip_block)
                return -EINVAL;
 
        r = amd_acp_hw_init(adev->acp.cgs_device,
-                           ip_version->major, ip_version->minor);
+                           ip_block->version->major, ip_block->version->minor);
        /* -ENODEV means board uses AZ rather than ACP */
        if (r == -ENODEV)
                return 0;
@@ -456,7 +456,7 @@ static int acp_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs acp_ip_funcs = {
+static const struct amd_ip_funcs acp_ip_funcs = {
        .name = "acp_ip",
        .early_init = acp_early_init,
        .late_init = NULL,
@@ -472,3 +472,12 @@ const struct amd_ip_funcs acp_ip_funcs = {
        .set_clockgating_state = acp_set_clockgating_state,
        .set_powergating_state = acp_set_powergating_state,
 };
+
+const struct amdgpu_ip_block_version acp_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_ACP,
+       .major = 2,
+       .minor = 2,
+       .rev = 0,
+       .funcs = &acp_ip_funcs,
+};
index 8a396313c86f8fc7b8a2bc2c7617a167f401e201..a288ce25c176528a792bb1b751453a27bddc486b 100644 (file)
@@ -37,6 +37,6 @@ struct amdgpu_acp {
        struct acp_pm_domain *acp_genpd;
 };
 
-extern const struct amd_ip_funcs acp_ip_funcs;
+extern const struct amdgpu_ip_block_version acp_ip_block;
 
 #endif /* __AMDGPU_ACP_H__ */
index 34049d67a0d82a3d40047a912bde9597c36fa3b1..017556ca22e6c23cb26a5c66a78e78802eb6a300 100644 (file)
@@ -626,11 +626,11 @@ static int amdgpu_cgs_set_clockgating_state(struct cgs_device *cgs_device,
        int i, r = -1;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
 
-               if (adev->ip_blocks[i].type == block_type) {
-                       r = adev->ip_blocks[i].funcs->set_clockgating_state(
+               if (adev->ip_blocks[i].version->type == block_type) {
+                       r = adev->ip_blocks[i].version->funcs->set_clockgating_state(
                                                                (void *)adev,
                                                                        state);
                        break;
@@ -647,11 +647,11 @@ static int amdgpu_cgs_set_powergating_state(struct cgs_device *cgs_device,
        int i, r = -1;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
 
-               if (adev->ip_blocks[i].type == block_type) {
-                       r = adev->ip_blocks[i].funcs->set_powergating_state(
+               if (adev->ip_blocks[i].version->type == block_type) {
+                       r = adev->ip_blocks[i].version->funcs->set_powergating_state(
                                                                (void *)adev,
                                                                        state);
                        break;
index afeb7ab16d09b456564aac1ee15c90b49c336be1..27a729c70c295663401ebd0cbd1b3fe493baba76 100644 (file)
@@ -1133,11 +1133,11 @@ int amdgpu_set_clockgating_state(struct amdgpu_device *adev,
        int i, r = 0;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_blocks[i].type == block_type) {
-                       r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
-                                                                           state);
+               if (adev->ip_blocks[i].version->type == block_type) {
+                       r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
+                                                                                    state);
                        if (r)
                                return r;
                        break;
@@ -1153,11 +1153,11 @@ int amdgpu_set_powergating_state(struct amdgpu_device *adev,
        int i, r = 0;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_blocks[i].type == block_type) {
-                       r = adev->ip_blocks[i].funcs->set_powergating_state((void *)adev,
-                                                                           state);
+               if (adev->ip_blocks[i].version->type == block_type) {
+                       r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                    state);
                        if (r)
                                return r;
                        break;
@@ -1172,10 +1172,10 @@ int amdgpu_wait_for_idle(struct amdgpu_device *adev,
        int i, r;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_blocks[i].type == block_type) {
-                       r = adev->ip_blocks[i].funcs->wait_for_idle((void *)adev);
+               if (adev->ip_blocks[i].version->type == block_type) {
+                       r = adev->ip_blocks[i].version->funcs->wait_for_idle((void *)adev);
                        if (r)
                                return r;
                        break;
@@ -1191,23 +1191,22 @@ bool amdgpu_is_idle(struct amdgpu_device *adev,
        int i;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_blocks[i].type == block_type)
-                       return adev->ip_blocks[i].funcs->is_idle((void *)adev);
+               if (adev->ip_blocks[i].version->type == block_type)
+                       return adev->ip_blocks[i].version->funcs->is_idle((void *)adev);
        }
        return true;
 
 }
 
-const struct amdgpu_ip_block_version * amdgpu_get_ip_block(
-                                       struct amdgpu_device *adev,
-                                       enum amd_ip_block_type type)
+struct amdgpu_ip_block * amdgpu_get_ip_block(struct amdgpu_device *adev,
+                                            enum amd_ip_block_type type)
 {
        int i;
 
        for (i = 0; i < adev->num_ip_blocks; i++)
-               if (adev->ip_blocks[i].type == type)
+               if (adev->ip_blocks[i].version->type == type)
                        return &adev->ip_blocks[i];
 
        return NULL;
@@ -1228,17 +1227,36 @@ int amdgpu_ip_block_version_cmp(struct amdgpu_device *adev,
                                enum amd_ip_block_type type,
                                u32 major, u32 minor)
 {
-       const struct amdgpu_ip_block_version *ip_block;
-       ip_block = amdgpu_get_ip_block(adev, type);
+       struct amdgpu_ip_block *ip_block = amdgpu_get_ip_block(adev, type);
 
-       if (ip_block && ((ip_block->major > major) ||
-                       ((ip_block->major == major) &&
-                       (ip_block->minor >= minor))))
+       if (ip_block && ((ip_block->version->major > major) ||
+                       ((ip_block->version->major == major) &&
+                       (ip_block->version->minor >= minor))))
                return 0;
 
        return 1;
 }
 
+/**
+ * amdgpu_ip_block_add
+ *
+ * @adev: amdgpu_device pointer
+ * @ip_block_version: pointer to the IP to add
+ *
+ * Adds the IP block driver information to the collection of IPs
+ * on the asic.
+ */
+int amdgpu_ip_block_add(struct amdgpu_device *adev,
+                       const struct amdgpu_ip_block_version *ip_block_version)
+{
+       if (!ip_block_version)
+               return -EINVAL;
+
+       adev->ip_blocks[adev->num_ip_blocks++].version = ip_block_version;
+
+       return 0;
+}
+
 static void amdgpu_device_enable_virtual_display(struct amdgpu_device *adev)
 {
        adev->enable_virtual_display = false;
@@ -1339,33 +1357,24 @@ static int amdgpu_early_init(struct amdgpu_device *adev)
                return -EINVAL;
        }
 
-       adev->ip_block_status = kcalloc(adev->num_ip_blocks,
-                                       sizeof(struct amdgpu_ip_block_status), GFP_KERNEL);
-       if (adev->ip_block_status == NULL)
-               return -ENOMEM;
-
-       if (adev->ip_blocks == NULL) {
-               DRM_ERROR("No IP blocks found!\n");
-               return r;
-       }
-
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if ((amdgpu_ip_block_mask & (1 << i)) == 0) {
                        DRM_ERROR("disabled ip block: %d\n", i);
-                       adev->ip_block_status[i].valid = false;
+                       adev->ip_blocks[i].status.valid = false;
                } else {
-                       if (adev->ip_blocks[i].funcs->early_init) {
-                               r = adev->ip_blocks[i].funcs->early_init((void *)adev);
+                       if (adev->ip_blocks[i].version->funcs->early_init) {
+                               r = adev->ip_blocks[i].version->funcs->early_init((void *)adev);
                                if (r == -ENOENT) {
-                                       adev->ip_block_status[i].valid = false;
+                                       adev->ip_blocks[i].status.valid = false;
                                } else if (r) {
-                                       DRM_ERROR("early_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                                       DRM_ERROR("early_init of IP block <%s> failed %d\n",
+                                                 adev->ip_blocks[i].version->funcs->name, r);
                                        return r;
                                } else {
-                                       adev->ip_block_status[i].valid = true;
+                                       adev->ip_blocks[i].status.valid = true;
                                }
                        } else {
-                               adev->ip_block_status[i].valid = true;
+                               adev->ip_blocks[i].status.valid = true;
                        }
                }
        }
@@ -1381,22 +1390,23 @@ static int amdgpu_init(struct amdgpu_device *adev)
        int i, r;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               r = adev->ip_blocks[i].funcs->sw_init((void *)adev);
+               r = adev->ip_blocks[i].version->funcs->sw_init((void *)adev);
                if (r) {
-                       DRM_ERROR("sw_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                       DRM_ERROR("sw_init of IP block <%s> failed %d\n",
+                                 adev->ip_blocks[i].version->funcs->name, r);
                        return r;
                }
-               adev->ip_block_status[i].sw = true;
+               adev->ip_blocks[i].status.sw = true;
                /* need to do gmc hw init early so we can allocate gpu mem */
-               if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) {
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
                        r = amdgpu_vram_scratch_init(adev);
                        if (r) {
                                DRM_ERROR("amdgpu_vram_scratch_init failed %d\n", r);
                                return r;
                        }
-                       r = adev->ip_blocks[i].funcs->hw_init((void *)adev);
+                       r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
                        if (r) {
                                DRM_ERROR("hw_init %d failed %d\n", i, r);
                                return r;
@@ -1406,22 +1416,23 @@ static int amdgpu_init(struct amdgpu_device *adev)
                                DRM_ERROR("amdgpu_wb_init failed %d\n", r);
                                return r;
                        }
-                       adev->ip_block_status[i].hw = true;
+                       adev->ip_blocks[i].status.hw = true;
                }
        }
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].sw)
+               if (!adev->ip_blocks[i].status.sw)
                        continue;
                /* gmc hw init is done early */
-               if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC)
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC)
                        continue;
-               r = adev->ip_blocks[i].funcs->hw_init((void *)adev);
+               r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
                if (r) {
-                       DRM_ERROR("hw_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                       DRM_ERROR("hw_init of IP block <%s> failed %d\n",
+                                 adev->ip_blocks[i].version->funcs->name, r);
                        return r;
                }
-               adev->ip_block_status[i].hw = true;
+               adev->ip_blocks[i].status.hw = true;
        }
 
        return 0;
@@ -1432,25 +1443,26 @@ static int amdgpu_late_init(struct amdgpu_device *adev)
        int i = 0, r;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_blocks[i].funcs->late_init) {
-                       r = adev->ip_blocks[i].funcs->late_init((void *)adev);
+               if (adev->ip_blocks[i].version->funcs->late_init) {
+                       r = adev->ip_blocks[i].version->funcs->late_init((void *)adev);
                        if (r) {
-                               DRM_ERROR("late_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                               DRM_ERROR("late_init of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
                                return r;
                        }
-                       adev->ip_block_status[i].late_initialized = true;
+                       adev->ip_blocks[i].status.late_initialized = true;
                }
                /* skip CG for VCE/UVD, it's handled specially */
-               if (adev->ip_blocks[i].type != AMD_IP_BLOCK_TYPE_UVD &&
-                   adev->ip_blocks[i].type != AMD_IP_BLOCK_TYPE_VCE) {
+               if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
+                   adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) {
                        /* enable clockgating to save power */
-                       r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
-                                                                           AMD_CG_STATE_GATE);
+                       r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
+                                                                                    AMD_CG_STATE_GATE);
                        if (r) {
                                DRM_ERROR("set_clockgating_state(gate) of IP block <%s> failed %d\n",
-                                         adev->ip_blocks[i].funcs->name, r);
+                                         adev->ip_blocks[i].version->funcs->name, r);
                                return r;
                        }
                }
@@ -1465,68 +1477,71 @@ static int amdgpu_fini(struct amdgpu_device *adev)
 
        /* need to disable SMC first */
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].hw)
+               if (!adev->ip_blocks[i].status.hw)
                        continue;
-               if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_SMC) {
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
                        /* ungate blocks before hw fini so that we can shutdown the blocks safely */
-                       r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
-                                                                           AMD_CG_STATE_UNGATE);
+                       r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
+                                                                                    AMD_CG_STATE_UNGATE);
                        if (r) {
                                DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n",
-                                         adev->ip_blocks[i].funcs->name, r);
+                                         adev->ip_blocks[i].version->funcs->name, r);
                                return r;
                        }
-                       r = adev->ip_blocks[i].funcs->hw_fini((void *)adev);
+                       r = adev->ip_blocks[i].version->funcs->hw_fini((void *)adev);
                        /* XXX handle errors */
                        if (r) {
                                DRM_DEBUG("hw_fini of IP block <%s> failed %d\n",
-                                         adev->ip_blocks[i].funcs->name, r);
+                                         adev->ip_blocks[i].version->funcs->name, r);
                        }
-                       adev->ip_block_status[i].hw = false;
+                       adev->ip_blocks[i].status.hw = false;
                        break;
                }
        }
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
-               if (!adev->ip_block_status[i].hw)
+               if (!adev->ip_blocks[i].status.hw)
                        continue;
-               if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) {
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
                        amdgpu_wb_fini(adev);
                        amdgpu_vram_scratch_fini(adev);
                }
                /* ungate blocks before hw fini so that we can shutdown the blocks safely */
-               r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
-                                                                   AMD_CG_STATE_UNGATE);
+               r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
+                                                                            AMD_CG_STATE_UNGATE);
                if (r) {
-                       DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                       DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n",
+                                 adev->ip_blocks[i].version->funcs->name, r);
                        return r;
                }
-               r = adev->ip_blocks[i].funcs->hw_fini((void *)adev);
+               r = adev->ip_blocks[i].version->funcs->hw_fini((void *)adev);
                /* XXX handle errors */
                if (r) {
-                       DRM_DEBUG("hw_fini of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                       DRM_DEBUG("hw_fini of IP block <%s> failed %d\n",
+                                 adev->ip_blocks[i].version->funcs->name, r);
                }
-               adev->ip_block_status[i].hw = false;
+               adev->ip_blocks[i].status.hw = false;
        }
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
-               if (!adev->ip_block_status[i].sw)
+               if (!adev->ip_blocks[i].status.sw)
                        continue;
-               r = adev->ip_blocks[i].funcs->sw_fini((void *)adev);
+               r = adev->ip_blocks[i].version->funcs->sw_fini((void *)adev);
                /* XXX handle errors */
                if (r) {
-                       DRM_DEBUG("sw_fini of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                       DRM_DEBUG("sw_fini of IP block <%s> failed %d\n",
+                                 adev->ip_blocks[i].version->funcs->name, r);
                }
-               adev->ip_block_status[i].sw = false;
-               adev->ip_block_status[i].valid = false;
+               adev->ip_blocks[i].status.sw = false;
+               adev->ip_blocks[i].status.valid = false;
        }
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
-               if (!adev->ip_block_status[i].late_initialized)
+               if (!adev->ip_blocks[i].status.late_initialized)
                        continue;
-               if (adev->ip_blocks[i].funcs->late_fini)
-                       adev->ip_blocks[i].funcs->late_fini((void *)adev);
-               adev->ip_block_status[i].late_initialized = false;
+               if (adev->ip_blocks[i].version->funcs->late_fini)
+                       adev->ip_blocks[i].version->funcs->late_fini((void *)adev);
+               adev->ip_blocks[i].status.late_initialized = false;
        }
 
        return 0;
@@ -1544,21 +1559,23 @@ static int amdgpu_suspend(struct amdgpu_device *adev)
        }
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
                /* ungate blocks so that suspend can properly shut them down */
                if (i != AMD_IP_BLOCK_TYPE_SMC) {
-                       r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev,
-                                                                           AMD_CG_STATE_UNGATE);
+                       r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
+                                                                                    AMD_CG_STATE_UNGATE);
                        if (r) {
-                               DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                               DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
                        }
                }
                /* XXX handle errors */
-               r = adev->ip_blocks[i].funcs->suspend(adev);
+               r = adev->ip_blocks[i].version->funcs->suspend(adev);
                /* XXX handle errors */
                if (r) {
-                       DRM_ERROR("suspend of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                       DRM_ERROR("suspend of IP block <%s> failed %d\n",
+                                 adev->ip_blocks[i].version->funcs->name, r);
                }
        }
 
@@ -1570,11 +1587,12 @@ static int amdgpu_resume(struct amdgpu_device *adev)
        int i, r;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               r = adev->ip_blocks[i].funcs->resume(adev);
+               r = adev->ip_blocks[i].version->funcs->resume(adev);
                if (r) {
-                       DRM_ERROR("resume of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
+                       DRM_ERROR("resume of IP block <%s> failed %d\n",
+                                 adev->ip_blocks[i].version->funcs->name, r);
                        return r;
                }
        }
@@ -1885,8 +1903,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        amdgpu_fence_driver_fini(adev);
        amdgpu_fbdev_fini(adev);
        r = amdgpu_fini(adev);
-       kfree(adev->ip_block_status);
-       adev->ip_block_status = NULL;
        adev->accel_working = false;
        /* free i2c buses */
        amdgpu_i2c_fini(adev);
@@ -2125,13 +2141,13 @@ static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
        bool asic_hang = false;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_blocks[i].funcs->check_soft_reset)
-                       adev->ip_block_status[i].hang =
-                               adev->ip_blocks[i].funcs->check_soft_reset(adev);
-               if (adev->ip_block_status[i].hang) {
-                       DRM_INFO("IP block:%d is hang!\n", i);
+               if (adev->ip_blocks[i].version->funcs->check_soft_reset)
+                       adev->ip_blocks[i].status.hang =
+                               adev->ip_blocks[i].version->funcs->check_soft_reset(adev);
+               if (adev->ip_blocks[i].status.hang) {
+                       DRM_INFO("IP block:%s is hung!\n", adev->ip_blocks[i].version->funcs->name);
                        asic_hang = true;
                }
        }
@@ -2143,11 +2159,11 @@ static int amdgpu_pre_soft_reset(struct amdgpu_device *adev)
        int i, r = 0;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_block_status[i].hang &&
-                   adev->ip_blocks[i].funcs->pre_soft_reset) {
-                       r = adev->ip_blocks[i].funcs->pre_soft_reset(adev);
+               if (adev->ip_blocks[i].status.hang &&
+                   adev->ip_blocks[i].version->funcs->pre_soft_reset) {
+                       r = adev->ip_blocks[i].version->funcs->pre_soft_reset(adev);
                        if (r)
                                return r;
                }
@@ -2161,13 +2177,13 @@ static bool amdgpu_need_full_reset(struct amdgpu_device *adev)
        int i;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if ((adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) ||
-                   (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_SMC) ||
-                   (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_ACP) ||
-                   (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_DCE)) {
-                       if (adev->ip_block_status[i].hang) {
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) ||
+                   (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) ||
+                   (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) ||
+                   (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_DCE)) {
+                       if (adev->ip_blocks[i].status.hang) {
                                DRM_INFO("Some block need full reset!\n");
                                return true;
                        }
@@ -2181,11 +2197,11 @@ static int amdgpu_soft_reset(struct amdgpu_device *adev)
        int i, r = 0;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_block_status[i].hang &&
-                   adev->ip_blocks[i].funcs->soft_reset) {
-                       r = adev->ip_blocks[i].funcs->soft_reset(adev);
+               if (adev->ip_blocks[i].status.hang &&
+                   adev->ip_blocks[i].version->funcs->soft_reset) {
+                       r = adev->ip_blocks[i].version->funcs->soft_reset(adev);
                        if (r)
                                return r;
                }
@@ -2199,11 +2215,11 @@ static int amdgpu_post_soft_reset(struct amdgpu_device *adev)
        int i, r = 0;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_block_status[i].valid)
+               if (!adev->ip_blocks[i].status.valid)
                        continue;
-               if (adev->ip_block_status[i].hang &&
-                   adev->ip_blocks[i].funcs->post_soft_reset)
-                       r = adev->ip_blocks[i].funcs->post_soft_reset(adev);
+               if (adev->ip_blocks[i].status.hang &&
+                   adev->ip_blocks[i].version->funcs->post_soft_reset)
+                       r = adev->ip_blocks[i].version->funcs->post_soft_reset(adev);
                if (r)
                        return r;
        }
index 3570124ed1866041530118b4286b58481f4040c2..d17424663fe2e420cebf2062eacb9144f93621e3 100644 (file)
@@ -306,10 +306,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                }
 
                for (i = 0; i < adev->num_ip_blocks; i++) {
-                       if (adev->ip_blocks[i].type == type &&
-                           adev->ip_block_status[i].valid) {
-                               ip.hw_ip_version_major = adev->ip_blocks[i].major;
-                               ip.hw_ip_version_minor = adev->ip_blocks[i].minor;
+                       if (adev->ip_blocks[i].version->type == type &&
+                           adev->ip_blocks[i].status.valid) {
+                               ip.hw_ip_version_major = adev->ip_blocks[i].version->major;
+                               ip.hw_ip_version_minor = adev->ip_blocks[i].version->minor;
                                ip.capabilities_flags = 0;
                                ip.available_rings = ring_mask;
                                ip.ib_start_alignment = ib_start_alignment;
@@ -345,8 +345,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                }
 
                for (i = 0; i < adev->num_ip_blocks; i++)
-                       if (adev->ip_blocks[i].type == type &&
-                           adev->ip_block_status[i].valid &&
+                       if (adev->ip_blocks[i].version->type == type &&
+                           adev->ip_blocks[i].status.valid &&
                            count < AMDGPU_HW_IP_INSTANCE_MAX_COUNT)
                                count++;
 
index 7532ff822aa753496ef85971a2fef15db9b28832..fa6baf31a35ddae9d45e3b7be9fbd86ef22cc15e 100644 (file)
@@ -299,7 +299,7 @@ static int amdgpu_pp_soft_reset(void *handle)
        return ret;
 }
 
-const struct amd_ip_funcs amdgpu_pp_ip_funcs = {
+static const struct amd_ip_funcs amdgpu_pp_ip_funcs = {
        .name = "amdgpu_powerplay",
        .early_init = amdgpu_pp_early_init,
        .late_init = amdgpu_pp_late_init,
@@ -316,3 +316,12 @@ const struct amd_ip_funcs amdgpu_pp_ip_funcs = {
        .set_clockgating_state = amdgpu_pp_set_clockgating_state,
        .set_powergating_state = amdgpu_pp_set_powergating_state,
 };
+
+const struct amdgpu_ip_block_version amdgpu_pp_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SMC,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &amdgpu_pp_ip_funcs,
+};
index ee6ea6c98e4f45871ff4502034331b315d4fd102..c0c4bfdcdb1458f06702cd276a8a6622d8470c24 100644 (file)
@@ -28,6 +28,6 @@
 
 #include "amd_shared.h"
 
-extern const struct amd_ip_funcs amdgpu_pp_ip_funcs;
+extern const struct amdgpu_ip_block_version amdgpu_pp_ip_block;
 
 #endif /* __AMDGPU_POWERPLAY_H__ */
index da66823eff1c9962c55c562da242db9f903b5200..ded57dd538e2661a410676ce9175542e4e76f9c1 100644 (file)
@@ -346,7 +346,7 @@ error:
 static bool amdgpu_vm_ring_has_compute_vm_bug(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
-       const struct amdgpu_ip_block_version *ip_block;
+       const struct amdgpu_ip_block *ip_block;
 
        if (ring->funcs->type != AMDGPU_RING_TYPE_COMPUTE)
                /* only compute rings */
@@ -356,10 +356,10 @@ static bool amdgpu_vm_ring_has_compute_vm_bug(struct amdgpu_ring *ring)
        if (!ip_block)
                return false;
 
-       if (ip_block->major <= 7) {
+       if (ip_block->version->major <= 7) {
                /* gfx7 has no workaround */
                return true;
-       } else if (ip_block->major == 8) {
+       } else if (ip_block->version->major == 8) {
                if (adev->gfx.mec_fw_version >= 673)
                        /* gfx8 is fixed in MEC firmware 673 */
                        return false;
index 3f891076c07000d546e8acceca91ced12c917201..885f08c3f496fde3a3bf1e0ce76b38477b3f342b 100644 (file)
@@ -6663,3 +6663,12 @@ static void ci_dpm_set_irq_funcs(struct amdgpu_device *adev)
        adev->pm.dpm.thermal.irq.num_types = AMDGPU_THERMAL_IRQ_LAST;
        adev->pm.dpm.thermal.irq.funcs = &ci_dpm_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version ci_dpm_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SMC,
+       .major = 7,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &ci_dpm_ip_funcs,
+};
index a845b6a93b79bed19cd8027f867ca65460cd27bf..1b70f8fa42806a8cb65a3f414a8847262a5432d6 100644 (file)
@@ -1641,745 +1641,6 @@ static void cik_detect_hw_virtualization(struct amdgpu_device *adev)
                adev->virtualization.virtual_caps |= AMDGPU_PASSTHROUGH_MODE;
 }
 
-static const struct amdgpu_ip_block_version bonaire_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &dce_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version bonaire_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version hawaii_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 5,
-               .rev = 0,
-               .funcs = &dce_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version hawaii_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 5,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version kabini_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &dce_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version kabini_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version mullins_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &dce_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version mullins_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version kaveri_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &dce_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version kaveri_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 8,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &gfx_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cik_sdma_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 4,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &uvd_v4_2_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v2_0_ip_funcs,
-       },
-};
-
-int cik_set_ip_blocks(struct amdgpu_device *adev)
-{
-       if (adev->enable_virtual_display) {
-               switch (adev->asic_type) {
-               case CHIP_BONAIRE:
-                       adev->ip_blocks = bonaire_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(bonaire_ip_blocks_vd);
-                       break;
-               case CHIP_HAWAII:
-                       adev->ip_blocks = hawaii_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(hawaii_ip_blocks_vd);
-                       break;
-               case CHIP_KAVERI:
-                       adev->ip_blocks = kaveri_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(kaveri_ip_blocks_vd);
-                       break;
-               case CHIP_KABINI:
-                       adev->ip_blocks = kabini_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(kabini_ip_blocks_vd);
-                       break;
-               case CHIP_MULLINS:
-                       adev->ip_blocks = mullins_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(mullins_ip_blocks_vd);
-                       break;
-               default:
-                       /* FIXME: not supported yet */
-                       return -EINVAL;
-               }
-       } else {
-               switch (adev->asic_type) {
-               case CHIP_BONAIRE:
-                       adev->ip_blocks = bonaire_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(bonaire_ip_blocks);
-                       break;
-               case CHIP_HAWAII:
-                       adev->ip_blocks = hawaii_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(hawaii_ip_blocks);
-                       break;
-               case CHIP_KAVERI:
-                       adev->ip_blocks = kaveri_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(kaveri_ip_blocks);
-                       break;
-               case CHIP_KABINI:
-                       adev->ip_blocks = kabini_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(kabini_ip_blocks);
-                       break;
-               case CHIP_MULLINS:
-                       adev->ip_blocks = mullins_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(mullins_ip_blocks);
-                       break;
-               default:
-                       /* FIXME: not supported yet */
-                       return -EINVAL;
-               }
-       }
-
-       return 0;
-}
-
 static const struct amdgpu_asic_funcs cik_asic_funcs =
 {
        .read_disabled_bios = &cik_read_disabled_bios,
@@ -2612,7 +1873,7 @@ static int cik_common_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs cik_common_ip_funcs = {
+static const struct amd_ip_funcs cik_common_ip_funcs = {
        .name = "cik_common",
        .early_init = cik_common_early_init,
        .late_init = NULL,
@@ -2628,3 +1889,79 @@ const struct amd_ip_funcs cik_common_ip_funcs = {
        .set_clockgating_state = cik_common_set_clockgating_state,
        .set_powergating_state = cik_common_set_powergating_state,
 };
+
+static const struct amdgpu_ip_block_version cik_common_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_COMMON,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &cik_common_ip_funcs,
+};
+
+int cik_set_ip_blocks(struct amdgpu_device *adev)
+{
+       switch (adev->asic_type) {
+       case CHIP_BONAIRE:
+               amdgpu_ip_block_add(adev, &cik_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v7_0_ip_block);
+               amdgpu_ip_block_add(adev, &cik_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v8_2_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v7_2_ip_block);
+               amdgpu_ip_block_add(adev, &cik_sdma_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v4_2_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v2_0_ip_block);
+               break;
+       case CHIP_HAWAII:
+               amdgpu_ip_block_add(adev, &cik_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v7_0_ip_block);
+               amdgpu_ip_block_add(adev, &cik_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v8_5_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v7_3_ip_block);
+               amdgpu_ip_block_add(adev, &cik_sdma_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v4_2_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v2_0_ip_block);
+               break;
+       case CHIP_KAVERI:
+               amdgpu_ip_block_add(adev, &cik_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v7_0_ip_block);
+               amdgpu_ip_block_add(adev, &cik_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v8_1_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v7_1_ip_block);
+               amdgpu_ip_block_add(adev, &cik_sdma_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v4_2_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v2_0_ip_block);
+               break;
+       case CHIP_KABINI:
+       case CHIP_MULLINS:
+               amdgpu_ip_block_add(adev, &cik_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v7_0_ip_block);
+               amdgpu_ip_block_add(adev, &cik_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v8_3_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v7_2_ip_block);
+               amdgpu_ip_block_add(adev, &cik_sdma_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v4_2_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v2_0_ip_block);
+               break;
+       default:
+               /* FIXME: not supported yet */
+               return -EINVAL;
+       }
+       return 0;
+}
index 5ebd2d7a032772e960399a6fd9cf943a1cc5e7a3..c4989f51ecefab5520137e484f412aa1f3bb82ae 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef __CIK_H__
 #define __CIK_H__
 
-extern const struct amd_ip_funcs cik_common_ip_funcs;
-
 void cik_srbm_select(struct amdgpu_device *adev,
                     u32 me, u32 pipe, u32 queue, u32 vmid);
 int cik_set_ip_blocks(struct amdgpu_device *adev);
index be3d6f79a864170718f1f995cc3111109623a0d7..319b32cdea84cf9e92f59691df598436b306367e 100644 (file)
@@ -413,7 +413,7 @@ static int cik_ih_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs cik_ih_ip_funcs = {
+static const struct amd_ip_funcs cik_ih_ip_funcs = {
        .name = "cik_ih",
        .early_init = cik_ih_early_init,
        .late_init = NULL,
@@ -441,3 +441,12 @@ static void cik_ih_set_interrupt_funcs(struct amdgpu_device *adev)
        if (adev->irq.ih_funcs == NULL)
                adev->irq.ih_funcs = &cik_ih_funcs;
 }
+
+const struct amdgpu_ip_block_version cik_ih_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_IH,
+       .major = 2,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &cik_ih_ip_funcs,
+};
index 6b0f375ec24483a41939f116edadd58555146862..1d9ddee2868e9b464a0c4982612232f1ba7d1895 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __CIK_IH_H__
 #define __CIK_IH_H__
 
-extern const struct amd_ip_funcs cik_ih_ip_funcs;
+extern const struct amdgpu_ip_block_version cik_ih_ip_block;
 
 #endif
index b96ef20e871ff5d420b4ebbf365f727d105119fa..c7340b6e17c9d0d8d09c4ea1ad28b4cad089d98c 100644 (file)
@@ -1190,7 +1190,7 @@ static int cik_sdma_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs cik_sdma_ip_funcs = {
+static const struct amd_ip_funcs cik_sdma_ip_funcs = {
        .name = "cik_sdma",
        .early_init = cik_sdma_early_init,
        .late_init = NULL,
@@ -1342,3 +1342,12 @@ static void cik_sdma_set_vm_pte_funcs(struct amdgpu_device *adev)
                adev->vm_manager.vm_pte_num_rings = adev->sdma.num_instances;
        }
 }
+
+const struct amdgpu_ip_block_version cik_sdma_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SDMA,
+       .major = 2,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &cik_sdma_ip_funcs,
+};
index 027727c677b8a6702e0c355722d34aa7e4dcd3b3..a4a8fe01410bf5ed6dc7f5cd5528e036aec955c9 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __CIK_SDMA_H__
 #define __CIK_SDMA_H__
 
-extern const struct amd_ip_funcs cik_sdma_ip_funcs;
+extern const struct amdgpu_ip_block_version cik_sdma_ip_block;
 
 #endif
index 3c082e1437303d3247da620fcd08ba8a031e62e0..ad2cc4be67370bb46a101b1632bf634c5466589d 100644 (file)
@@ -2296,3 +2296,12 @@ static void cz_dpm_set_funcs(struct amdgpu_device *adev)
        if (NULL == adev->pm.funcs)
                adev->pm.funcs = &cz_dpm_funcs;
 }
+
+const struct amdgpu_ip_block_version cz_dpm_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SMC,
+       .major = 8,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &cz_dpm_ip_funcs,
+};
index 3d23a70b6432fc26a300cf5b61c368ab7cb11733..fe7cbb24da7b835298cdda54f5b187b4dbf306a8 100644 (file)
@@ -394,7 +394,7 @@ static int cz_ih_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs cz_ih_ip_funcs = {
+static const struct amd_ip_funcs cz_ih_ip_funcs = {
        .name = "cz_ih",
        .early_init = cz_ih_early_init,
        .late_init = NULL,
@@ -423,3 +423,11 @@ static void cz_ih_set_interrupt_funcs(struct amdgpu_device *adev)
                adev->irq.ih_funcs = &cz_ih_funcs;
 }
 
+const struct amdgpu_ip_block_version cz_ih_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_IH,
+       .major = 3,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &cz_ih_ip_funcs,
+};
index fc4057a2ecb976585fa4a0ac0ced35efd2db5d9d..14be7753221b1fe2e03708c6a036c2b13918c535 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __CZ_IH_H__
 #define __CZ_IH_H__
 
-extern const struct amd_ip_funcs cz_ih_ip_funcs;
+extern const struct amdgpu_ip_block_version cz_ih_ip_block;
 
 #endif /* __CZ_IH_H__ */
index 15c38331a3191c44184654fb698eeb1da0323876..e5d0edfb4309e0a0c9b665010bdecc9af45ef53b 100644 (file)
@@ -3470,7 +3470,7 @@ static int dce_v10_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs dce_v10_0_ip_funcs = {
+static const struct amd_ip_funcs dce_v10_0_ip_funcs = {
        .name = "dce_v10_0",
        .early_init = dce_v10_0_early_init,
        .late_init = NULL,
@@ -3801,3 +3801,21 @@ static void dce_v10_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->hpd_irq.num_types = AMDGPU_HPD_LAST;
        adev->hpd_irq.funcs = &dce_v10_0_hpd_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version dce_v10_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 10,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &dce_v10_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version dce_v10_1_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 10,
+       .minor = 1,
+       .rev = 0,
+       .funcs = &dce_v10_0_ip_funcs,
+};
index e3dc04d293e48759e63d4ae65d27d3028fbb0ad3..7a0747789f1d5a91a5458b1f530355f99e16da7a 100644 (file)
@@ -24,7 +24,9 @@
 #ifndef __DCE_V10_0_H__
 #define __DCE_V10_0_H__
 
-extern const struct amd_ip_funcs dce_v10_0_ip_funcs;
+
+extern const struct amdgpu_ip_block_version dce_v10_0_ip_block;
+extern const struct amdgpu_ip_block_version dce_v10_1_ip_block;
 
 void dce_v10_0_disable_dce(struct amdgpu_device *adev);
 
index 2696428bed0558721cffed59be4854c3a688b2e5..9719b2b1418632eb0db1c95351a22efbabf251c5 100644 (file)
@@ -3527,7 +3527,7 @@ static int dce_v11_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs dce_v11_0_ip_funcs = {
+static const struct amd_ip_funcs dce_v11_0_ip_funcs = {
        .name = "dce_v11_0",
        .early_init = dce_v11_0_early_init,
        .late_init = NULL,
@@ -3857,3 +3857,21 @@ static void dce_v11_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->hpd_irq.num_types = AMDGPU_HPD_LAST;
        adev->hpd_irq.funcs = &dce_v11_0_hpd_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version dce_v11_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 11,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &dce_v11_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version dce_v11_2_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 11,
+       .minor = 2,
+       .rev = 0,
+       .funcs = &dce_v11_0_ip_funcs,
+};
index 1f58a65ba2ef5339368400bd3c399db0d2505282..0d878ca3acbab9e34690e9dc611621c133cb0777 100644 (file)
@@ -24,7 +24,8 @@
 #ifndef __DCE_V11_0_H__
 #define __DCE_V11_0_H__
 
-extern const struct amd_ip_funcs dce_v11_0_ip_funcs;
+extern const struct amdgpu_ip_block_version dce_v11_0_ip_block;
+extern const struct amdgpu_ip_block_version dce_v11_2_ip_block;
 
 void dce_v11_0_disable_dce(struct amdgpu_device *adev);
 
index 502e97963d6d06701419d6e3487ae240913e8703..44547f951d9251ef6f4a0417301b348bb4ed0dfd 100644 (file)
@@ -2734,7 +2734,7 @@ static int dce_v6_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs dce_v6_0_ip_funcs = {
+static const struct amd_ip_funcs dce_v6_0_ip_funcs = {
        .name = "dce_v6_0",
        .early_init = dce_v6_0_early_init,
        .late_init = NULL,
@@ -3075,3 +3075,21 @@ static void dce_v6_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->hpd_irq.num_types = AMDGPU_HPD_LAST;
        adev->hpd_irq.funcs = &dce_v6_0_hpd_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version dce_v6_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 6,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &dce_v6_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version dce_v6_4_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 6,
+       .minor = 4,
+       .rev = 0,
+       .funcs = &dce_v6_0_ip_funcs,
+};
index 4c6cd18e9053d7d3cfe2669870d4a1394c76b67f..7b546b596de11e0dbfd01cb203afff22c210ad67 100644 (file)
@@ -24,7 +24,8 @@
 #ifndef __DCE_V6_0_H__
 #define __DCE_V6_0_H__
 
-extern const struct amd_ip_funcs dce_v6_0_ip_funcs;
+extern const struct amdgpu_ip_block_version dce_v6_0_ip_block;
+extern const struct amdgpu_ip_block_version dce_v6_4_ip_block;
 
 void dce_v6_0_disable_dce(struct amdgpu_device *adev);
 
index 0245ed605107f5c212933d77749109b7e970c441..16a2f1faaf19f781764aaf9abc6dfdc6e02cf0d8 100644 (file)
@@ -3308,7 +3308,7 @@ static int dce_v8_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs dce_v8_0_ip_funcs = {
+static const struct amd_ip_funcs dce_v8_0_ip_funcs = {
        .name = "dce_v8_0",
        .early_init = dce_v8_0_early_init,
        .late_init = NULL,
@@ -3638,3 +3638,48 @@ static void dce_v8_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->hpd_irq.num_types = AMDGPU_HPD_LAST;
        adev->hpd_irq.funcs = &dce_v8_0_hpd_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version dce_v8_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 8,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &dce_v8_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version dce_v8_1_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 8,
+       .minor = 1,
+       .rev = 0,
+       .funcs = &dce_v8_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version dce_v8_2_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 8,
+       .minor = 2,
+       .rev = 0,
+       .funcs = &dce_v8_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version dce_v8_3_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 8,
+       .minor = 3,
+       .rev = 0,
+       .funcs = &dce_v8_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version dce_v8_5_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 8,
+       .minor = 5,
+       .rev = 0,
+       .funcs = &dce_v8_0_ip_funcs,
+};
index 7d0770c3a49bd3ee67128819b56d5c5f74cc66fc..13b802dd946af75e234f520bcd09ac4edc93a9aa 100644 (file)
 #ifndef __DCE_V8_0_H__
 #define __DCE_V8_0_H__
 
-extern const struct amd_ip_funcs dce_v8_0_ip_funcs;
+extern const struct amdgpu_ip_block_version dce_v8_0_ip_block;
+extern const struct amdgpu_ip_block_version dce_v8_1_ip_block;
+extern const struct amdgpu_ip_block_version dce_v8_2_ip_block;
+extern const struct amdgpu_ip_block_version dce_v8_3_ip_block;
+extern const struct amdgpu_ip_block_version dce_v8_5_ip_block;
 
 void dce_v8_0_disable_dce(struct amdgpu_device *adev);
 
index 7d041b9a4d61e0bdb4c450d44625d5827806514f..cc85676a68d9f78b53ac2281e309c77d35e94eb8 100644 (file)
@@ -574,7 +574,7 @@ static int dce_virtual_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs dce_virtual_ip_funcs = {
+static const struct amd_ip_funcs dce_virtual_ip_funcs = {
        .name = "dce_virtual",
        .early_init = dce_virtual_early_init,
        .late_init = NULL,
@@ -824,3 +824,11 @@ static void dce_virtual_set_irq_funcs(struct amdgpu_device *adev)
        adev->crtc_irq.funcs = &dce_virtual_crtc_irq_funcs;
 }
 
+const struct amdgpu_ip_block_version dce_virtual_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_DCE,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &dce_virtual_ip_funcs,
+};
index 393ce97f783e78356e73271f5401f6925a29a74d..ed422012c8c65dd88d6f8845e369d0c2ae3926ae 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __DCE_VIRTUAL_H__
 #define __DCE_VIRTUAL_H__
 
-extern const struct amd_ip_funcs dce_virtual_ip_funcs;
+extern const struct amdgpu_ip_block_version dce_virtual_ip_block;
 
 #endif
 
index 367b14e16e53ccf55f687a2a15bae065895b1b23..96dd05dca694231d8185579ed6f7adb4b14bb9f2 100644 (file)
@@ -3206,7 +3206,7 @@ static int gfx_v6_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
+static const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
        .name = "gfx_v6_0",
        .early_init = gfx_v6_0_early_init,
        .late_init = NULL,
@@ -3344,3 +3344,12 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
        cu_info->number = active_cu_number;
        cu_info->ao_cu_mask = ao_cu_mask;
 }
+
+const struct amdgpu_ip_block_version gfx_v6_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GFX,
+       .major = 6,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &gfx_v6_0_ip_funcs,
+};
index b9657e72b2486ae7b4462468274b464a5b6fe835..ced6fc42f688d5ce66be4c32c00db7affd6391c4 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __GFX_V6_0_H__
 #define __GFX_V6_0_H__
 
-extern const struct amd_ip_funcs gfx_v6_0_ip_funcs;
+extern const struct amdgpu_ip_block_version gfx_v6_0_ip_block;
 
 #endif
index 388649734b3647ece9eb813cbd9fe98af0e9e057..bc6ccd05010ff7bc5a101348d33fb2689d6a0dca 100644 (file)
@@ -5087,7 +5087,7 @@ static int gfx_v7_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
+static const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
        .name = "gfx_v7_0",
        .early_init = gfx_v7_0_early_init,
        .late_init = gfx_v7_0_late_init,
@@ -5270,3 +5270,39 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
        cu_info->number = active_cu_number;
        cu_info->ao_cu_mask = ao_cu_mask;
 }
+
+const struct amdgpu_ip_block_version gfx_v7_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GFX,
+       .major = 7,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &gfx_v7_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version gfx_v7_1_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GFX,
+       .major = 7,
+       .minor = 1,
+       .rev = 0,
+       .funcs = &gfx_v7_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version gfx_v7_2_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GFX,
+       .major = 7,
+       .minor = 2,
+       .rev = 0,
+       .funcs = &gfx_v7_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version gfx_v7_3_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GFX,
+       .major = 7,
+       .minor = 3,
+       .rev = 0,
+       .funcs = &gfx_v7_0_ip_funcs,
+};
index 94e3ea147c26ebae5e31f81d07b590002f58e79b..2f5164cc0e53b647b01ff16c1cdff66339fbf839 100644 (file)
@@ -24,6 +24,9 @@
 #ifndef __GFX_V7_0_H__
 #define __GFX_V7_0_H__
 
-extern const struct amd_ip_funcs gfx_v7_0_ip_funcs;
+extern const struct amdgpu_ip_block_version gfx_v7_0_ip_block;
+extern const struct amdgpu_ip_block_version gfx_v7_1_ip_block;
+extern const struct amdgpu_ip_block_version gfx_v7_2_ip_block;
+extern const struct amdgpu_ip_block_version gfx_v7_3_ip_block;
 
 #endif
index 6f3996f6d39ae1d98b5f9699ecf403145037ad54..27b3de44add7a08c5f839dd93c5e8014f2093376 100644 (file)
@@ -6504,7 +6504,7 @@ static int gfx_v8_0_priv_inst_irq(struct amdgpu_device *adev,
        return 0;
 }
 
-const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
+static const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
        .name = "gfx_v8_0",
        .early_init = gfx_v8_0_early_init,
        .late_init = gfx_v8_0_late_init,
@@ -6734,3 +6734,21 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
        cu_info->number = active_cu_number;
        cu_info->ao_cu_mask = ao_cu_mask;
 }
+
+const struct amdgpu_ip_block_version gfx_v8_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GFX,
+       .major = 8,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &gfx_v8_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version gfx_v8_1_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GFX,
+       .major = 8,
+       .minor = 1,
+       .rev = 0,
+       .funcs = &gfx_v8_0_ip_funcs,
+};
index ebed1f8292979de0055d4c0d943375fdeda77e9d..788cc3ab584bb732961e88a086607ec28ab7c679 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef __GFX_V8_0_H__
 #define __GFX_V8_0_H__
 
-extern const struct amd_ip_funcs gfx_v8_0_ip_funcs;
+extern const struct amdgpu_ip_block_version gfx_v8_0_ip_block;
+extern const struct amdgpu_ip_block_version gfx_v8_1_ip_block;
 
 #endif
index b13c8aaec078e635f2d2d17b8d6332d0e80ae312..1940d36bc3040e4a41f702423a0e175a6f90a428 100644 (file)
@@ -1030,7 +1030,7 @@ static int gmc_v6_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs gmc_v6_0_ip_funcs = {
+static const struct amd_ip_funcs gmc_v6_0_ip_funcs = {
        .name = "gmc_v6_0",
        .early_init = gmc_v6_0_early_init,
        .late_init = gmc_v6_0_late_init,
@@ -1069,3 +1069,11 @@ static void gmc_v6_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->mc.vm_fault.funcs = &gmc_v6_0_irq_funcs;
 }
 
+const struct amdgpu_ip_block_version gmc_v6_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GMC,
+       .major = 6,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &gmc_v6_0_ip_funcs,
+};
index 42c4fc676cd4d6b4a8e1be9d39c31facfef18fa6..ed2f64dec47a0a83a7ecc0c32452031b2b51c581 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __GMC_V6_0_H__
 #define __GMC_V6_0_H__
 
-extern const struct amd_ip_funcs gmc_v6_0_ip_funcs;
+extern const struct amdgpu_ip_block_version gmc_v6_0_ip_block;
 
 #endif
index aa0c4b964621cd9726366fba08679394095b75f0..3a25f72980c1e78f395c6cad4fa7b1f7c11d620f 100644 (file)
@@ -1235,7 +1235,7 @@ static int gmc_v7_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs gmc_v7_0_ip_funcs = {
+static const struct amd_ip_funcs gmc_v7_0_ip_funcs = {
        .name = "gmc_v7_0",
        .early_init = gmc_v7_0_early_init,
        .late_init = gmc_v7_0_late_init,
@@ -1273,3 +1273,21 @@ static void gmc_v7_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->mc.vm_fault.num_types = 1;
        adev->mc.vm_fault.funcs = &gmc_v7_0_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version gmc_v7_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GMC,
+       .major = 7,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &gmc_v7_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version gmc_v7_4_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GMC,
+       .major = 7,
+       .minor = 4,
+       .rev = 0,
+       .funcs = &gmc_v7_0_ip_funcs,
+};
index 0b386b5d2f7aabdc3b2fd89ca625733049fa7a89..ebce2966c1c745216dfee507b0aa27025eabb6b8 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef __GMC_V7_0_H__
 #define __GMC_V7_0_H__
 
-extern const struct amd_ip_funcs gmc_v7_0_ip_funcs;
+extern const struct amdgpu_ip_block_version gmc_v7_0_ip_block;
+extern const struct amdgpu_ip_block_version gmc_v7_4_ip_block;
 
 #endif
index c22ef140a54215e5253b7c9605a358a4785f8c05..74d7cc3f7e8c8b3ca6e72cc79987e680d7ed58b2 100644 (file)
@@ -1436,7 +1436,7 @@ static int gmc_v8_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs gmc_v8_0_ip_funcs = {
+static const struct amd_ip_funcs gmc_v8_0_ip_funcs = {
        .name = "gmc_v8_0",
        .early_init = gmc_v8_0_early_init,
        .late_init = gmc_v8_0_late_init,
@@ -1477,3 +1477,30 @@ static void gmc_v8_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->mc.vm_fault.num_types = 1;
        adev->mc.vm_fault.funcs = &gmc_v8_0_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version gmc_v8_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GMC,
+       .major = 8,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &gmc_v8_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version gmc_v8_1_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GMC,
+       .major = 8,
+       .minor = 1,
+       .rev = 0,
+       .funcs = &gmc_v8_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version gmc_v8_5_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_GMC,
+       .major = 8,
+       .minor = 5,
+       .rev = 0,
+       .funcs = &gmc_v8_0_ip_funcs,
+};
index fc5001a8119dabab06e0e45888c6670b48163e77..19b8a8aed2046904a1018ab2b9b61503de4a8409 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __GMC_V8_0_H__
 #define __GMC_V8_0_H__
 
-extern const struct amd_ip_funcs gmc_v8_0_ip_funcs;
+extern const struct amdgpu_ip_block_version gmc_v8_0_ip_block;
+extern const struct amdgpu_ip_block_version gmc_v8_1_ip_block;
+extern const struct amdgpu_ip_block_version gmc_v8_5_ip_block;
 
 #endif
index 3b8906ce3511274f302b7f23bbca5dd6d53fb683..ac21bb7bc0f335713fb86e093999870d92bc6eb3 100644 (file)
@@ -392,7 +392,7 @@ static int iceland_ih_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs iceland_ih_ip_funcs = {
+static const struct amd_ip_funcs iceland_ih_ip_funcs = {
        .name = "iceland_ih",
        .early_init = iceland_ih_early_init,
        .late_init = NULL,
@@ -421,3 +421,11 @@ static void iceland_ih_set_interrupt_funcs(struct amdgpu_device *adev)
                adev->irq.ih_funcs = &iceland_ih_funcs;
 }
 
+const struct amdgpu_ip_block_version iceland_ih_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_IH,
+       .major = 2,
+       .minor = 4,
+       .rev = 0,
+       .funcs = &iceland_ih_ip_funcs,
+};
index 57558cddfbcbbc503a9df712e36fdea12ed6a61e..3235f42775486fc8e76f26214bf6044115149421 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __ICELAND_IH_H__
 #define __ICELAND_IH_H__
 
-extern const struct amd_ip_funcs iceland_ih_ip_funcs;
+extern const struct amdgpu_ip_block_version iceland_ih_ip_block;
 
 #endif /* __ICELAND_IH_H__ */
index c3367d6f311a322f7df4d12e5b2c445045f85cd8..42e5c9400f97f73f66c9c6bbc4b7bdc47bca991b 100644 (file)
@@ -3292,3 +3292,12 @@ static void kv_dpm_set_irq_funcs(struct amdgpu_device *adev)
        adev->pm.dpm.thermal.irq.num_types = AMDGPU_THERMAL_IRQ_LAST;
        adev->pm.dpm.thermal.irq.funcs = &kv_dpm_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version kv_dpm_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SMC,
+       .major = 7,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &kv_dpm_ip_funcs,
+};
index 5859a106608b86e1c58cdda77d21ae0f1528924d..03e8856b08ce00c48834f4c17dcf5f3d2c723b78 100644 (file)
@@ -1187,7 +1187,7 @@ static int sdma_v2_4_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
+static const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
        .name = "sdma_v2_4",
        .early_init = sdma_v2_4_early_init,
        .late_init = NULL,
@@ -1340,3 +1340,12 @@ static void sdma_v2_4_set_vm_pte_funcs(struct amdgpu_device *adev)
                adev->vm_manager.vm_pte_num_rings = adev->sdma.num_instances;
        }
 }
+
+const struct amdgpu_ip_block_version sdma_v2_4_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SDMA,
+       .major = 2,
+       .minor = 4,
+       .rev = 0,
+       .funcs = &sdma_v2_4_ip_funcs,
+};
index 07349f5ee10fce982e9f0c1980e7597cc6b0df38..28b4337292164b4346380b11452a69098be46824 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __SDMA_V2_4_H__
 #define __SDMA_V2_4_H__
 
-extern const struct amd_ip_funcs sdma_v2_4_ip_funcs;
+extern const struct amdgpu_ip_block_version sdma_v2_4_ip_block;
 
 #endif
index 24642f92b4b5dc69ad21fa7f31ed72bed1989c51..6172d01e985a1fce9f5eb38706ab4666d8b62cf1 100644 (file)
@@ -1527,7 +1527,7 @@ static int sdma_v3_0_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
+static const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
        .name = "sdma_v3_0",
        .early_init = sdma_v3_0_early_init,
        .late_init = NULL,
@@ -1683,3 +1683,21 @@ static void sdma_v3_0_set_vm_pte_funcs(struct amdgpu_device *adev)
                adev->vm_manager.vm_pte_num_rings = adev->sdma.num_instances;
        }
 }
+
+const struct amdgpu_ip_block_version sdma_v3_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SDMA,
+       .major = 3,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &sdma_v3_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version sdma_v3_1_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SDMA,
+       .major = 3,
+       .minor = 1,
+       .rev = 0,
+       .funcs = &sdma_v3_0_ip_funcs,
+};
index 0cb9698a30544ebb1112dcf5f8499d8fa713e729..7aa223d35f1b1ea990c3d781d6cfbf931e29e10f 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef __SDMA_V3_0_H__
 #define __SDMA_V3_0_H__
 
-extern const struct amd_ip_funcs sdma_v3_0_ip_funcs;
+extern const struct amdgpu_ip_block_version sdma_v3_0_ip_block;
+extern const struct amdgpu_ip_block_version sdma_v3_1_ip_block;
 
 #endif
index 1d40c26de3241d696e5dec3d6f2ff8c1607d6bc1..d2d79206bcf9da8eeceb2ef43b7559977394f039 100644 (file)
@@ -1812,7 +1812,7 @@ static int si_common_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs si_common_ip_funcs = {
+static const struct amd_ip_funcs si_common_ip_funcs = {
        .name = "si_common",
        .early_init = si_common_early_init,
        .late_init = NULL,
@@ -1829,240 +1829,13 @@ const struct amd_ip_funcs si_common_ip_funcs = {
        .set_powergating_state = si_common_set_powergating_state,
 };
 
-static const struct amdgpu_ip_block_version verde_ip_blocks[] =
+static const struct amdgpu_ip_block_version si_common_ip_block =
 {
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_dma_ip_funcs,
-       },
-/*     {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 3,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &si_null_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_null_ip_funcs,
-       },
-       */
-};
-
-
-static const struct amdgpu_ip_block_version verde_ip_blocks_vd[] =
-{
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_dma_ip_funcs,
-       },
-/*     {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 3,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &si_null_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_null_ip_funcs,
-       },
-       */
-};
-
-static const struct amdgpu_ip_block_version hainan_ip_blocks[] =
-{
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_dma_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version hainan_ip_blocks_vd[] =
-{
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &si_dma_ip_funcs,
-       },
+       .type = AMD_IP_BLOCK_TYPE_COMMON,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &si_common_ip_funcs,
 };
 
 int si_set_ip_blocks(struct amdgpu_device *adev)
@@ -2071,23 +1844,42 @@ int si_set_ip_blocks(struct amdgpu_device *adev)
        case CHIP_VERDE:
        case CHIP_TAHITI:
        case CHIP_PITCAIRN:
+               amdgpu_ip_block_add(adev, &si_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &si_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &si_dma_ip_block);
+               /* amdgpu_ip_block_add(adev, &uvd_v3_1_ip_block); */
+               /* amdgpu_ip_block_add(adev, &vce_v1_0_ip_block); */
+               break;
        case CHIP_OLAND:
-               if (adev->enable_virtual_display) {
-                       adev->ip_blocks = verde_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(verde_ip_blocks_vd);
-               } else {
-                       adev->ip_blocks = verde_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(verde_ip_blocks);
-               }
+               amdgpu_ip_block_add(adev, &si_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &si_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v6_4_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &si_dma_ip_block);
+               /* amdgpu_ip_block_add(adev, &uvd_v3_1_ip_block); */
+               /* amdgpu_ip_block_add(adev, &vce_v1_0_ip_block); */
                break;
        case CHIP_HAINAN:
-               if (adev->enable_virtual_display) {
-                       adev->ip_blocks = hainan_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(hainan_ip_blocks_vd);
-               } else {
-                       adev->ip_blocks = hainan_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(hainan_ip_blocks);
-               }
+               amdgpu_ip_block_add(adev, &si_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &si_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &si_dma_ip_block);
                break;
        default:
                BUG();
index 959d7b63e0e526b6b4809f9c34a6203f4078a2aa..589225080c24c26a115129777a36cf40ecfcc5ab 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef __SI_H__
 #define __SI_H__
 
-extern const struct amd_ip_funcs si_common_ip_funcs;
-
 void si_srbm_select(struct amdgpu_device *adev,
                     u32 me, u32 pipe, u32 queue, u32 vmid);
 int si_set_ip_blocks(struct amdgpu_device *adev);
index 7fece1fe41302c4b338248062f7848af131433c6..14265c5c349ef793794192eb08b34e1969f2e6bf 100644 (file)
@@ -745,7 +745,7 @@ static int si_dma_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs si_dma_ip_funcs = {
+static const struct amd_ip_funcs si_dma_ip_funcs = {
        .name = "si_dma",
        .early_init = si_dma_early_init,
        .late_init = NULL,
@@ -903,3 +903,12 @@ static void si_dma_set_vm_pte_funcs(struct amdgpu_device *adev)
                adev->vm_manager.vm_pte_num_rings = adev->sdma.num_instances;
        }
 }
+
+const struct amdgpu_ip_block_version si_dma_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SDMA,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &si_dma_ip_funcs,
+};
index 3a3e0c78a54baaf910df1959f48358cc8aa308e1..5ac1b8452fb4160a92d67b3c0d5ba2c1f303dc72 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __SI_DMA_H__
 #define __SI_DMA_H__
 
-extern const struct amd_ip_funcs si_dma_ip_funcs;
+extern const struct amdgpu_ip_block_version si_dma_ip_block;
 
 #endif
index 38b4b9789584fab0d6792949b68ea067a6d1926c..6e6c7cee33328117f12f4eed8ec183a7fd178d9c 100644 (file)
@@ -8011,3 +8011,11 @@ static void si_dpm_set_irq_funcs(struct amdgpu_device *adev)
        adev->pm.dpm.thermal.irq.funcs = &si_dpm_irq_funcs;
 }
 
+const struct amdgpu_ip_block_version si_dpm_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_SMC,
+       .major = 6,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &si_dpm_ip_funcs,
+};
index 8fae3d4a236016bd70819f97336db96540eb7a84..db0f3684666104d54c802fc6b3ce7604f153898b 100644 (file)
@@ -268,7 +268,7 @@ static int si_ih_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs si_ih_ip_funcs = {
+static const struct amd_ip_funcs si_ih_ip_funcs = {
        .name = "si_ih",
        .early_init = si_ih_early_init,
        .late_init = NULL,
@@ -297,3 +297,11 @@ static void si_ih_set_interrupt_funcs(struct amdgpu_device *adev)
                adev->irq.ih_funcs = &si_ih_funcs;
 }
 
+const struct amdgpu_ip_block_version si_ih_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_IH,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &si_ih_ip_funcs,
+};
index f3e3a954369cae496ef1df4c1e96688fe077157f..42e64a53e24f2ff5c82685a8e8f7616558e6fd7a 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __SI_IH_H__
 #define __SI_IH_H__
 
-extern const struct amd_ip_funcs si_ih_ip_funcs;
+extern const struct amdgpu_ip_block_version si_ih_ip_block;
 
 #endif
index b4ea229bb4498ff1f84209dec7f211198ed788ed..52b71ee587930980b8e9e360b784cc8e8fcf83ff 100644 (file)
@@ -455,7 +455,7 @@ static int tonga_ih_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs tonga_ih_ip_funcs = {
+static const struct amd_ip_funcs tonga_ih_ip_funcs = {
        .name = "tonga_ih",
        .early_init = tonga_ih_early_init,
        .late_init = NULL,
@@ -487,3 +487,11 @@ static void tonga_ih_set_interrupt_funcs(struct amdgpu_device *adev)
                adev->irq.ih_funcs = &tonga_ih_funcs;
 }
 
+const struct amdgpu_ip_block_version tonga_ih_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_IH,
+       .major = 3,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &tonga_ih_ip_funcs,
+};
index 7392d70fa4a7bed7e6978c0dbc85cc597929669f..499027eee5c2d0800580ed6f4e276900413a3aec 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __TONGA_IH_H__
 #define __TONGA_IH_H__
 
-extern const struct amd_ip_funcs tonga_ih_ip_funcs;
+extern const struct amdgpu_ip_block_version tonga_ih_ip_block;
 
-#endif /* __CZ_IH_H__ */
+#endif /* __TONGA_IH_H__ */
index 1bab75afba5decea8f6f34da29b362c9f86645e0..3c2dce67b5f3d7cf651a7851be46b303c518eb1c 100644 (file)
@@ -723,7 +723,7 @@ static int uvd_v4_2_set_powergating_state(void *handle,
        }
 }
 
-const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
+static const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
        .name = "uvd_v4_2",
        .early_init = uvd_v4_2_early_init,
        .late_init = NULL,
@@ -780,3 +780,12 @@ static void uvd_v4_2_set_irq_funcs(struct amdgpu_device *adev)
        adev->uvd.irq.num_types = 1;
        adev->uvd.irq.funcs = &uvd_v4_2_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version uvd_v4_2_ip_block =
+{
+               .type = AMD_IP_BLOCK_TYPE_UVD,
+               .major = 4,
+               .minor = 2,
+               .rev = 0,
+               .funcs = &uvd_v4_2_ip_funcs,
+};
index 0a615dd50840438b0585391076066ac0769b4906..8a0444bb8b952f7e3945280eb029fe2ddf596346 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __UVD_V4_2_H__
 #define __UVD_V4_2_H__
 
-extern const struct amd_ip_funcs uvd_v4_2_ip_funcs;
+extern const struct amdgpu_ip_block_version uvd_v4_2_ip_block;
 
 #endif
index ec848fc57f70850158d7cc4422beaef74f5298ed..05088ec4c41b35f75e4bc8b908ff5c91c5c0d112 100644 (file)
@@ -774,7 +774,7 @@ static int uvd_v5_0_set_powergating_state(void *handle,
        }
 }
 
-const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
+static const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
        .name = "uvd_v5_0",
        .early_init = uvd_v5_0_early_init,
        .late_init = NULL,
@@ -831,3 +831,12 @@ static void uvd_v5_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->uvd.irq.num_types = 1;
        adev->uvd.irq.funcs = &uvd_v5_0_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version uvd_v5_0_ip_block =
+{
+               .type = AMD_IP_BLOCK_TYPE_UVD,
+               .major = 5,
+               .minor = 0,
+               .rev = 0,
+               .funcs = &uvd_v5_0_ip_funcs,
+};
index e3b3c49fa5de52e111f8326f9a363abb1c48a448..2eaaea793ac5f347a46223f096f5d277682df4a7 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __UVD_V5_0_H__
 #define __UVD_V5_0_H__
 
-extern const struct amd_ip_funcs uvd_v5_0_ip_funcs;
+extern const struct amdgpu_ip_block_version uvd_v5_0_ip_block;
 
 #endif
index be912933b073690ba865fb5691a912faab1598a3..2e2baa614b2849a493490368c5346eb3a932bb2d 100644 (file)
@@ -1001,7 +1001,7 @@ static int uvd_v6_0_set_powergating_state(void *handle,
        }
 }
 
-const struct amd_ip_funcs uvd_v6_0_ip_funcs = {
+static const struct amd_ip_funcs uvd_v6_0_ip_funcs = {
        .name = "uvd_v6_0",
        .early_init = uvd_v6_0_early_init,
        .late_init = NULL,
@@ -1096,3 +1096,30 @@ static void uvd_v6_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->uvd.irq.num_types = 1;
        adev->uvd.irq.funcs = &uvd_v6_0_irq_funcs;
 }
+
+const struct amdgpu_ip_block_version uvd_v6_0_ip_block =
+{
+               .type = AMD_IP_BLOCK_TYPE_UVD,
+               .major = 6,
+               .minor = 0,
+               .rev = 0,
+               .funcs = &uvd_v6_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version uvd_v6_2_ip_block =
+{
+               .type = AMD_IP_BLOCK_TYPE_UVD,
+               .major = 6,
+               .minor = 2,
+               .rev = 0,
+               .funcs = &uvd_v6_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version uvd_v6_3_ip_block =
+{
+               .type = AMD_IP_BLOCK_TYPE_UVD,
+               .major = 6,
+               .minor = 3,
+               .rev = 0,
+               .funcs = &uvd_v6_0_ip_funcs,
+};
index 6b92a235298650776c06396e3ad2dbfeae0e1080..d3d48c6428cd9d6a691ed564b76c39864dd228c6 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __UVD_V6_0_H__
 #define __UVD_V6_0_H__
 
-extern const struct amd_ip_funcs uvd_v6_0_ip_funcs;
+extern const struct amdgpu_ip_block_version uvd_v6_0_ip_block;
+extern const struct amdgpu_ip_block_version uvd_v6_2_ip_block;
+extern const struct amdgpu_ip_block_version uvd_v6_3_ip_block;
 
 #endif
index d58583983b11273776acc19ff641c4fb5f4204b1..38ed903dd6f821bbdb20b098eee61ce820fe745f 100644 (file)
@@ -592,7 +592,7 @@ static int vce_v2_0_set_powergating_state(void *handle,
                return vce_v2_0_start(adev);
 }
 
-const struct amd_ip_funcs vce_v2_0_ip_funcs = {
+static const struct amd_ip_funcs vce_v2_0_ip_funcs = {
        .name = "vce_v2_0",
        .early_init = vce_v2_0_early_init,
        .late_init = NULL,
@@ -647,3 +647,12 @@ static void vce_v2_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->vce.irq.num_types = 1;
        adev->vce.irq.funcs = &vce_v2_0_irq_funcs;
 };
+
+const struct amdgpu_ip_block_version vce_v2_0_ip_block =
+{
+               .type = AMD_IP_BLOCK_TYPE_VCE,
+               .major = 2,
+               .minor = 0,
+               .rev = 0,
+               .funcs = &vce_v2_0_ip_funcs,
+};
index 0d2ae8a01acd0716b93795227bfc0eeab26f8f77..4d15167654a6e36ddf48f46f153e9e84044f9b10 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef __VCE_V2_0_H__
 #define __VCE_V2_0_H__
 
-extern const struct amd_ip_funcs vce_v2_0_ip_funcs;
+extern const struct amdgpu_ip_block_version vce_v2_0_ip_block;
 
 #endif
index 589fff19aa786b1e6fd100a9791dfa83ea886166..3f899e3326d381c98b8453dc6d24bc48e698a7a5 100644 (file)
@@ -807,7 +807,7 @@ static void vce_v3_0_emit_pipeline_sync(struct amdgpu_ring *ring)
        amdgpu_ring_write(ring, seq);
 }
 
-const struct amd_ip_funcs vce_v3_0_ip_funcs = {
+static const struct amd_ip_funcs vce_v3_0_ip_funcs = {
        .name = "vce_v3_0",
        .early_init = vce_v3_0_early_init,
        .late_init = NULL,
@@ -898,3 +898,30 @@ static void vce_v3_0_set_irq_funcs(struct amdgpu_device *adev)
        adev->vce.irq.num_types = 1;
        adev->vce.irq.funcs = &vce_v3_0_irq_funcs;
 };
+
+const struct amdgpu_ip_block_version vce_v3_0_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_VCE,
+       .major = 3,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &vce_v3_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version vce_v3_1_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_VCE,
+       .major = 3,
+       .minor = 1,
+       .rev = 0,
+       .funcs = &vce_v3_0_ip_funcs,
+};
+
+const struct amdgpu_ip_block_version vce_v3_4_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_VCE,
+       .major = 3,
+       .minor = 4,
+       .rev = 0,
+       .funcs = &vce_v3_0_ip_funcs,
+};
index b45af65da81fdecc7b7edfea64cc4d30c9d8b816..08b908c7de0fca1b40f5af527ba39174a9a91c83 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __VCE_V3_0_H__
 #define __VCE_V3_0_H__
 
-extern const struct amd_ip_funcs vce_v3_0_ip_funcs;
+extern const struct amdgpu_ip_block_version vce_v3_0_ip_block;
+extern const struct amdgpu_ip_block_version vce_v3_1_ip_block;
+extern const struct amdgpu_ip_block_version vce_v3_4_ip_block;
 
 #endif
index 82f72cd1aebe68754523f823964d4a3b5f7cfab1..e33399cd1376c3298874ed8634b81015a7aa9535 100644 (file)
@@ -858,734 +858,6 @@ static void vi_enable_doorbell_aperture(struct amdgpu_device *adev,
        WREG32(mmBIF_DOORBELL_APER_EN, tmp);
 }
 
-/* topaz has no DCE, UVD, VCE */
-static const struct amdgpu_ip_block_version topaz_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &iceland_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &sdma_v2_4_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version topaz_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 7,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &gmc_v7_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 2,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &iceland_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 1,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 2,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &sdma_v2_4_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version tonga_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &tonga_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 10,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_v10_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 5,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &uvd_v5_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version tonga_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &tonga_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 10,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 5,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &uvd_v5_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version fiji_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 5,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &tonga_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 10,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &dce_v10_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &uvd_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version fiji_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 5,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &tonga_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 10,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &uvd_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version polaris11_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &tonga_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 11,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &dce_v11_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 6,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &uvd_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version polaris11_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &tonga_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 7,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 11,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 1,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 6,
-               .minor = 3,
-               .rev = 0,
-               .funcs = &uvd_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 4,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-};
-
-static const struct amdgpu_ip_block_version cz_ip_blocks[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cz_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 11,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_v11_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &uvd_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-#if defined(CONFIG_DRM_AMD_ACP)
-       {
-               .type = AMD_IP_BLOCK_TYPE_ACP,
-               .major = 2,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &acp_ip_funcs,
-       },
-#endif
-};
-
-static const struct amdgpu_ip_block_version cz_ip_blocks_vd[] =
-{
-       /* ORDER MATTERS! */
-       {
-               .type = AMD_IP_BLOCK_TYPE_COMMON,
-               .major = 2,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vi_common_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GMC,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gmc_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_IH,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &cz_ih_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SMC,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &amdgpu_pp_ip_funcs
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_DCE,
-               .major = 11,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &dce_virtual_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_GFX,
-               .major = 8,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &gfx_v8_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_SDMA,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &sdma_v3_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_UVD,
-               .major = 6,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &uvd_v6_0_ip_funcs,
-       },
-       {
-               .type = AMD_IP_BLOCK_TYPE_VCE,
-               .major = 3,
-               .minor = 0,
-               .rev = 0,
-               .funcs = &vce_v3_0_ip_funcs,
-       },
-#if defined(CONFIG_DRM_AMD_ACP)
-       {
-               .type = AMD_IP_BLOCK_TYPE_ACP,
-               .major = 2,
-               .minor = 2,
-               .rev = 0,
-               .funcs = &acp_ip_funcs,
-       },
-#endif
-};
-
-int vi_set_ip_blocks(struct amdgpu_device *adev)
-{
-       if (adev->enable_virtual_display) {
-               switch (adev->asic_type) {
-               case CHIP_TOPAZ:
-                       adev->ip_blocks = topaz_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(topaz_ip_blocks_vd);
-                       break;
-               case CHIP_FIJI:
-                       adev->ip_blocks = fiji_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(fiji_ip_blocks_vd);
-                       break;
-               case CHIP_TONGA:
-                       adev->ip_blocks = tonga_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(tonga_ip_blocks_vd);
-                       break;
-               case CHIP_POLARIS11:
-               case CHIP_POLARIS10:
-                       adev->ip_blocks = polaris11_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(polaris11_ip_blocks_vd);
-                       break;
-
-               case CHIP_CARRIZO:
-               case CHIP_STONEY:
-                       adev->ip_blocks = cz_ip_blocks_vd;
-                       adev->num_ip_blocks = ARRAY_SIZE(cz_ip_blocks_vd);
-                       break;
-               default:
-                       /* FIXME: not supported yet */
-                       return -EINVAL;
-               }
-       } else {
-               switch (adev->asic_type) {
-               case CHIP_TOPAZ:
-                       adev->ip_blocks = topaz_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(topaz_ip_blocks);
-                       break;
-               case CHIP_FIJI:
-                       adev->ip_blocks = fiji_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(fiji_ip_blocks);
-                       break;
-               case CHIP_TONGA:
-                       adev->ip_blocks = tonga_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(tonga_ip_blocks);
-                       break;
-               case CHIP_POLARIS11:
-               case CHIP_POLARIS10:
-                       adev->ip_blocks = polaris11_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(polaris11_ip_blocks);
-                       break;
-               case CHIP_CARRIZO:
-               case CHIP_STONEY:
-                       adev->ip_blocks = cz_ip_blocks;
-                       adev->num_ip_blocks = ARRAY_SIZE(cz_ip_blocks);
-                       break;
-               default:
-                       /* FIXME: not supported yet */
-                       return -EINVAL;
-               }
-       }
-
-       return 0;
-}
-
 #define ATI_REV_ID_FUSE_MACRO__ADDRESS      0xC0014044
 #define ATI_REV_ID_FUSE_MACRO__SHIFT        9
 #define ATI_REV_ID_FUSE_MACRO__MASK         0x00001E00
@@ -1985,7 +1257,7 @@ static int vi_common_set_powergating_state(void *handle,
        return 0;
 }
 
-const struct amd_ip_funcs vi_common_ip_funcs = {
+static const struct amd_ip_funcs vi_common_ip_funcs = {
        .name = "vi_common",
        .early_init = vi_common_early_init,
        .late_init = NULL,
@@ -2002,3 +1274,110 @@ const struct amd_ip_funcs vi_common_ip_funcs = {
        .set_powergating_state = vi_common_set_powergating_state,
 };
 
+static const struct amdgpu_ip_block_version vi_common_ip_block =
+{
+       .type = AMD_IP_BLOCK_TYPE_COMMON,
+       .major = 1,
+       .minor = 0,
+       .rev = 0,
+       .funcs = &vi_common_ip_funcs,
+};
+
+int vi_set_ip_blocks(struct amdgpu_device *adev)
+{
+       switch (adev->asic_type) {
+       case CHIP_TOPAZ:
+               /* topaz has no DCE, UVD, VCE */
+               amdgpu_ip_block_add(adev, &vi_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v7_4_ip_block);
+               amdgpu_ip_block_add(adev, &iceland_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &sdma_v2_4_ip_block);
+               break;
+       case CHIP_FIJI:
+               amdgpu_ip_block_add(adev, &vi_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v8_5_ip_block);
+               amdgpu_ip_block_add(adev, &tonga_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v10_1_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &sdma_v3_0_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v3_0_ip_block);
+               break;
+       case CHIP_TONGA:
+               amdgpu_ip_block_add(adev, &vi_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &tonga_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v10_0_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &sdma_v3_0_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v5_0_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v3_0_ip_block);
+               break;
+       case CHIP_POLARIS11:
+       case CHIP_POLARIS10:
+               amdgpu_ip_block_add(adev, &vi_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v8_1_ip_block);
+               amdgpu_ip_block_add(adev, &tonga_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v11_2_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &sdma_v3_1_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v6_3_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v3_4_ip_block);
+               break;
+       case CHIP_CARRIZO:
+               amdgpu_ip_block_add(adev, &vi_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &cz_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v11_0_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &sdma_v3_0_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v6_0_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v3_1_ip_block);
+#if defined(CONFIG_DRM_AMD_ACP)
+               amdgpu_ip_block_add(adev, &acp_ip_block);
+#endif
+               break;
+       case CHIP_STONEY:
+               amdgpu_ip_block_add(adev, &vi_common_ip_block);
+               amdgpu_ip_block_add(adev, &gmc_v8_0_ip_block);
+               amdgpu_ip_block_add(adev, &cz_ih_ip_block);
+               amdgpu_ip_block_add(adev, &amdgpu_pp_ip_block);
+               if (adev->enable_virtual_display)
+                       amdgpu_ip_block_add(adev, &dce_virtual_ip_block);
+               else
+                       amdgpu_ip_block_add(adev, &dce_v11_0_ip_block);
+               amdgpu_ip_block_add(adev, &gfx_v8_1_ip_block);
+               amdgpu_ip_block_add(adev, &sdma_v3_0_ip_block);
+               amdgpu_ip_block_add(adev, &uvd_v6_2_ip_block);
+               amdgpu_ip_block_add(adev, &vce_v3_4_ip_block);
+#if defined(CONFIG_DRM_AMD_ACP)
+               amdgpu_ip_block_add(adev, &acp_ip_block);
+#endif
+               break;
+       default:
+               /* FIXME: not supported yet */
+               return -EINVAL;
+       }
+
+       return 0;
+}
index 50209404246273d4716816131dc81c22f8dc26d1..575d7aed5d32f2476f9056923b68bd768e66885e 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef __VI_H__
 #define __VI_H__
 
-extern const struct amd_ip_funcs vi_common_ip_funcs;
-
 void vi_srbm_select(struct amdgpu_device *adev,
                    u32 me, u32 pipe, u32 queue, u32 vmid);
 int vi_set_ip_blocks(struct amdgpu_device *adev);