dbg.c (15995b759307b39dc28d4480db970eacd9a2a80c) | dbg.c (ccdc3d6d15555b170a977e9dd82c5e9db465f10a) |
---|---|
1/****************************************************************************** 2 * 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. --- 2489 unchanged lines hidden (view full) --- 2498 2499 trans->dbg.fw_mon[trans->dbg.num_blocks].block = virtual_addr; 2500 trans->dbg.fw_mon[trans->dbg.num_blocks].physical = phys_addr; 2501 trans->dbg.fw_mon[trans->dbg.num_blocks].size = size; 2502 trans->dbg.num_blocks++; 2503} 2504 2505static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, | 1/****************************************************************************** 2 * 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. --- 2489 unchanged lines hidden (view full) --- 2498 2499 trans->dbg.fw_mon[trans->dbg.num_blocks].block = virtual_addr; 2500 trans->dbg.fw_mon[trans->dbg.num_blocks].physical = phys_addr; 2501 trans->dbg.fw_mon[trans->dbg.num_blocks].size = size; 2502 trans->dbg.num_blocks++; 2503} 2504 2505static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt, |
2506 struct iwl_fw_ini_allocation_data *alloc, | 2506 struct iwl_fw_ini_allocation_tlv *alloc, |
2507 enum iwl_fw_ini_apply_point pnt) 2508{ 2509 struct iwl_trans *trans = fwrt->trans; 2510 struct iwl_ldbg_config_cmd ldbg_cmd = { 2511 .type = cpu_to_le32(BUFFER_ALLOCATION), 2512 }; 2513 struct iwl_buffer_allocation_cmd *cmd = &ldbg_cmd.buffer_allocation; 2514 struct iwl_host_cmd hcmd = { 2515 .id = LDBG_CONFIG_CMD, 2516 .flags = CMD_ASYNC, 2517 .data[0] = &ldbg_cmd, 2518 .len[0] = sizeof(ldbg_cmd), 2519 }; 2520 int block_idx = trans->dbg.num_blocks; | 2507 enum iwl_fw_ini_apply_point pnt) 2508{ 2509 struct iwl_trans *trans = fwrt->trans; 2510 struct iwl_ldbg_config_cmd ldbg_cmd = { 2511 .type = cpu_to_le32(BUFFER_ALLOCATION), 2512 }; 2513 struct iwl_buffer_allocation_cmd *cmd = &ldbg_cmd.buffer_allocation; 2514 struct iwl_host_cmd hcmd = { 2515 .id = LDBG_CONFIG_CMD, 2516 .flags = CMD_ASYNC, 2517 .data[0] = &ldbg_cmd, 2518 .len[0] = sizeof(ldbg_cmd), 2519 }; 2520 int block_idx = trans->dbg.num_blocks; |
2521 u32 buf_location = le32_to_cpu(alloc->tlv.buffer_location); | 2521 u32 buf_location = le32_to_cpu(alloc->buffer_location); 2522 u32 alloc_id = le32_to_cpu(alloc->allocation_id); |
2522 | 2523 |
2524 if (alloc_id <= IWL_FW_INI_ALLOCATION_INVALID || 2525 alloc_id >= IWL_FW_INI_ALLOCATION_NUM) { 2526 IWL_ERR(fwrt, "WRT: Invalid allocation id %d\n", alloc_id); 2527 return; 2528 } 2529 |
|
2523 if (fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID) 2524 fwrt->trans->dbg.ini_dest = buf_location; 2525 2526 if (buf_location != fwrt->trans->dbg.ini_dest) { 2527 WARN(fwrt, 2528 "WRT: attempt to override buffer location on apply point %d\n", 2529 pnt); 2530 --- 7 unchanged lines hidden (view full) --- 2538 CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM); 2539 2540 return; 2541 } 2542 2543 if (buf_location != IWL_FW_INI_LOCATION_DRAM_PATH) 2544 return; 2545 | 2530 if (fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID) 2531 fwrt->trans->dbg.ini_dest = buf_location; 2532 2533 if (buf_location != fwrt->trans->dbg.ini_dest) { 2534 WARN(fwrt, 2535 "WRT: attempt to override buffer location on apply point %d\n", 2536 pnt); 2537 --- 7 unchanged lines hidden (view full) --- 2545 CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM); 2546 2547 return; 2548 } 2549 2550 if (buf_location != IWL_FW_INI_LOCATION_DRAM_PATH) 2551 return; 2552 |
2546 if (!alloc->is_alloc) { 2547 iwl_fw_dbg_buffer_allocation(fwrt, 2548 le32_to_cpu(alloc->tlv.size)); | 2553 if (!(BIT(alloc_id) & fwrt->trans->dbg.is_alloc)) { 2554 iwl_fw_dbg_buffer_allocation(fwrt, le32_to_cpu(alloc->size)); |
2549 if (block_idx == trans->dbg.num_blocks) 2550 return; | 2555 if (block_idx == trans->dbg.num_blocks) 2556 return; |
2551 alloc->is_alloc = 1; | 2557 fwrt->trans->dbg.is_alloc |= BIT(alloc_id); |
2552 } 2553 2554 /* First block is assigned via registers / context info */ 2555 if (trans->dbg.num_blocks == 1) 2556 return; 2557 2558 IWL_DEBUG_FW(trans, 2559 "WRT: applying DRAM buffer[%d] destination\n", block_idx); 2560 2561 cmd->num_frags = cpu_to_le32(1); 2562 cmd->fragments[0].address = 2563 cpu_to_le64(trans->dbg.fw_mon[block_idx].physical); | 2558 } 2559 2560 /* First block is assigned via registers / context info */ 2561 if (trans->dbg.num_blocks == 1) 2562 return; 2563 2564 IWL_DEBUG_FW(trans, 2565 "WRT: applying DRAM buffer[%d] destination\n", block_idx); 2566 2567 cmd->num_frags = cpu_to_le32(1); 2568 cmd->fragments[0].address = 2569 cpu_to_le64(trans->dbg.fw_mon[block_idx].physical); |
2564 cmd->fragments[0].size = alloc->tlv.size; 2565 cmd->allocation_id = alloc->tlv.allocation_id; 2566 cmd->buffer_location = alloc->tlv.buffer_location; | 2570 cmd->fragments[0].size = alloc->size; 2571 cmd->allocation_id = alloc->allocation_id; 2572 cmd->buffer_location = alloc->buffer_location; |
2567 2568 iwl_trans_send_cmd(trans, &hcmd); 2569} 2570 2571static void iwl_fw_dbg_send_hcmd(struct iwl_fw_runtime *fwrt, 2572 struct iwl_ucode_tlv *tlv, 2573 bool ext) 2574{ --- 208 unchanged lines hidden (view full) --- 2783 struct iwl_ucode_tlv *tlv = iter; 2784 void *ini_tlv = (void *)tlv->data; 2785 u32 type = le32_to_cpu(tlv->type); 2786 2787 switch (type) { 2788 case IWL_UCODE_TLV_TYPE_DEBUG_INFO: 2789 iwl_fw_dbg_info_apply(fwrt, ini_tlv, ext, pnt); 2790 break; | 2573 2574 iwl_trans_send_cmd(trans, &hcmd); 2575} 2576 2577static void iwl_fw_dbg_send_hcmd(struct iwl_fw_runtime *fwrt, 2578 struct iwl_ucode_tlv *tlv, 2579 bool ext) 2580{ --- 208 unchanged lines hidden (view full) --- 2789 struct iwl_ucode_tlv *tlv = iter; 2790 void *ini_tlv = (void *)tlv->data; 2791 u32 type = le32_to_cpu(tlv->type); 2792 2793 switch (type) { 2794 case IWL_UCODE_TLV_TYPE_DEBUG_INFO: 2795 iwl_fw_dbg_info_apply(fwrt, ini_tlv, ext, pnt); 2796 break; |
2791 case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION: { 2792 struct iwl_fw_ini_allocation_data *buf_alloc = ini_tlv; 2793 | 2797 case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION: |
2794 if (pnt != IWL_FW_INI_APPLY_EARLY) { 2795 IWL_ERR(fwrt, 2796 "WRT: ext=%d. Invalid apply point %d for buffer allocation\n", 2797 ext, pnt); 2798 goto next; 2799 } | 2798 if (pnt != IWL_FW_INI_APPLY_EARLY) { 2799 IWL_ERR(fwrt, 2800 "WRT: ext=%d. Invalid apply point %d for buffer allocation\n", 2801 ext, pnt); 2802 goto next; 2803 } |
2800 | |
2801 iwl_fw_dbg_buffer_apply(fwrt, ini_tlv, pnt); | 2804 iwl_fw_dbg_buffer_apply(fwrt, ini_tlv, pnt); |
2802 iter += sizeof(buf_alloc->is_alloc); | |
2803 break; | 2805 break; |
2804 } | |
2805 case IWL_UCODE_TLV_TYPE_HCMD: 2806 if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) { 2807 IWL_ERR(fwrt, 2808 "WRT: ext=%d. Invalid apply point %d for host command\n", 2809 ext, pnt); 2810 goto next; 2811 } 2812 iwl_fw_dbg_send_hcmd(fwrt, tlv, ext); --- 222 unchanged lines hidden --- | 2806 case IWL_UCODE_TLV_TYPE_HCMD: 2807 if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) { 2808 IWL_ERR(fwrt, 2809 "WRT: ext=%d. Invalid apply point %d for host command\n", 2810 ext, pnt); 2811 goto next; 2812 } 2813 iwl_fw_dbg_send_hcmd(fwrt, tlv, ext); --- 222 unchanged lines hidden --- |