<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
p.msipheader4d111418, li.msipheader4d111418, div.msipheader4d111418
        {mso-style-name:msipheader4d111418;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="msipheader4d111418" style="margin:0in"><span style="font-family:"Arial",sans-serif;color:#0078D7">[AMD Official Use Only - Internal Distribution Only]</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">OK let’s remove serial.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">dbdf comes from this: <o:p></o:p></p>
<p class="MsoNormal">vbios_info.dbdf = PCI_DEVID(adev->pdev->bus->number, adev->pdev->devfn);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I think we can remove dbdf as well.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
<p class="MsoNormal">Jiawei<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Nieto, David M <David.Nieto@amd.com> <br>
<b>Sent:</b> Tuesday, May 18, 2021 10:45 AM<br>
<b>To:</b> Gu, JiaWei (Will) <JiaWei.Gu@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org; maraeo@gmail.com; Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc:</b> Deng, Emily <Emily.Deng@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Add vbios info ioctl interface<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:5.0pt"><span style="font-family:"Arial",sans-serif;color:#0078D7">[AMD Official Use Only - Internal Distribution Only]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">The serial number is ASIC information, not VBIOS information, and it is still available as a sysfs node... I don't think we should put it there.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Not sure what dbdf stands for.<o:p></o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Gu, JiaWei (Will) <<a href="mailto:JiaWei.Gu@amd.com">JiaWei.Gu@amd.com</a>><br>
<b>Sent:</b> Monday, May 17, 2021 7:11 PM<br>
<b>To:</b> Koenig, Christian <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>>; Nieto, David M <<a href="mailto:David.Nieto@amd.com">David.Nieto@amd.com</a>>;
<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a> <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>>; Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>><br>
<b>Cc:</b> Deng, Emily <<a href="mailto:Emily.Deng@amd.com">Emily.Deng@amd.com</a>><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu: Add vbios info ioctl interface</span> <o:p>
</o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">[AMD Official Use Only - Internal Distribution Only]<br>
<br>
So I guess the dbdf is also needed to be removed?<br>
And how about serial?<br>
<br>
> +struct drm_amdgpu_info_vbios {<br>
> +     __u8 name[64];<br>
> +     __u32 dbdf; // do we need this?<br>
> +     __u8 vbios_pn[64];<br>
> +     __u32 version;<br>
> +     __u8 vbios_ver_str[32];<br>
> +     __u8 date[32];<br>
> +     __u64 serial; // do we need this?<br>
> +};<br>
<br>
Best regards,<br>
Jiawei<br>
<br>
-----Original Message-----<br>
From: Koenig, Christian <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>>
<br>
Sent: Monday, May 17, 2021 8:26 PM<br>
To: Gu, JiaWei (Will) <<a href="mailto:JiaWei.Gu@amd.com">JiaWei.Gu@amd.com</a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>; Nieto, David M <<a href="mailto:David.Nieto@amd.com">David.Nieto@amd.com</a>>;
<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>; Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>><br>
Cc: Deng, Emily <<a href="mailto:Emily.Deng@amd.com">Emily.Deng@amd.com</a>><br>
Subject: Re: [PATCH] drm/amdgpu: Add vbios info ioctl interface<br>
<br>
I'm not very familiar with the technical background why we have the fields here once more.<br>
<br>
But of hand we should at least remove everything which is also available from the PCI information.<br>
<br>
E.g. dev_id, rev_id, sub_dev_id, sub_ved_id.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 17.05.21 um 14:17 schrieb Gu, JiaWei (Will):<br>
> [AMD Official Use Only - Internal Distribution Only]<br>
><br>
> Hi all,<br>
><br>
> Thanks Christian's suggestion.<br>
> I reverted the previous patches and squash them into this single one.<br>
><br>
> As this patch shows, the current uapi change looks like this:<br>
><br>
> +struct drm_amdgpu_info_vbios {<br>
> +     __u8 name[64];<br>
> +     __u32 dbdf;<br>
> +     __u8 vbios_pn[64];<br>
> +     __u32 version;<br>
> +     __u8 vbios_ver_str[32];<br>
> +     __u8 date[32];<br>
> +     __u64 serial;<br>
> +     __u32 dev_id;<br>
> +     __u32 rev_id;<br>
> +     __u32 sub_dev_id;<br>
> +     __u32 sub_ved_id;<br>
> +};<br>
><br>
> As we know there's some redundant info in this struct.<br>
> Please feel free to give any comments or suggestion about what it should & shouldn't include.<br>
><br>
> Best regards,<br>
> Jiawei<br>
><br>
> -----Original Message-----<br>
> From: Jiawei Gu <<a href="mailto:Jiawei.Gu@amd.com">Jiawei.Gu@amd.com</a>><br>
> Sent: Monday, May 17, 2021 8:08 PM<br>
> To: <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>; Koenig, Christian
<br>
> <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>>; Nieto, David M <<a href="mailto:David.Nieto@amd.com">David.Nieto@amd.com</a>>;
<br>
> <a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>; Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>><br>
> Cc: Deng, Emily <<a href="mailto:Emily.Deng@amd.com">Emily.Deng@amd.com</a>>; Gu, JiaWei (Will)
<br>
> <<a href="mailto:JiaWei.Gu@amd.com">JiaWei.Gu@amd.com</a>><br>
> Subject: [PATCH] drm/amdgpu: Add vbios info ioctl interface<br>
><br>
> Add AMDGPU_INFO_VBIOS_INFO subquery id for detailed vbios info.<br>
><br>
> Provides a way for the user application to get the VBIOS information without having to parse the binary.<br>
> 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.<br>
><br>
> V2:<br>
> Use numeric serial.<br>
> Parse and expose vbios version string.<br>
><br>
> Signed-off-by: Jiawei Gu <<a href="mailto:Jiawei.Gu@amd.com">Jiawei.Gu@amd.com</a>><br>
> Acked-by: Christian König <<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a>><br>
> ---<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    |  21 +++<br>
>   drivers/gpu/drm/amd/amdgpu/atom.c          | 174 +++++++++++++++++++++<br>
>   drivers/gpu/drm/amd/amdgpu/atom.h          |  12 ++<br>
>   drivers/gpu/drm/amd/include/atomfirmware.h |   5 +<br>
>   include/uapi/drm/amdgpu_drm.h              |  16 ++<br>
>   5 files changed, 228 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c <br>
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
> index 8d12e474745a..30e4fed3de22 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
> @@ -861,6 +861,27 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)<br>
>                                            min((size_t)size, (size_t)(bios_size - bios_offset)))<br>
>                                        ? -EFAULT : 0;<br>
>                }<br>
> +             case AMDGPU_INFO_VBIOS_INFO: {<br>
> +                     struct drm_amdgpu_info_vbios vbios_info = {};<br>
> +                     struct atom_context *atom_context;<br>
> +<br>
> +                     atom_context = adev->mode_info.atom_context;<br>
> +                     memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name));<br>
> +                     vbios_info.dbdf = PCI_DEVID(adev->pdev->bus->number, adev->pdev->devfn);<br>
> +                     memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));<br>
> +                     vbios_info.version = atom_context->version;<br>
> +                     memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,<br>
> +                                             sizeof(atom_context->vbios_ver_str));<br>
> +                     memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));<br>
> +                     vbios_info.serial = adev->unique_id;<br>
> +                     vbios_info.dev_id = adev->pdev->device;<br>
> +                     vbios_info.rev_id = adev->pdev->revision;<br>
> +                     vbios_info.sub_dev_id = atom_context->sub_dev_id;<br>
> +                     vbios_info.sub_ved_id = atom_context->sub_ved_id;<br>
> +<br>
> +                     return copy_to_user(out, &vbios_info,<br>
> +                                             min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0;<br>
> +             }<br>
>                default:<br>
>                        DRM_DEBUG_KMS("Invalid request %d\n",<br>
>                                        info->vbios_info.type);<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c <br>
> b/drivers/gpu/drm/amd/amdgpu/atom.c<br>
> index 3dcb8b32f48b..542b2c2414e4 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/atom.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/atom.c<br>
> @@ -31,6 +31,7 @@<br>
>   <br>
>   #define ATOM_DEBUG<br>
>   <br>
> +#include "atomfirmware.h"<br>
>   #include "atom.h"<br>
>   #include "atom-names.h"<br>
>   #include "atom-bits.h"<br>
> @@ -1299,12 +1300,168 @@ static void atom_index_iio(struct atom_context *ctx, int base)<br>
>        }<br>
>   }<br>
>   <br>
> +static void atom_get_vbios_name(struct atom_context *ctx) {<br>
> +     unsigned char *p_rom;<br>
> +     unsigned char str_num;<br>
> +     unsigned short off_to_vbios_str;<br>
> +     unsigned char *c_ptr;<br>
> +     int name_size;<br>
> +     int i;<br>
> +<br>
> +     const char *na = "--N/A--";<br>
> +     char *back;<br>
> +<br>
> +     p_rom = ctx->bios;<br>
> +<br>
> +     str_num = *(p_rom + OFFSET_TO_GET_ATOMBIOS_NUMBER_OF_STRINGS);<br>
> +     if (str_num != 0) {<br>
> +             off_to_vbios_str =<br>
> +                     *(unsigned short *)(p_rom + OFFSET_TO_GET_ATOMBIOS_STRING_START);<br>
> +<br>
> +             c_ptr = (unsigned char *)(p_rom + off_to_vbios_str);<br>
> +     } else {<br>
> +             /* do not know where to find name */<br>
> +             memcpy(ctx->name, na, 7);<br>
> +             ctx->name[7] = 0;<br>
> +             return;<br>
> +     }<br>
> +<br>
> +     /*<br>
> +      * skip the atombios strings, usually 4<br>
> +      * 1st is P/N, 2nd is ASIC, 3rd is PCI type, 4th is Memory type<br>
> +      */<br>
> +     for (i = 0; i < str_num; i++) {<br>
> +             while (*c_ptr != 0)<br>
> +                     c_ptr++;<br>
> +             c_ptr++;<br>
> +     }<br>
> +<br>
> +     /* skip the following 2 chars: 0x0D 0x0A */<br>
> +     c_ptr += 2;<br>
> +<br>
> +     name_size = strnlen(c_ptr, STRLEN_LONG - 1);<br>
> +     memcpy(ctx->name, c_ptr, name_size);<br>
> +     back = ctx->name + name_size;<br>
> +     while ((*--back) == ' ')<br>
> +             ;<br>
> +     *(back + 1) = '\0';<br>
> +}<br>
> +<br>
> +static void atom_get_vbios_date(struct atom_context *ctx) {<br>
> +     unsigned char *p_rom;<br>
> +     unsigned char *date_in_rom;<br>
> +<br>
> +     p_rom = ctx->bios;<br>
> +<br>
> +     date_in_rom = p_rom + OFFSET_TO_VBIOS_DATE;<br>
> +<br>
> +     ctx->date[0] = '2';<br>
> +     ctx->date[1] = '0';<br>
> +     ctx->date[2] = date_in_rom[6];<br>
> +     ctx->date[3] = date_in_rom[7];<br>
> +     ctx->date[4] = '/';<br>
> +     ctx->date[5] = date_in_rom[0];<br>
> +     ctx->date[6] = date_in_rom[1];<br>
> +     ctx->date[7] = '/';<br>
> +     ctx->date[8] = date_in_rom[3];<br>
> +     ctx->date[9] = date_in_rom[4];<br>
> +     ctx->date[10] = ' ';<br>
> +     ctx->date[11] = date_in_rom[9];<br>
> +     ctx->date[12] = date_in_rom[10];<br>
> +     ctx->date[13] = date_in_rom[11];<br>
> +     ctx->date[14] = date_in_rom[12];<br>
> +     ctx->date[15] = date_in_rom[13];<br>
> +     ctx->date[16] = '\0';<br>
> +}<br>
> +<br>
> +static unsigned char *atom_find_str_in_rom(struct atom_context *ctx, char *str, int start,<br>
> +                                        int end, int maxlen)<br>
> +{<br>
> +     unsigned long str_off;<br>
> +     unsigned char *p_rom;<br>
> +     unsigned short str_len;<br>
> +<br>
> +     str_off = 0;<br>
> +     str_len = strnlen(str, maxlen);<br>
> +     p_rom = ctx->bios;<br>
> +<br>
> +     for (; start <= end; ++start) {<br>
> +             for (str_off = 0; str_off < str_len; ++str_off) {<br>
> +                     if (str[str_off] != *(p_rom + start + str_off))<br>
> +                             break;<br>
> +             }<br>
> +<br>
> +             if (str_off == str_len || str[str_off] == 0)<br>
> +                     return p_rom + start;<br>
> +     }<br>
> +     return NULL;<br>
> +}<br>
> +<br>
> +static void atom_get_vbios_pn(struct atom_context *ctx) {<br>
> +     unsigned char *p_rom;<br>
> +     unsigned short off_to_vbios_str;<br>
> +     unsigned char *vbios_str;<br>
> +     int count;<br>
> +<br>
> +     off_to_vbios_str = 0;<br>
> +     p_rom = ctx->bios;<br>
> +<br>
> +     if (*(p_rom + OFFSET_TO_GET_ATOMBIOS_NUMBER_OF_STRINGS) != 0) {<br>
> +             off_to_vbios_str =<br>
> +                     *(unsigned short *)(p_rom + OFFSET_TO_GET_ATOMBIOS_STRING_START);<br>
> +<br>
> +             vbios_str = (unsigned char *)(p_rom + off_to_vbios_str);<br>
> +     } else {<br>
> +             vbios_str = p_rom + OFFSET_TO_VBIOS_PART_NUMBER;<br>
> +     }<br>
> +<br>
> +     if (*vbios_str == 0) {<br>
> +             vbios_str = atom_find_str_in_rom(ctx, BIOS_ATOM_PREFIX, 3, 1024, 64);<br>
> +             if (vbios_str == NULL)<br>
> +                     vbios_str += sizeof(BIOS_ATOM_PREFIX) - 1;<br>
> +     }<br>
> +     if (vbios_str != NULL && *vbios_str == 0)<br>
> +             vbios_str++;<br>
> +<br>
> +     if (vbios_str != NULL) {<br>
> +             count = 0;<br>
> +             while ((count < BIOS_STRING_LENGTH) && vbios_str[count] >= ' ' &&<br>
> +                    vbios_str[count] <= 'z') {<br>
> +                     ctx->vbios_pn[count] = vbios_str[count];<br>
> +                     count++;<br>
> +             }<br>
> +<br>
> +             ctx->vbios_pn[count] = 0;<br>
> +     }<br>
> +}<br>
> +<br>
> +static void atom_get_vbios_version(struct atom_context *ctx) {<br>
> +     unsigned char *vbios_ver;<br>
> +<br>
> +     /* find anchor ATOMBIOSBK-AMD */<br>
> +     vbios_ver = atom_find_str_in_rom(ctx, BIOS_VERSION_PREFIX, 3, 1024, 64);<br>
> +     if (vbios_ver != NULL) {<br>
> +             /* skip ATOMBIOSBK-AMD VER */<br>
> +             vbios_ver += 18;<br>
> +             memcpy(ctx->vbios_ver_str, vbios_ver, STRLEN_NORMAL);<br>
> +     } else {<br>
> +             ctx->vbios_ver_str[0] = '\0';<br>
> +     }<br>
> +}<br>
> +<br>
>   struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)  {<br>
>        int base;<br>
>        struct atom_context *ctx =<br>
>            kzalloc(sizeof(struct atom_context), GFP_KERNEL);<br>
>        char *str;<br>
> +     struct _ATOM_ROM_HEADER *atom_rom_header;<br>
> +     struct _ATOM_MASTER_DATA_TABLE *master_table;<br>
> +     struct _ATOM_FIRMWARE_INFO *atom_fw_info;<br>
>        u16 idx;<br>
>   <br>
>        if (!ctx)<br>
> @@ -1353,6 +1510,23 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)<br>
>                strlcpy(ctx->vbios_version, str, sizeof(ctx->vbios_version));<br>
>        }<br>
>   <br>
> +     atom_rom_header = (struct _ATOM_ROM_HEADER *)CSTR(base);<br>
> +     ctx->sub_dev_id = atom_rom_header->usSubsystemVendorID;<br>
> +     ctx->sub_ved_id = atom_rom_header->usSubsystemID;<br>
> +     if (atom_rom_header->usMasterDataTableOffset != 0) {<br>
> +             master_table = (struct _ATOM_MASTER_DATA_TABLE *)<br>
> +                             CSTR(atom_rom_header->usMasterDataTableOffset);<br>
> +             if (master_table->ListOfDataTables.FirmwareInfo != 0) {<br>
> +                     atom_fw_info = (struct _ATOM_FIRMWARE_INFO *)<br>
> +                                     CSTR(master_table->ListOfDataTables.FirmwareInfo);<br>
> +                     ctx->version = atom_fw_info->ulFirmwareRevision;<br>
> +             }<br>
> +     }<br>
> +<br>
> +     atom_get_vbios_name(ctx);<br>
> +     atom_get_vbios_pn(ctx);<br>
> +     atom_get_vbios_date(ctx);<br>
> +     atom_get_vbios_version(ctx);<br>
>   <br>
>        return ctx;<br>
>   }<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/atom.h <br>
> b/drivers/gpu/drm/amd/amdgpu/atom.h<br>
> index d279759cab47..6463ce6e756d 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/atom.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/atom.h<br>
> @@ -112,6 +112,10 @@ struct drm_device;<br>
>   #define ATOM_IO_SYSIO               2<br>
>   #define ATOM_IO_IIO         0x80<br>
>   <br>
> +#define STRLEN_NORMAL                32<br>
> +#define STRLEN_LONG          64<br>
> +#define STRLEN_VERYLONG              254<br>
> +<br>
>   struct card_info {<br>
>        struct drm_device *dev;<br>
>        void (* reg_write)(struct card_info *, uint32_t, uint32_t);   /*  filled by driver */<br>
> @@ -140,6 +144,14 @@ struct atom_context {<br>
>        uint32_t *scratch;<br>
>        int scratch_size_bytes;<br>
>        char vbios_version[20];<br>
> +<br>
> +     uint8_t name[STRLEN_LONG];<br>
> +     uint8_t vbios_pn[STRLEN_LONG];<br>
> +     uint32_t version;<br>
> +     uint8_t vbios_ver_str[STRLEN_NORMAL];<br>
> +     uint8_t date[STRLEN_NORMAL];<br>
> +     uint32_t sub_dev_id;<br>
> +     uint32_t sub_ved_id;<br>
>   };<br>
>   <br>
>   extern int amdgpu_atom_debug;<br>
> diff --git a/drivers/gpu/drm/amd/include/atomfirmware.h <br>
> b/drivers/gpu/drm/amd/include/atomfirmware.h<br>
> index 275468e4be60..28deecc2f990 100644<br>
> --- a/drivers/gpu/drm/amd/include/atomfirmware.h<br>
> +++ b/drivers/gpu/drm/amd/include/atomfirmware.h<br>
> @@ -197,6 +197,9 @@ enum atom_dp_vs_preemph_def{<br>
>     DP_VS_LEVEL0_PREEMPH_LEVEL3 = 0x18,<br>
>   };<br>
>   <br>
> +#define BIOS_ATOM_PREFIX   "ATOMBIOS"<br>
> +#define BIOS_VERSION_PREFIX  "ATOMBIOSBK-AMD"<br>
> +#define BIOS_STRING_LENGTH 43<br>
>   <br>
>   /*<br>
>   enum atom_string_def{<br>
> @@ -215,6 +218,8 @@ enum atombios_image_offset{<br>
>     MAXSIZE_OF_ATOMBIOS_ASIC_BUS_MEM_TYPE      = 20,  /*including the terminator 0x0!*/<br>
>     OFFSET_TO_GET_ATOMBIOS_NUMBER_OF_STRINGS   = 0x2f,<br>
>     OFFSET_TO_GET_ATOMBIOS_STRING_START        = 0x6e,<br>
> +  OFFSET_TO_VBIOS_PART_NUMBER                = 0x80,<br>
> +  OFFSET_TO_VBIOS_DATE                       = 0x50,<br>
>   };<br>
>   <br>
>   <br>
> /*********************************************************************<br>
> ******* diff --git a/include/uapi/drm/amdgpu_drm.h <br>
> b/include/uapi/drm/amdgpu_drm.h index 9169df7fadee..e0f98ca9a755 <br>
> 100644<br>
> --- a/include/uapi/drm/amdgpu_drm.h<br>
> +++ b/include/uapi/drm/amdgpu_drm.h<br>
> @@ -756,6 +756,8 @@ struct drm_amdgpu_cs_chunk_data {<br>
>        #define AMDGPU_INFO_VBIOS_SIZE          0x1<br>
>        /* Subquery id: Query vbios image */<br>
>        #define AMDGPU_INFO_VBIOS_IMAGE         0x2<br>
> +     /* Subquery id: Query vbios info */<br>
> +     #define AMDGPU_INFO_VBIOS_INFO          0x3<br>
>   /* Query UVD handles */<br>
>   #define AMDGPU_INFO_NUM_HANDLES                     0x1C<br>
>   /* Query sensor related information */ @@ -949,6 +951,20 @@ struct <br>
> drm_amdgpu_info_firmware {<br>
>        __u32 feature;<br>
>   };<br>
>   <br>
> +struct drm_amdgpu_info_vbios {<br>
> +     __u8 name[64];<br>
> +     __u32 dbdf;<br>
> +     __u8 vbios_pn[64];<br>
> +     __u32 version;<br>
> +     __u8 vbios_ver_str[32];<br>
> +     __u8 date[32];<br>
> +     __u64 serial;<br>
> +     __u32 dev_id;<br>
> +     __u32 rev_id;<br>
> +     __u32 sub_dev_id;<br>
> +     __u32 sub_ved_id;<br>
> +};<br>
> +<br>
>   #define AMDGPU_VRAM_TYPE_UNKNOWN 0<br>
>   #define AMDGPU_VRAM_TYPE_GDDR1 1<br>
>   #define AMDGPU_VRAM_TYPE_DDR2  2<br>
> --<br>
> 2.17.1<o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>