Lines Matching refs:dev

96 static void amdgpu_device_free_internal(amdgpu_device_handle dev)  in amdgpu_device_free_internal()  argument
101 while (*node != dev && (*node)->next) in amdgpu_device_free_internal()
106 close(dev->fd); in amdgpu_device_free_internal()
107 if ((dev->flink_fd >= 0) && (dev->fd != dev->flink_fd)) in amdgpu_device_free_internal()
108 close(dev->flink_fd); in amdgpu_device_free_internal()
110 amdgpu_vamgr_deinit(&dev->vamgr_32); in amdgpu_device_free_internal()
111 amdgpu_vamgr_deinit(&dev->vamgr); in amdgpu_device_free_internal()
112 amdgpu_vamgr_deinit(&dev->vamgr_high_32); in amdgpu_device_free_internal()
113 amdgpu_vamgr_deinit(&dev->vamgr_high); in amdgpu_device_free_internal()
114 handle_table_fini(&dev->bo_handles); in amdgpu_device_free_internal()
115 handle_table_fini(&dev->bo_flink_names); in amdgpu_device_free_internal()
116 pthread_mutex_destroy(&dev->bo_table_mutex); in amdgpu_device_free_internal()
117 free(dev->marketing_name); in amdgpu_device_free_internal()
118 free(dev); in amdgpu_device_free_internal()
148 struct amdgpu_device *dev; in amdgpu_device_initialize() local
167 for (dev = dev_list; dev; dev = dev->next) in amdgpu_device_initialize()
168 if (fd_compare(dev->fd, fd) == 0) in amdgpu_device_initialize()
171 if (dev) { in amdgpu_device_initialize()
172 r = amdgpu_get_auth(dev->fd, &flag_authexist); in amdgpu_device_initialize()
180 dev->flink_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); in amdgpu_device_initialize()
182 *major_version = dev->major_version; in amdgpu_device_initialize()
183 *minor_version = dev->minor_version; in amdgpu_device_initialize()
184 amdgpu_device_reference(device_handle, dev); in amdgpu_device_initialize()
189 dev = calloc(1, sizeof(struct amdgpu_device)); in amdgpu_device_initialize()
190 if (!dev) { in amdgpu_device_initialize()
196 dev->fd = -1; in amdgpu_device_initialize()
197 dev->flink_fd = -1; in amdgpu_device_initialize()
199 atomic_set(&dev->refcount, 1); in amdgpu_device_initialize()
214 dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); in amdgpu_device_initialize()
215 dev->flink_fd = dev->fd; in amdgpu_device_initialize()
216 dev->major_version = version->version_major; in amdgpu_device_initialize()
217 dev->minor_version = version->version_minor; in amdgpu_device_initialize()
220 pthread_mutex_init(&dev->bo_table_mutex, NULL); in amdgpu_device_initialize()
223 r = amdgpu_query_info(dev, AMDGPU_INFO_ACCEL_WORKING, 4, &accel_working); in amdgpu_device_initialize()
235 r = amdgpu_query_gpu_info_init(dev); in amdgpu_device_initialize()
241 start = dev->dev_info.virtual_address_offset; in amdgpu_device_initialize()
242 max = MIN2(dev->dev_info.virtual_address_max, 0x100000000ULL); in amdgpu_device_initialize()
243 amdgpu_vamgr_init(&dev->vamgr_32, start, max, in amdgpu_device_initialize()
244 dev->dev_info.virtual_address_alignment); in amdgpu_device_initialize()
247 max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL); in amdgpu_device_initialize()
248 amdgpu_vamgr_init(&dev->vamgr, start, max, in amdgpu_device_initialize()
249 dev->dev_info.virtual_address_alignment); in amdgpu_device_initialize()
251 start = dev->dev_info.high_va_offset; in amdgpu_device_initialize()
252 max = MIN2(dev->dev_info.high_va_max, (start & ~0xffffffffULL) + in amdgpu_device_initialize()
254 amdgpu_vamgr_init(&dev->vamgr_high_32, start, max, in amdgpu_device_initialize()
255 dev->dev_info.virtual_address_alignment); in amdgpu_device_initialize()
258 max = MAX2(dev->dev_info.high_va_max, (start & ~0xffffffffULL) + in amdgpu_device_initialize()
260 amdgpu_vamgr_init(&dev->vamgr_high, start, max, in amdgpu_device_initialize()
261 dev->dev_info.virtual_address_alignment); in amdgpu_device_initialize()
263 amdgpu_parse_asic_ids(dev); in amdgpu_device_initialize()
265 *major_version = dev->major_version; in amdgpu_device_initialize()
266 *minor_version = dev->minor_version; in amdgpu_device_initialize()
267 *device_handle = dev; in amdgpu_device_initialize()
268 dev->next = dev_list; in amdgpu_device_initialize()
269 dev_list = dev; in amdgpu_device_initialize()
275 if (dev->fd >= 0) in amdgpu_device_initialize()
276 close(dev->fd); in amdgpu_device_initialize()
277 free(dev); in amdgpu_device_initialize()
282 drm_public int amdgpu_device_deinitialize(amdgpu_device_handle dev) in amdgpu_device_deinitialize() argument
284 amdgpu_device_reference(&dev, NULL); in amdgpu_device_deinitialize()
288 drm_public const char *amdgpu_get_marketing_name(amdgpu_device_handle dev) in amdgpu_get_marketing_name() argument
290 return dev->marketing_name; in amdgpu_get_marketing_name()
293 drm_public int amdgpu_query_sw_info(amdgpu_device_handle dev, in amdgpu_query_sw_info() argument
301 if (dev->vamgr_high_32.va_max) in amdgpu_query_sw_info()
302 *val32 = (dev->vamgr_high_32.va_max - 1) >> 32; in amdgpu_query_sw_info()
304 *val32 = (dev->vamgr_32.va_max - 1) >> 32; in amdgpu_query_sw_info()