aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák2018-02-02 11:15:00 -0600
committerMarek Olšák2018-02-09 13:30:16 -0600
commitad5b702fec3f9cb54feeb403e7b31c10ebc0ca7c (patch)
treeacc913e75267852b1e6030093146ce84700e96a9
parentdeb59781fcc1183e19cca67e2db35c2e21f40ed5 (diff)
downloadexternal-libgbm-ad5b702fec3f9cb54feeb403e7b31c10ebc0ca7c.tar.gz
external-libgbm-ad5b702fec3f9cb54feeb403e7b31c10ebc0ca7c.tar.xz
external-libgbm-ad5b702fec3f9cb54feeb403e7b31c10ebc0ca7c.zip
amdgpu: add amdgpu_query_sw_info for querying high bits of 32-bit address space
Reviewed-by: Christian König <christian.koenig@amd.com>
-rw-r--r--amdgpu/amdgpu.h21
-rw-r--r--amdgpu/amdgpu_device.c14
-rw-r--r--amdgpu/amdgpu_internal.h1
3 files changed, 36 insertions, 0 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 2eb03bf1..928b2a68 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -94,6 +94,10 @@ enum amdgpu_gpu_va_range
94 amdgpu_gpu_va_range_general = 0 94 amdgpu_gpu_va_range_general = 0
95}; 95};
96 96
97enum amdgpu_sw_info {
98 amdgpu_sw_info_address32_hi = 0,
99};
100
97/*--------------------------------------------------------------------------*/ 101/*--------------------------------------------------------------------------*/
98/* -------------------------- Datatypes ----------------------------------- */ 102/* -------------------------- Datatypes ----------------------------------- */
99/*--------------------------------------------------------------------------*/ 103/*--------------------------------------------------------------------------*/
@@ -1086,6 +1090,23 @@ int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
1086 unsigned size, void *value); 1090 unsigned size, void *value);
1087 1091
1088/** 1092/**
1093 * Query hardware or driver information.
1094 *
1095 * The return size is query-specific and depends on the "info_id" parameter.
1096 * No more than "size" bytes is returned.
1097 *
1098 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
1099 * \param info - \c [in] amdgpu_sw_info_*
1100 * \param value - \c [out] Pointer to the return value.
1101 *
1102 * \return 0 on success\n
1103 * <0 - Negative POSIX error code
1104 *
1105*/
1106int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info,
1107 void *value);
1108
1109/**
1089 * Query information about GDS 1110 * Query information about GDS
1090 * 1111 *
1091 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize() 1112 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index f34e27a9..6ee25a9e 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -275,6 +275,7 @@ int amdgpu_device_initialize(int fd,
275 max = MIN2(max, (start & ~0xffffffffULL) + 0x100000000ULL); 275 max = MIN2(max, (start & ~0xffffffffULL) + 0x100000000ULL);
276 amdgpu_vamgr_init(&dev->vamgr_32, start, max, 276 amdgpu_vamgr_init(&dev->vamgr_32, start, max,
277 dev->dev_info.virtual_address_alignment); 277 dev->dev_info.virtual_address_alignment);
278 dev->address32_hi = start >> 32;
278 279
279 start = max; 280 start = max;
280 if (dev->dev_info.high_va_offset && dev->dev_info.high_va_max) 281 if (dev->dev_info.high_va_offset && dev->dev_info.high_va_max)
@@ -312,3 +313,16 @@ const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
312{ 313{
313 return dev->marketing_name; 314 return dev->marketing_name;
314} 315}
316
317int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info,
318 void *value)
319{
320 uint32_t *val32 = (uint32_t*)value;
321
322 switch (info) {
323 case amdgpu_sw_info_address32_hi:
324 *val32 = dev->address32_hi;
325 return 0;
326 }
327 return -EINVAL;
328}
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 75276a99..dd0c3a61 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -73,6 +73,7 @@ struct amdgpu_device {
73 int flink_fd; 73 int flink_fd;
74 unsigned major_version; 74 unsigned major_version;
75 unsigned minor_version; 75 unsigned minor_version;
76 uint32_t address32_hi;
76 77
77 char *marketing_name; 78 char *marketing_name;
78 /** List of buffer handles. Protected by bo_table_mutex. */ 79 /** List of buffer handles. Protected by bo_table_mutex. */