drm/amdgpu: Add vbios info ioctl interface

Add AMDGPU_INFO_VBIOS_INFO subquery id for detailed vbios info.

Provides a way for the user application to get the VBIOS
information without having to parse the binary.
It is useful for the user to be able to display in a simple way the VBIOS
version in their system if they happen to encounter an issue.

V2:
Use numeric serial.
Parse and expose vbios version string.

V3:
Remove redundant data in drm_amdgpu_info_vbios struct.

V4:
64 bit alignment in drm_amdgpu_info_vbios.

v5: squash together all the reverts, etc. (Alex)

Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Jiawei Gu
2021-04-14 16:44:36 +08:00
committed by Alex Deucher
parent 915821a744
commit 29b4c589b4
5 changed files with 219 additions and 6 deletions

View File

@@ -197,6 +197,9 @@ enum atom_dp_vs_preemph_def{
DP_VS_LEVEL0_PREEMPH_LEVEL3 = 0x18,
};
#define BIOS_ATOM_PREFIX "ATOMBIOS"
#define BIOS_VERSION_PREFIX "ATOMBIOSBK-AMD"
#define BIOS_STRING_LENGTH 43
/*
enum atom_string_def{
@@ -209,12 +212,14 @@ atom_bios_string = "ATOM"
#pragma pack(1) /* BIOS data must use byte aligment*/
enum atombios_image_offset{
OFFSET_TO_ATOM_ROM_HEADER_POINTER =0x00000048,
OFFSET_TO_ATOM_ROM_IMAGE_SIZE =0x00000002,
OFFSET_TO_ATOMBIOS_ASIC_BUS_MEM_TYPE =0x94,
MAXSIZE_OF_ATOMBIOS_ASIC_BUS_MEM_TYPE =20, /*including the terminator 0x0!*/
OFFSET_TO_GET_ATOMBIOS_NUMBER_OF_STRINGS =0x2f,
OFFSET_TO_GET_ATOMBIOS_STRING_START =0x6e,
OFFSET_TO_ATOM_ROM_HEADER_POINTER = 0x00000048,
OFFSET_TO_ATOM_ROM_IMAGE_SIZE = 0x00000002,
OFFSET_TO_ATOMBIOS_ASIC_BUS_MEM_TYPE = 0x94,
MAXSIZE_OF_ATOMBIOS_ASIC_BUS_MEM_TYPE = 20, /*including the terminator 0x0!*/
OFFSET_TO_GET_ATOMBIOS_NUMBER_OF_STRINGS = 0x2f,
OFFSET_TO_GET_ATOMBIOS_STRING_START = 0x6e,
OFFSET_TO_VBIOS_PART_NUMBER = 0x80,
OFFSET_TO_VBIOS_DATE = 0x50,
};
/****************************************************************************