Lines Matching refs:hdev
28 int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name, in hl_fw_load_fw_to_device() argument
36 rc = request_firmware(&fw, fw_name, hdev->dev); in hl_fw_load_fw_to_device()
38 dev_err(hdev->dev, "Firmware file %s is not found!\n", fw_name); in hl_fw_load_fw_to_device()
44 dev_err(hdev->dev, "Illegal %s firmware size %zu\n", in hl_fw_load_fw_to_device()
50 dev_dbg(hdev->dev, "%s firmware size == %zu\n", fw_name, fw_size); in hl_fw_load_fw_to_device()
53 dev_err(hdev->dev, in hl_fw_load_fw_to_device()
69 int hl_fw_send_pci_access_msg(struct hl_device *hdev, u32 opcode) in hl_fw_send_pci_access_msg() argument
75 return hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, in hl_fw_send_pci_access_msg()
79 int hl_fw_send_cpu_message(struct hl_device *hdev, u32 hw_queue_id, u32 *msg, in hl_fw_send_cpu_message() argument
87 pkt = hdev->asic_funcs->cpu_accessible_dma_pool_alloc(hdev, len, in hl_fw_send_cpu_message()
90 dev_err(hdev->dev, in hl_fw_send_cpu_message()
97 mutex_lock(&hdev->send_cpu_message_lock); in hl_fw_send_cpu_message()
99 if (hdev->disabled) in hl_fw_send_cpu_message()
102 if (hdev->device_cpu_disabled) { in hl_fw_send_cpu_message()
107 rc = hl_hw_queue_send_cb_no_cmpl(hdev, hw_queue_id, len, pkt_dma_addr); in hl_fw_send_cpu_message()
109 dev_err(hdev->dev, "Failed to send CB on CPU PQ (%d)\n", rc); in hl_fw_send_cpu_message()
113 rc = hl_poll_timeout_memory(hdev, &pkt->fence, tmp, in hl_fw_send_cpu_message()
117 hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id); in hl_fw_send_cpu_message()
120 dev_err(hdev->dev, "Device CPU packet timeout (0x%x)\n", tmp); in hl_fw_send_cpu_message()
121 hdev->device_cpu_disabled = true; in hl_fw_send_cpu_message()
129 dev_err(hdev->dev, "F/W ERROR %d for CPU packet %d\n", in hl_fw_send_cpu_message()
139 mutex_unlock(&hdev->send_cpu_message_lock); in hl_fw_send_cpu_message()
141 hdev->asic_funcs->cpu_accessible_dma_pool_free(hdev, len, pkt); in hl_fw_send_cpu_message()
146 int hl_fw_unmask_irq(struct hl_device *hdev, u16 event_type) in hl_fw_unmask_irq() argument
158 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_fw_unmask_irq()
162 dev_err(hdev->dev, "failed to unmask RAZWI IRQ %d", event_type); in hl_fw_unmask_irq()
167 int hl_fw_unmask_irq_arr(struct hl_device *hdev, const u32 *irq_arr, in hl_fw_unmask_irq_arr() argument
183 dev_err(hdev->dev, "too many elements in IRQ array\n"); in hl_fw_unmask_irq_arr()
197 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) pkt, in hl_fw_unmask_irq_arr()
201 dev_err(hdev->dev, "failed to unmask IRQ array\n"); in hl_fw_unmask_irq_arr()
208 int hl_fw_test_cpu_queue(struct hl_device *hdev) in hl_fw_test_cpu_queue() argument
218 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &test_pkt, in hl_fw_test_cpu_queue()
223 dev_err(hdev->dev, in hl_fw_test_cpu_queue()
226 dev_err(hdev->dev, "CPU queue test failed, error %d\n", rc); in hl_fw_test_cpu_queue()
232 void *hl_fw_cpu_accessible_dma_pool_alloc(struct hl_device *hdev, size_t size, in hl_fw_cpu_accessible_dma_pool_alloc() argument
237 kernel_addr = gen_pool_alloc(hdev->cpu_accessible_dma_pool, size); in hl_fw_cpu_accessible_dma_pool_alloc()
239 *dma_handle = hdev->cpu_accessible_dma_address + in hl_fw_cpu_accessible_dma_pool_alloc()
240 (kernel_addr - (u64) (uintptr_t) hdev->cpu_accessible_dma_mem); in hl_fw_cpu_accessible_dma_pool_alloc()
245 void hl_fw_cpu_accessible_dma_pool_free(struct hl_device *hdev, size_t size, in hl_fw_cpu_accessible_dma_pool_free() argument
248 gen_pool_free(hdev->cpu_accessible_dma_pool, (u64) (uintptr_t) vaddr, in hl_fw_cpu_accessible_dma_pool_free()
252 int hl_fw_send_heartbeat(struct hl_device *hdev) in hl_fw_send_heartbeat() argument
262 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &hb_pkt, in hl_fw_send_heartbeat()
271 int hl_fw_cpucp_info_get(struct hl_device *hdev) in hl_fw_cpucp_info_get() argument
273 struct asic_fixed_properties *prop = &hdev->asic_prop; in hl_fw_cpucp_info_get()
281 hdev->asic_funcs->cpu_accessible_dma_pool_alloc(hdev, in hl_fw_cpucp_info_get()
285 dev_err(hdev->dev, in hl_fw_cpucp_info_get()
297 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_fw_cpucp_info_get()
300 dev_err(hdev->dev, in hl_fw_cpucp_info_get()
308 rc = hl_build_hwmon_channel_info(hdev, prop->cpucp_info.sensors); in hl_fw_cpucp_info_get()
310 dev_err(hdev->dev, in hl_fw_cpucp_info_get()
317 hdev->asic_funcs->cpu_accessible_dma_pool_free(hdev, in hl_fw_cpucp_info_get()
323 int hl_fw_get_eeprom_data(struct hl_device *hdev, void *data, size_t max_size) in hl_fw_get_eeprom_data() argument
332 hdev->asic_funcs->cpu_accessible_dma_pool_alloc(hdev, in hl_fw_get_eeprom_data()
335 dev_err(hdev->dev, in hl_fw_get_eeprom_data()
347 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_fw_get_eeprom_data()
351 dev_err(hdev->dev, in hl_fw_get_eeprom_data()
361 hdev->asic_funcs->cpu_accessible_dma_pool_free(hdev, max_size, in hl_fw_get_eeprom_data()
367 int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, in hl_fw_cpucp_pci_counters_get() argument
379 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_fw_cpucp_pci_counters_get()
382 dev_err(hdev->dev, in hl_fw_cpucp_pci_counters_get()
394 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_fw_cpucp_pci_counters_get()
397 dev_err(hdev->dev, in hl_fw_cpucp_pci_counters_get()
408 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_fw_cpucp_pci_counters_get()
411 dev_err(hdev->dev, in hl_fw_cpucp_pci_counters_get()
420 int hl_fw_cpucp_total_energy_get(struct hl_device *hdev, u64 *total_energy) in hl_fw_cpucp_total_energy_get() argument
429 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_fw_cpucp_total_energy_get()
432 dev_err(hdev->dev, in hl_fw_cpucp_total_energy_get()
443 static void fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg) in fw_read_errors() argument
461 dev_err(hdev->dev, in fw_read_errors()
464 dev_err(hdev->dev, "Device boot error - FIT image corrupted\n"); in fw_read_errors()
466 dev_err(hdev->dev, in fw_read_errors()
469 dev_warn(hdev->dev, in fw_read_errors()
472 dev_warn(hdev->dev, in fw_read_errors()
475 dev_err(hdev->dev, in fw_read_errors()
478 dev_err(hdev->dev, in fw_read_errors()
482 static void detect_cpu_boot_status(struct hl_device *hdev, u32 status) in detect_cpu_boot_status() argument
489 dev_err(hdev->dev, in detect_cpu_boot_status()
493 dev_err(hdev->dev, in detect_cpu_boot_status()
497 dev_err(hdev->dev, in detect_cpu_boot_status()
501 dev_err(hdev->dev, in detect_cpu_boot_status()
505 dev_err(hdev->dev, in detect_cpu_boot_status()
509 dev_err(hdev->dev, in detect_cpu_boot_status()
513 dev_err(hdev->dev, in detect_cpu_boot_status()
517 dev_err(hdev->dev, in detect_cpu_boot_status()
521 dev_err(hdev->dev, in detect_cpu_boot_status()
525 dev_err(hdev->dev, in detect_cpu_boot_status()
532 int hl_fw_read_preboot_ver(struct hl_device *hdev, u32 cpu_boot_status_reg, in hl_fw_read_preboot_ver() argument
538 if (!hdev->cpu_enable) in hl_fw_read_preboot_ver()
550 hdev, in hl_fw_read_preboot_ver()
563 dev_err(hdev->dev, "Failed to read preboot version\n"); in hl_fw_read_preboot_ver()
564 detect_cpu_boot_status(hdev, status); in hl_fw_read_preboot_ver()
565 fw_read_errors(hdev, boot_err0_reg); in hl_fw_read_preboot_ver()
569 hdev->asic_funcs->read_device_fw_version(hdev, FW_COMP_PREBOOT); in hl_fw_read_preboot_ver()
574 int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg, in hl_fw_init_cpu() argument
582 dev_info(hdev->dev, "Going to wait for device boot (up to %lds)\n", in hl_fw_init_cpu()
587 hdev, in hl_fw_init_cpu()
595 dev_dbg(hdev->dev, in hl_fw_init_cpu()
598 rc = hdev->asic_funcs->load_boot_fit_to_device(hdev); in hl_fw_init_cpu()
610 hdev, in hl_fw_init_cpu()
618 dev_err(hdev->dev, in hl_fw_init_cpu()
629 hdev, in hl_fw_init_cpu()
640 hdev->asic_funcs->read_device_fw_version(hdev, FW_COMP_UBOOT); in hl_fw_init_cpu()
643 detect_cpu_boot_status(hdev, status); in hl_fw_init_cpu()
648 if (!hdev->fw_loading) { in hl_fw_init_cpu()
649 dev_info(hdev->dev, "Skip loading FW\n"); in hl_fw_init_cpu()
656 dev_info(hdev->dev, in hl_fw_init_cpu()
659 rc = hdev->asic_funcs->load_firmware_to_device(hdev); in hl_fw_init_cpu()
667 hdev, in hl_fw_init_cpu()
675 dev_err(hdev->dev, in hl_fw_init_cpu()
687 hdev, in hl_fw_init_cpu()
699 dev_err(hdev->dev, in hl_fw_init_cpu()
702 dev_err(hdev->dev, in hl_fw_init_cpu()
710 dev_info(hdev->dev, "Successfully loaded firmware to device\n"); in hl_fw_init_cpu()
713 fw_read_errors(hdev, boot_err0_reg); in hl_fw_init_cpu()