mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
drm/xe/guc: Allow to print single KLV
We can decode and print all KLVs from the buffer, but it might be helpful also to allow printing just single already decoded KLV. Extract existing code into new function and make it public. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-2-michal.wajdeczko@intel.com
This commit is contained in:
parent
f3fbb5e5f7
commit
2245d3d1a6
|
|
@ -78,6 +78,39 @@ const char *xe_guc_klv_key_to_string(u16 key)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_guc_klv_print_one() - Print single `GuC KLV`_.
|
||||
* @key: KLV key
|
||||
* @len: KLV length (in u32 dwords) of the KLV @value
|
||||
* @value: KLV value (as array of @len u32 dwords)
|
||||
* @p: the &drm_printer
|
||||
*
|
||||
* The buffer may contain more than one KLV.
|
||||
*/
|
||||
void xe_guc_klv_print_one(u16 key, u16 len, const u32 *value, struct drm_printer *p)
|
||||
{
|
||||
const char *name = xe_guc_klv_key_to_string(key);
|
||||
|
||||
switch (len) {
|
||||
case 0:
|
||||
drm_printf(p, "{ key %#06x : no value } # %s\n", key, name);
|
||||
break;
|
||||
case 1:
|
||||
drm_printf(p, "{ key %#06x : 32b value %u } # %s\n",
|
||||
key, value[0], name);
|
||||
break;
|
||||
case 2:
|
||||
drm_printf(p, "{ key %#06x : 64b value %#llx } # %s\n",
|
||||
key, make_u64(value[1], value[0]), name);
|
||||
break;
|
||||
default:
|
||||
drm_printf(p, "{ key %#06x : %zu bytes %*ph } # %s\n",
|
||||
key, len * sizeof(u32), (int)(len * sizeof(u32)),
|
||||
value, name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_guc_klv_print - Print content of the buffer with `GuC KLV`_.
|
||||
* @klvs: the buffer with KLVs
|
||||
|
|
@ -103,26 +136,7 @@ void xe_guc_klv_print(const u32 *klvs, u32 num_dwords, struct drm_printer *p)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (len) {
|
||||
case 0:
|
||||
drm_printf(p, "{ key %#06x : no value } # %s\n",
|
||||
key, xe_guc_klv_key_to_string(key));
|
||||
break;
|
||||
case 1:
|
||||
drm_printf(p, "{ key %#06x : 32b value %u } # %s\n",
|
||||
key, klvs[0], xe_guc_klv_key_to_string(key));
|
||||
break;
|
||||
case 2:
|
||||
drm_printf(p, "{ key %#06x : 64b value %#llx } # %s\n",
|
||||
key, make_u64(klvs[1], klvs[0]),
|
||||
xe_guc_klv_key_to_string(key));
|
||||
break;
|
||||
default:
|
||||
drm_printf(p, "{ key %#06x : %zu bytes %*ph } # %s\n",
|
||||
key, len * sizeof(u32), (int)(len * sizeof(u32)),
|
||||
klvs, xe_guc_klv_key_to_string(key));
|
||||
break;
|
||||
}
|
||||
xe_guc_klv_print_one(key, len, klvs, p);
|
||||
|
||||
klvs += len;
|
||||
num_dwords -= len;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ struct drm_printer;
|
|||
|
||||
const char *xe_guc_klv_key_to_string(u16 key);
|
||||
|
||||
void xe_guc_klv_print_one(u16 key, u16 len, const u32 *value, struct drm_printer *p);
|
||||
void xe_guc_klv_print(const u32 *klvs, u32 num_dwords, struct drm_printer *p);
|
||||
int xe_guc_klv_count(const u32 *klvs, u32 num_dwords);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user