drm/amdgpu: Add vbios version string
Subsystems (3)
PATCH 1/1 drm/amdgpu: Add vbios version string
Expose XXX.XXX.XXX.XXX.XXXXXX vbios version string in AMDGPU_INFO_VBIOS_INFO ioctl
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++ drivers/gpu/drm/amd/amdgpu/atom.c | 16 ++++++++++++++++ drivers/gpu/drm/amd/amdgpu/atom.h | 1 + drivers/gpu/drm/amd/include/atomfirmware.h | 1 + include/uapi/drm/amdgpu_drm.h | 1 + 5 files changed, 21 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
@@ -870,6 +870,8 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) vbios_info.dbdf =PCI_DEVID (adev->pdev->bus->number, adev->pdev->devfn);memcpy (vbios_info.vbios_pn, atom_context->vbios_pn,sizeof (atom_context->vbios_pn)); vbios_info.version = atom_context->version; +memcpy (vbios_info.vbios_ver_str, atom_context->vbios_ver_str, +sizeof (atom_context->vbios_ver_str));memcpy (vbios_info.date, atom_context->date,sizeof (atom_context->date)); vbios_info.serial = adev->unique_id; vbios_info.dev_id = adev->pdev->device;
drivers/gpu/drm/amd/amdgpu/atom.c +16 -0
@@ -1438,6 +1438,21 @@ static void atom_get_vbios_pn(struct atom_context *ctx) } } +static void atom_get_vbios_version (struct atom_context *ctx) +{ +unsigned char *vbios_ver; + +/* find anchor ATOMBIOSBK-AMD */ + vbios_ver =atom_find_str_in_rom (ctx,BIOS_VERSION_PREFIX ,3 ,1024 ,64 ); +if (vbios_ver !=NULL ) { +/* skip ATOMBIOSBK-AMD VER */ + vbios_ver +=18 ; +memcpy (ctx->vbios_ver_str, vbios_ver,STRLEN_NORMAL ); + }else { + ctx->vbios_ver_str[0 ] ='\0' ; + } +} +struct atom_context *amdgpu_atom_parse (struct card_info *card,void *bios) {int base;
@@ -1511,6 +1526,7 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)atom_get_vbios_name (ctx);atom_get_vbios_pn (ctx);atom_get_vbios_date (ctx); +atom_get_vbios_version (ctx);return ctx; }
drivers/gpu/drm/amd/amdgpu/atom.h +1 -0
@@ -148,6 +148,7 @@ struct atom_context {uint8_t name[STRLEN_LONG ];uint8_t vbios_pn[STRLEN_LONG ];uint32_t version; +uint8_t vbios_ver_str[STRLEN_NORMAL ];uint8_t date[STRLEN_NORMAL ];uint32_t sub_dev_id;uint32_t sub_ved_id;
drivers/gpu/drm/amd/include/atomfirmware.h +1 -0
@@ -198,6 +198,7 @@ enum atom_dp_vs_preemph_def{ };#define BIOS_ATOM_PREFIX "ATOMBIOS" +#define BIOS_VERSION_PREFIX "ATOMBIOSBK-AMD"#define BIOS_STRING_LENGTH 43/*
include/uapi/drm/amdgpu_drm.h +1 -0
@@ -956,6 +956,7 @@ struct drm_amdgpu_info_vbios {__u32 dbdf;__u8 vbios_pn[64 ];__u32 version; +__u8 vbios_ver_str[32 ];__u8 date[32 ];__u64 serial;__u32 dev_id;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Hi all,
I know the vbios ioctl discussion is not settled down yet.
Please just regard this patch as a proposal to include vbios version string info into discussion.
Best regards,
Jiawei
-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Monday, May 17, 2021 6:22 PM
To: [email protected]; Koenig, Christian <[email protected]>; Nieto, David M <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Add vbios version string
Expose XXX.XXX.XXX.XXX.XXXXXX vbios version string in AMDGPU_INFO_VBIOS_INFO ioctl
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++ drivers/gpu/drm/amd/amdgpu/atom.c | 16 ++++++++++++++++ drivers/gpu/drm/amd/amdgpu/atom.h | 1 + drivers/gpu/drm/amd/include/atomfirmware.h | 1 + include/uapi/drm/amdgpu_drm.h | 1 + 5 files changed, 21 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
@@ -870,6 +870,8 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) vbios_info.dbdf =PCI_DEVID (adev->pdev->bus->number, adev->pdev->devfn);memcpy (vbios_info.vbios_pn, atom_context->vbios_pn,sizeof (atom_context->vbios_pn)); vbios_info.version = atom_context->version; +memcpy (vbios_info.vbios_ver_str, atom_context->vbios_ver_str, +sizeof (atom_context->vbios_ver_str));memcpy (vbios_info.date, atom_context->date,sizeof (atom_context->date)); vbios_info.serial = adev->unique_id; vbios_info.dev_id = adev->pdev->device; diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 0e2f0ea13b40..542b2c2414e4 100644
drivers/gpu/drm/amd/amdgpu/atom.c +15 -0
@@ -1438,6 +1438,21 @@ static void atom_get_vbios_pn(struct atom_context *ctx) } } +static void atom_get_vbios_version (struct atom_context *ctx) { +unsigned char *vbios_ver; + +/* find anchor ATOMBIOSBK-AMD */ + vbios_ver =atom_find_str_in_rom (ctx,BIOS_VERSION_PREFIX ,3 ,1024 ,64 ); +if (vbios_ver !=NULL ) { +/* skip ATOMBIOSBK-AMD VER */ + vbios_ver +=18 ; +memcpy (ctx->vbios_ver_str, vbios_ver,STRLEN_NORMAL ); + }else { + ctx->vbios_ver_str[0 ] ='\0' ; + } +} +struct atom_context *amdgpu_atom_parse (struct card_info *card,void *bios) {int base;
@@ -1511,6 +1526,7 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)atom_get_vbios_name (ctx);atom_get_vbios_pn (ctx);atom_get_vbios_date (ctx); +atom_get_vbios_version (ctx);return ctx; }
drivers/gpu/drm/amd/amdgpu/atom.h +1 -0
@@ -148,6 +148,7 @@ struct atom_context {uint8_t name[STRLEN_LONG ];uint8_t vbios_pn[STRLEN_LONG ];uint32_t version; +uint8_t vbios_ver_str[STRLEN_NORMAL ];uint8_t date[STRLEN_NORMAL ];uint32_t sub_dev_id;uint32_t sub_ved_id;
drivers/gpu/drm/amd/include/atomfirmware.h +1 -0
@@ -198,6 +198,7 @@ enum atom_dp_vs_preemph_def{ };#define BIOS_ATOM_PREFIX "ATOMBIOS" +#define BIOS_VERSION_PREFIX "ATOMBIOSBK-AMD"#define BIOS_STRING_LENGTH 43/*
include/uapi/drm/amdgpu_drm.h +1 -0
@@ -956,6 +956,7 @@ struct drm_amdgpu_info_vbios {__u32 dbdf;__u8 vbios_pn[64 ];__u32 version; +__u8 vbios_ver_str[32 ];__u8 date[32 ];__u64 serial;__u32 dev_id;
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi Jiawei,
yes agree and additional to that we need to go a step back here.
First of all once uAPI headers are added you are not allowed to change them again.
So this iterative approach where more and more fields to the structure is really a NO-GO.
Instead please revert all patches already pushed amd-staging-drm-next and then squash together all patches and send the result to the mailing list for discussion.
This way we can review and verify the uAPI as a whole and not in individual steps.
Regards,
Christian.
Am 17.05.21 um 12:28 schrieb Gu, JiaWei (Will):
Quoted 107 lines
[AMD Official Use Only - Internal Distribution Only]
Hi all,
I know the vbios ioctl discussion is not settled down yet.
Please just regard this patch as a proposal to include vbios version string info into discussion.Best regards,
Jiawei-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Monday, May 17, 2021 6:22 PM
To: [email protected]; Koenig, Christian <[email protected]>; Nieto, David M <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Add vbios version stringExpose XXX.XXX.XXX.XXX.XXXXXX vbios version string in
AMDGPU_INFO_VBIOS_INFOioctlSigned-off-by Jiawei Gu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++ drivers/gpu/drm/amd/amdgpu/atom.c | 16 ++++++++++++++++ drivers/gpu/drm/amd/amdgpu/atom.h | 1 + drivers/gpu/drm/amd/include/atomfirmware.h | 1 + include/uapi/drm/amdgpu_drm.h | 1 + 5 files changed, 21 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2
-0@@ -870,6 +870,8 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) vbios_info.dbdf =PCI_DEVID (adev->pdev->bus->number, adev->pdev->devfn);memcpy (vbios_info.vbios_pn, atom_context->vbios_pn,sizeof (atom_context->vbios_pn)); vbios_info.version = atom_context->version; +memcpy (vbios_info.vbios_ver_str, atom_context->vbios_ver_str, +sizeof (atom_context->vbios_ver_str));memcpy (vbios_info.date, atom_context->date,sizeof (atom_context->date)); vbios_info.serial = adev->unique_id; vbios_info.dev_id = adev->pdev->device; diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.cindex
0e2f0ea13b40..542b2c2414e4100644drivers/gpu/drm/amd/amdgpu/atom.c +15
-0@@ -1438,6 +1438,21 @@ static void atom_get_vbios_pn(struct atom_context *ctx) } } +static void atom_get_vbios_version (struct atom_context *ctx) { +unsigned char *vbios_ver; + +/* find anchor ATOMBIOSBK-AMD */ + vbios_ver =atom_find_str_in_rom (ctx,BIOS_VERSION_PREFIX ,3 ,1024 ,64 ); +if (vbios_ver !=NULL ) { +/* skip ATOMBIOSBK-AMD VER */ + vbios_ver +=18 ; +memcpy (ctx->vbios_ver_str, vbios_ver,STRLEN_NORMAL ); + }else { + ctx->vbios_ver_str[0 ] ='\0' ; + } +} +struct atom_context *amdgpu_atom_parse (struct card_info *card,void *bios) {int base;@@ -1511,6 +1526,7 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)atom_get_vbios_name (ctx);atom_get_vbios_pn (ctx);atom_get_vbios_date (ctx); +atom_get_vbios_version (ctx);return ctx; }drivers/gpu/drm/amd/amdgpu/atom.h +1
-0@@ -148,6 +148,7 @@ struct atom_context {uint8_t name[STRLEN_LONG ];uint8_t vbios_pn[STRLEN_LONG ];uint32_t version; +uint8_t vbios_ver_str[STRLEN_NORMAL ];uint8_t date[STRLEN_NORMAL ];uint32_t sub_dev_id;uint32_t sub_ved_id;drivers/gpu/drm/amd/include/atomfirmware.h +1
-0@@ -198,6 +198,7 @@ enum atom_dp_vs_preemph_def{ };#define BIOS_ATOM_PREFIX "ATOMBIOS" +#define BIOS_VERSION_PREFIX "ATOMBIOSBK-AMD"#define BIOS_STRING_LENGTH 43/* include/uapi/drm/amdgpu_drm.h +1
-1@@ -956,6 +956,7 @@ struct drm_amdgpu_info_vbios {__u32 dbdf;__u8 vbios_pn[64 ];__u32 version; +__u8 vbios_ver_str[32 ];__u8 date[32 ];__u64 serial;__u32 dev_id; --
Quoted 5 lines
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx