Lines Matching refs:handle
31 typedef int bank_handler_t(struct aca_handle *handle, struct aca_bank *bank, enum aca_smu_type type…
204 static bool aca_bank_is_valid(struct aca_handle *handle, struct aca_bank *bank, enum aca_smu_type t… in aca_bank_is_valid() argument
206 const struct aca_bank_ops *bank_ops = handle->bank_ops; in aca_bank_is_valid()
208 if (!aca_bank_hwip_is_matched(bank, handle->hwip)) in aca_bank_is_valid()
214 return bank_ops->aca_bank_is_valid(handle, bank, type, handle->data); in aca_bank_is_valid()
282 int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_info *info, in aca_error_cache_log_bank_error() argument
285 struct aca_error_cache *error_cache = &handle->error_cache; in aca_error_cache_log_bank_error()
289 if (!handle || !info || type >= ACA_ERROR_TYPE_COUNT) in aca_error_cache_log_bank_error()
305 static int aca_bank_parser(struct aca_handle *handle, struct aca_bank *bank, enum aca_smu_type type) in aca_bank_parser() argument
307 const struct aca_bank_ops *bank_ops = handle->bank_ops; in aca_bank_parser()
315 return bank_ops->aca_bank_parser(handle, bank, type, in aca_bank_parser()
316 handle->data); in aca_bank_parser()
319 static int handler_aca_log_bank_error(struct aca_handle *handle, struct aca_bank *bank, in handler_aca_log_bank_error() argument
324 ret = aca_bank_parser(handle, bank, type); in handler_aca_log_bank_error()
334 struct aca_handle *handle; in aca_dispatch_bank() local
340 list_for_each_entry(handle, &mgr->list, node) { in aca_dispatch_bank()
341 if (!aca_bank_is_valid(handle, bank, type)) in aca_dispatch_bank()
344 ret = handler(handle, bank, type, data); in aca_dispatch_bank()
474 static int aca_log_aca_error(struct aca_handle *handle, enum aca_error_type type, struct ras_err_da… in aca_log_aca_error() argument
476 struct aca_error_cache *error_cache = &handle->error_cache; in aca_log_aca_error()
496 static int __aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *handle, enum aca_err… in __aca_get_error_data() argument
519 return aca_log_aca_error(handle, type, err_data); in __aca_get_error_data()
522 static bool aca_handle_is_valid(struct aca_handle *handle) in aca_handle_is_valid() argument
524 if (!handle->mask || !list_empty(&handle->node)) in aca_handle_is_valid()
530 int amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *handle, in amdgpu_aca_get_error_data() argument
534 if (!handle || !err_data) in amdgpu_aca_get_error_data()
537 if (aca_handle_is_valid(handle)) in amdgpu_aca_get_error_data()
540 if ((type < 0) || (!(BIT(type) & handle->mask))) in amdgpu_aca_get_error_data()
543 return __aca_get_error_data(adev, handle, type, err_data, qctx); in amdgpu_aca_get_error_data()
554 static void aca_init_error_cache(struct aca_handle *handle) in aca_init_error_cache() argument
556 struct aca_error_cache *error_cache = &handle->error_cache; in aca_init_error_cache()
578 static void aca_fini_error_cache(struct aca_handle *handle) in aca_fini_error_cache() argument
580 struct aca_error_cache *error_cache = &handle->error_cache; in aca_fini_error_cache()
587 …d_aca_handle(struct amdgpu_device *adev, struct aca_handle_manager *mgr, struct aca_handle *handle, in add_aca_handle() argument
590 memset(handle, 0, sizeof(*handle)); in add_aca_handle()
592 handle->adev = adev; in add_aca_handle()
593 handle->mgr = mgr; in add_aca_handle()
594 handle->name = name; in add_aca_handle()
595 handle->hwip = ras_info->hwip; in add_aca_handle()
596 handle->mask = ras_info->mask; in add_aca_handle()
597 handle->bank_ops = ras_info->bank_ops; in add_aca_handle()
598 handle->data = data; in add_aca_handle()
599 aca_init_error_cache(handle); in add_aca_handle()
601 INIT_LIST_HEAD(&handle->node); in add_aca_handle()
602 list_add_tail(&handle->node, &mgr->list); in add_aca_handle()
611 struct aca_handle *handle = container_of(attr, struct aca_handle, aca_attr); in aca_sysfs_read() local
615 return amdgpu_ras_aca_sysfs_read(dev, attr, handle, buf, handle->data); in aca_sysfs_read()
618 static int add_aca_sysfs(struct amdgpu_device *adev, struct aca_handle *handle) in add_aca_sysfs() argument
620 struct device_attribute *aca_attr = &handle->aca_attr; in add_aca_sysfs()
622 snprintf(handle->attr_name, sizeof(handle->attr_name) - 1, "aca_%s", handle->name); in add_aca_sysfs()
624 aca_attr->attr.name = handle->attr_name; in add_aca_sysfs()
633 int amdgpu_aca_add_handle(struct amdgpu_device *adev, struct aca_handle *handle, in amdgpu_aca_add_handle() argument
642 ret = add_aca_handle(adev, &aca->mgr, handle, name, ras_info, data); in amdgpu_aca_add_handle()
646 return add_aca_sysfs(adev, handle); in amdgpu_aca_add_handle()
649 static void remove_aca_handle(struct aca_handle *handle) in remove_aca_handle() argument
651 struct aca_handle_manager *mgr = handle->mgr; in remove_aca_handle()
653 aca_fini_error_cache(handle); in remove_aca_handle()
654 list_del(&handle->node); in remove_aca_handle()
658 static void remove_aca_sysfs(struct aca_handle *handle) in remove_aca_sysfs() argument
660 struct amdgpu_device *adev = handle->adev; in remove_aca_sysfs()
661 struct device_attribute *aca_attr = &handle->aca_attr; in remove_aca_sysfs()
669 void amdgpu_aca_remove_handle(struct aca_handle *handle) in amdgpu_aca_remove_handle() argument
671 if (!handle || list_empty(&handle->node)) in amdgpu_aca_remove_handle()
674 remove_aca_sysfs(handle); in amdgpu_aca_remove_handle()
675 remove_aca_handle(handle); in amdgpu_aca_remove_handle()
688 struct aca_handle *handle, *tmp; in aca_manager_fini() local
693 list_for_each_entry_safe(handle, tmp, &mgr->list, node) in aca_manager_fini()
694 amdgpu_aca_remove_handle(handle); in aca_manager_fini()
845 static int handler_aca_bank_dump(struct aca_handle *handle, struct aca_bank *bank, in handler_aca_bank_dump() argument
852 return handler_aca_log_bank_error(handle, bank, type, NULL); in handler_aca_bank_dump()