root/drivers/net/wireless/ath/ath12k/wifi7/ce.c
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
 */

#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/bitfield.h>

#include "../core.h"
#include "../ce.h"
#include "ce.h"
#include "../dp_rx.h"

/* Copy Engine (CE) configs for QCN9274 */
/* Target firmware's Copy Engine configuration. */
const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_qcn9274[] = {
        /* CE0: host->target HTC control and raw streams */
        {
                .pipenum = __cpu_to_le32(0),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE1: target->host HTT + HTC control */
        {
                .pipenum = __cpu_to_le32(1),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE2: target->host WMI */
        {
                .pipenum = __cpu_to_le32(2),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE3: host->target WMI (mac0) */
        {
                .pipenum = __cpu_to_le32(3),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE4: host->target HTT */
        {
                .pipenum = __cpu_to_le32(4),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(256),
                .nbytes_max = __cpu_to_le32(256),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
                .reserved = __cpu_to_le32(0),
        },

        /* CE5: target->host Pktlog */
        {
                .pipenum = __cpu_to_le32(5),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE6: Reserved for target autonomous hif_memcpy */
        {
                .pipenum = __cpu_to_le32(6),
                .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(16384),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE7: host->target WMI (mac1) */
        {
                .pipenum = __cpu_to_le32(7),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE8: Reserved for target autonomous hif_memcpy */
        {
                .pipenum = __cpu_to_le32(8),
                .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(16384),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE9, 10 and 11: Reserved for MHI */

        /* CE12: Target CV prefetch */
        {
                .pipenum = __cpu_to_le32(12),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE13: Target CV prefetch */
        {
                .pipenum = __cpu_to_le32(13),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE14: WMI logging/CFR/Spectral/Radar */
        {
                .pipenum = __cpu_to_le32(14),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE15: Reserved */
};

/* Map from service/endpoint to Copy Engine.
 * This table is derived from the CE_PCI TABLE, above.
 * It is passed to the Target at startup for use by firmware.
 * Pipe direction:
 *      PIPEDIR_OUT = UL = host -> target
 *      PIPEDIR_IN = DL = target -> host
 */
const struct service_to_pipe
ath12k_wifi7_target_service_to_ce_map_wlan_qcn9274[] = {
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(0),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(1),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(0),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(1),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(4),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(1),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(7),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(5),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(14),
        },

        /* (Additions here) */

        { /* must be last */
                __cpu_to_le32(0),
                __cpu_to_le32(0),
                __cpu_to_le32(0),
        },
};

const struct ce_attr ath12k_wifi7_host_ce_config_qcn9274[] = {
        /* CE0: host->target HTC control and raw streams */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 16,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE1: target->host HTT + HTC control */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 512,
                .recv_cb = ath12k_htc_rx_completion_handler,
        },

        /* CE2: target->host WMI */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 128,
                .recv_cb = ath12k_htc_rx_completion_handler,
        },

        /* CE3: host->target WMI (mac0) */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 32,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE4: host->target HTT */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 2048,
                .src_sz_max = 256,
                .dest_nentries = 0,
        },

        /* CE5: target->host pktlog */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 512,
                .recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
        },

        /* CE6: target autonomous hif_memcpy */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE7: host->target WMI (mac1) */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 32,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE8: target autonomous hif_memcpy */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE9: MHI */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE10: MHI */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE11: MHI */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE12: CV Prefetch */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE13: CV Prefetch */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE14: target->host dbg log */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 512,
                .recv_cb = ath12k_htc_rx_completion_handler,
        },

        /* CE15: reserved for future use */
        {
                .flags = (CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },
};

/* Copy Engine (CE) configs for WCN7850 */
/* Target firmware's Copy Engine configuration. */
const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_wcn7850[] = {
        /* CE0: host->target HTC control and raw streams */
        {
                .pipenum = __cpu_to_le32(0),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE1: target->host HTT + HTC control */
        {
                .pipenum = __cpu_to_le32(1),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE2: target->host WMI */
        {
                .pipenum = __cpu_to_le32(2),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE3: host->target WMI */
        {
                .pipenum = __cpu_to_le32(3),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE4: host->target HTT */
        {
                .pipenum = __cpu_to_le32(4),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(256),
                .nbytes_max = __cpu_to_le32(256),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
                .reserved = __cpu_to_le32(0),
        },

        /* CE5: target->host Pktlog */
        {
                .pipenum = __cpu_to_le32(5),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE6: Reserved for target autonomous hif_memcpy */
        {
                .pipenum = __cpu_to_le32(6),
                .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(16384),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE7 used only by Host */
        {
                .pipenum = __cpu_to_le32(7),
                .pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H),
                .nentries = __cpu_to_le32(0),
                .nbytes_max = __cpu_to_le32(0),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
                .reserved = __cpu_to_le32(0),
        },

        /* CE8 target->host used only by IPA */
        {
                .pipenum = __cpu_to_le32(8),
                .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(16384),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },
        /* CE 9, 10, 11 are used by MHI driver */
};

const struct service_to_pipe
ath12k_wifi7_target_service_to_ce_map_wlan_wcn7850[] = {
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(0),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(4),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(1),
        },

        /* (Additions here) */

        { /* must be last */
                __cpu_to_le32(0),
                __cpu_to_le32(0),
                __cpu_to_le32(0),
        },
};

const struct ce_attr ath12k_wifi7_host_ce_config_wcn7850[] = {
        /* CE0: host->target HTC control and raw streams */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 16,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE1: target->host HTT + HTC control */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 512,
                .recv_cb = ath12k_htc_rx_completion_handler,
        },

        /* CE2: target->host WMI */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 64,
                .recv_cb = ath12k_htc_rx_completion_handler,
        },

        /* CE3: host->target WMI (mac0) */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 32,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE4: host->target HTT */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 2048,
                .src_sz_max = 256,
                .dest_nentries = 0,
        },

        /* CE5: target->host pktlog */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE6: target autonomous hif_memcpy */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE7: host->target WMI (mac1) */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE8: target autonomous hif_memcpy */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },
};

/* Copy Engine (CE) configs for IPQ5332 */
/* Target firmware's Copy Engine configuration. */
const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_ipq5332[] = {
        /* CE0: host->target HTC control and raw streams */
        {
                .pipenum = __cpu_to_le32(0),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE1: target->host HTT */
        {
                .pipenum = __cpu_to_le32(1),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE2: target->host WMI  + HTC control */
        {
                .pipenum = __cpu_to_le32(2),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE3: host->target WMI */
        {
                .pipenum = __cpu_to_le32(3),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE4: host->target HTT */
        {
                .pipenum = __cpu_to_le32(4),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(256),
                .nbytes_max = __cpu_to_le32(256),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
                .reserved = __cpu_to_le32(0),
        },

        /* CE5: Target -> host PKTLOG */
        {
                .pipenum = __cpu_to_le32(5),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE6: Reserved for target autonomous HIF_memcpy */
        {
                .pipenum = __cpu_to_le32(6),
                .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(16384),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE7: Reserved for CV Prefetch */
        {
                .pipenum = __cpu_to_le32(7),
                .pipedir = __cpu_to_le32(PIPEDIR_OUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE8: Reserved for target generic HIF memcpy */
        {
                .pipenum = __cpu_to_le32(8),
                .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(16384),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE9: WMI logging/CFR/Spectral/Radar/ */
        {
                .pipenum = __cpu_to_le32(9),
                .pipedir = __cpu_to_le32(PIPEDIR_IN),
                .nentries = __cpu_to_le32(32),
                .nbytes_max = __cpu_to_le32(2048),
                .flags = __cpu_to_le32(CE_ATTR_FLAGS),
                .reserved = __cpu_to_le32(0),
        },

        /* CE10: Unused TBD */
        {
                .pipenum = __cpu_to_le32(10),
                .pipedir = __cpu_to_le32(PIPEDIR_NONE),
                .nentries = __cpu_to_le32(0),
                .nbytes_max = __cpu_to_le32(0),
                .flags = __cpu_to_le32(0),
                .reserved = __cpu_to_le32(0),
        },
        /* CE11: Unused TBD */
        {
                .pipenum = __cpu_to_le32(11),
                .pipedir = __cpu_to_le32(PIPEDIR_NONE),
                .nentries = __cpu_to_le32(0),
                .nbytes_max = __cpu_to_le32(0),
                .flags = __cpu_to_le32(0),
                .reserved = __cpu_to_le32(0),
        },
};

const struct service_to_pipe
ath12k_wifi7_target_service_to_ce_map_wlan_ipq5332[] = {
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(3),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(2),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(0),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(1),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(0),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(1),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
                __cpu_to_le32(PIPEDIR_OUT),
                __cpu_to_le32(4),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(1),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(5),
        },
        {
                __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
                __cpu_to_le32(PIPEDIR_IN),
                __cpu_to_le32(9),
        },
        /* (Additions here) */

        { /* must be last */
                __cpu_to_le32(0),
                __cpu_to_le32(0),
                __cpu_to_le32(0),
        },
};

const struct ce_attr ath12k_wifi7_host_ce_config_ipq5332[] = {
        /* CE0: host->target HTC control and raw streams */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 16,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE1: target->host HTT + HTC control */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 512,
                .recv_cb = ath12k_htc_rx_completion_handler,
        },

        /* CE2: target->host WMI */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 128,
                .recv_cb = ath12k_htc_rx_completion_handler,
        },

        /* CE3: host->target WMI */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 32,
                .src_sz_max = 2048,
                .dest_nentries = 0,
        },

        /* CE4: host->target HTT */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 2048,
                .src_sz_max = 256,
                .dest_nentries = 0,
        },

        /* CE5: target -> host PKTLOG */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 512,
                .recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
        },

        /* CE6: Target autonomous HIF_memcpy */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE7: CV Prefetch */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE8: Target HIF memcpy (Generic HIF memcypy) */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE9: WMI logging/CFR/Spectral/Radar */
        {
                .flags = CE_ATTR_FLAGS,
                .src_nentries = 0,
                .src_sz_max = 2048,
                .dest_nentries = 128,
        },

        /* CE10: Unused */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },

        /* CE11: Unused */
        {
                .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
                .src_nentries = 0,
                .src_sz_max = 0,
                .dest_nentries = 0,
        },
};