From 1bf93d4e8970a44c4e37b1ee69d3dcdb832a910c Mon Sep 17 00:00:00 2001 From: Philip Yang Date: Fri, 9 Mar 2018 15:31:38 -0500 Subject: [PATCH] Export microcode version of sDMA Change-Id: I86fa5da5e72af13a2e76e6e3be4667a7220923d5 Signed-off-by: Philip Yang --- include/hsakmttypes.h | 18 +++++++++++++++--- src/topology.c | 11 +++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/include/hsakmttypes.h b/include/hsakmttypes.h index 3cb23e1121..107703e20d 100644 --- a/include/hsakmttypes.h +++ b/include/hsakmttypes.h @@ -150,10 +150,10 @@ typedef struct _HsaSystemProperties HSAuint32 PlatformRev; // HSA platform revision, reflects Platform Table Revision ID } HsaSystemProperties; -typedef union +typedef union { HSAuint32 Value; - struct + struct { unsigned int uCode : 10; // ucode packet processor version unsigned int Major : 6; // GFXIP Major engine version @@ -162,6 +162,17 @@ typedef union }ui32; } HSA_ENGINE_ID; +typedef union +{ + HSAuint32 Value; + struct + { + unsigned int uCodeSDMA: 10; // ucode version SDMA engine + unsigned int uCodeRes : 10; // ucode version (reserved) + unsigned int Reserved : 12; // Reserved, must be 0 + }; +} HSA_ENGINE_VERSION; + typedef union { HSAuint32 Value; @@ -251,7 +262,8 @@ typedef struct _HsaNodeProperties HSAuint16 MarketingName[HSA_PUBLIC_NAME_SIZE]; // Public name of the "device" on the node (board or APU name). // Unicode string HSAuint8 AMDName[HSA_PUBLIC_NAME_SIZE]; //CAL Name of the "device", ASCII - HSAuint8 Reserved[64]; + HSA_ENGINE_VERSION uCodeEngineVersions; + HSAuint8 Reserved[60]; } HsaNodeProperties; diff --git a/src/topology.c b/src/topology.c index 5dcceb9edb..5c9fdff594 100644 --- a/src/topology.c +++ b/src/topology.c @@ -740,7 +740,6 @@ HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id, char path[256]; unsigned long long prop_val; uint32_t i, prog, major, minor, step; - uint16_t fw_version = 0; int read_size; const struct hsa_gfxip_table *hsa_gfxip; char namebuf[HSA_PUBLIC_NAME_SIZE]; @@ -815,7 +814,7 @@ HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id, else if (strcmp(prop_name, "max_slots_scratch_cu") == 0) props->MaxSlotsScratchCU = (uint32_t)prop_val; else if (strcmp(prop_name, "fw_version") == 0) - fw_version = (uint16_t)prop_val; + props->EngineId.Value = (uint32_t)prop_val & 0x3ff; else if (strcmp(prop_name, "vendor_id") == 0) props->VendorId = (uint32_t)prop_val; else if (strcmp(prop_name, "device_id") == 0) @@ -830,14 +829,10 @@ HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id, props->LocalMemSize = prop_val; else if (strcmp(prop_name, "drm_render_minor") == 0) props->DrmRenderMinor = (int32_t)prop_val; - + else if (strcmp(prop_name, "sdma_fw_version") == 0) + props->uCodeEngineVersions.Value = (uint32_t)prop_val & 0x3ff; } - props->EngineId.ui32.uCode = fw_version & 0x3ff; - props->EngineId.ui32.Major = 0; - props->EngineId.ui32.Minor = 0; - props->EngineId.ui32.Stepping = 0; - hsa_gfxip = find_hsa_gfxip_device(props->DeviceId); if (hsa_gfxip) { envvar = getenv("HSA_OVERRIDE_GFX_VERSION");