Commit 6488232d authored by Jiawei Gu's avatar Jiawei Gu
Browse files

tests/amdgpu: Add vbios info query test


Signed-off-by: Jiawei Gu's avatarJiawei Gu <Jiawei.Gu@amd.com>
parent bc327728
Pipeline #345937 passed with stages
in 59 seconds
......@@ -67,6 +67,7 @@ amdgpu_query_hw_ip_info
amdgpu_query_info
amdgpu_query_sensor_info
amdgpu_query_video_caps_info
amdgpu_query_vbios_info
amdgpu_read_mm_registers
amdgpu_va_range_alloc
amdgpu_va_range_free
......
......@@ -1254,6 +1254,24 @@ int amdgpu_query_sensor_info(amdgpu_device_handle dev, unsigned sensor_type,
int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned cap_type,
unsigned size, void *value);
/**
* Query device vbios information.
*
* The return size is query-specific and depends on the "type" parameter.
* No more than "size" bytes is returned.
*
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
* \param type - \c [in] AMDGPU_INFO_VBIOS_*
* \param size - \c [in] Size of the returned value.
* \param value - \c [out] Pointer to the return value.
*
* \return 0 on success\n
* <0 - Negative POSIX error code
*
*/
int amdgpu_query_vbios_info(amdgpu_device_handle dev, unsigned type,
unsigned size, void *value);
/**
* Read a set of consecutive memory-mapped registers.
* Not all registers are allowed to be read by userspace.
......
......@@ -346,3 +346,23 @@ drm_public int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned c
return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request,
sizeof(struct drm_amdgpu_info));
}
drm_public int amdgpu_query_vbios_info(amdgpu_device_handle dev, unsigned type,
unsigned size, void *value)
{
struct drm_amdgpu_info request;
int r;
memset(&request, 0, sizeof(request));
request.return_pointer = (uintptr_t)value;
request.return_size = size;
request.query = AMDGPU_INFO_VBIOS;
request.vbios_info.type = type;
r = drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request,
sizeof(struct drm_amdgpu_info));
if (r)
return r;
return 0;
}
\ No newline at end of file
......@@ -696,6 +696,7 @@ int suite_basic_tests_clean(void)
static void amdgpu_query_info_test(void)
{
struct amdgpu_gpu_info gpu_info = {0};
struct drm_amdgpu_info_vbios vbios_info = {0};
uint32_t version, feature;
int r;
......@@ -705,6 +706,10 @@ static void amdgpu_query_info_test(void)
r = amdgpu_query_firmware_version(device_handle, AMDGPU_INFO_FW_VCE, 0,
0, &version, &feature);
CU_ASSERT_EQUAL(r, 0);
r = amdgpu_query_vbios_info(device_handle, AMDGPU_INFO_VBIOS_INFO,
sizeof(vbios_info), &vbios_info);
CU_ASSERT_EQUAL(r, 0);
}
static void amdgpu_command_submission_gfx_separate_ibs(void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment