drm/amdgpu: add check for atombios GPU virtualization table
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 1 Feb 2016 16:00:49 +0000 (11:00 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 10 Feb 2016 19:17:10 +0000 (14:17 -0500)
This table is found on boards that support SR-IOV.  This will
be used to determine if the board supports SR-IOV and allow
the driver to take specific action in certain cases.

Reviewed-by: Monk Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h

index 9416e0f5c1db2bf8c5601ddee999b1ade5efabc0..84b0ce39ee14d51014148e8b7a7f9f143e7b28d2 100644 (file)
@@ -1514,6 +1514,19 @@ int amdgpu_atombios_init_mc_reg_table(struct amdgpu_device *adev,
        return -EINVAL;
 }
 
+bool amdgpu_atombios_has_gpu_virtualization_table(struct amdgpu_device *adev)
+{
+       int index = GetIndexIntoMasterTable(DATA, GPUVirtualizationInfo);
+       u8 frev, crev;
+       u16 data_offset, size;
+
+       if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context, index, &size,
+                                         &frev, &crev, &data_offset))
+               return true;
+
+       return false;
+}
+
 void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock)
 {
        uint32_t bios_6_scratch;
index 0ebb959ea43587d11fa4feb4f5b97ce248a2aa7f..9e1442053fe4ffb72e1ff47c6a8fb5bc91d09533 100644 (file)
@@ -196,6 +196,8 @@ int amdgpu_atombios_init_mc_reg_table(struct amdgpu_device *adev,
                                      u8 module_index,
                                      struct atom_mc_reg_table *reg_table);
 
+bool amdgpu_atombios_has_gpu_virtualization_table(struct amdgpu_device *adev);
+
 void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock);
 void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev);
 void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev);