1 /* SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2020-21 Intel Corporation.
6 #ifndef IOSM_IPC_IMEM_OPS_H
7 #define IOSM_IPC_IMEM_OPS_H
9 #include "iosm_ipc_mux_codec.h"
11 /* Maximum wait time for blocking read */
12 #define IPC_READ_TIMEOUT 500
14 /* The delay in ms for defering the unregister */
15 #define SIO_UNREGISTER_DEFER_DELAY_MS 1
17 /* Default delay till CP PSI image is running and modem updates the
21 #define PSI_START_DEFAULT_TIMEOUT 3000
23 /* Default time out when closing SIO, till the modem is in
27 #define BOOT_CHECK_DEFAULT_TIMEOUT 400
29 /* IP MUX channel range */
30 #define IP_MUX_SESSION_START 0
31 #define IP_MUX_SESSION_END 7
33 /* Default IP MUX channel */
34 #define IP_MUX_SESSION_DEFAULT 0
37 * ipc_imem_sys_port_open - Open a port link to CP.
38 * @ipc_imem: Imem instance.
39 * @chl_id: Channel Indentifier.
40 * @hp_id: HP Indentifier.
42 * Return: channel instance on success, NULL for failure
44 struct ipc_mem_channel *ipc_imem_sys_port_open(struct iosm_imem *ipc_imem,
45 int chl_id, int hp_id);
48 * ipc_imem_sys_cdev_close - Release a sio link to CP.
49 * @ipc_cdev: iosm sio instance.
51 void ipc_imem_sys_cdev_close(struct iosm_cdev *ipc_cdev);
54 * ipc_imem_sys_cdev_write - Route the uplink buffer to CP.
55 * @ipc_cdev: iosm_cdev instance.
56 * @skb: Pointer to skb.
58 * Return: 0 on success and failure value on error
60 int ipc_imem_sys_cdev_write(struct iosm_cdev *ipc_cdev, struct sk_buff *skb);
63 * ipc_imem_sys_wwan_open - Open packet data online channel between network
65 * @ipc_imem: Imem instance.
66 * @if_id: ip link tag of the net device.
68 * Return: Channel ID on success and failure value on error
70 int ipc_imem_sys_wwan_open(struct iosm_imem *ipc_imem, int if_id);
73 * ipc_imem_sys_wwan_close - Close packet data online channel between network
75 * @ipc_imem: Imem instance.
76 * @if_id: IP link id net device.
77 * @channel_id: Channel ID to be closed.
79 void ipc_imem_sys_wwan_close(struct iosm_imem *ipc_imem, int if_id,
83 * ipc_imem_sys_wwan_transmit - Function for transfer UL data
84 * @ipc_imem: Imem instance.
85 * @if_id: link ID of the device.
86 * @channel_id: Channel ID used
87 * @skb: Pointer to sk buffer
89 * Return: 0 on success and failure value on error
91 int ipc_imem_sys_wwan_transmit(struct iosm_imem *ipc_imem, int if_id,
92 int channel_id, struct sk_buff *skb);
94 * ipc_imem_wwan_channel_init - Initializes WWAN channels and the channel for
96 * @ipc_imem: Pointer to iosm_imem struct.
97 * @mux_type: Type of mux protocol.
99 void ipc_imem_wwan_channel_init(struct iosm_imem *ipc_imem,
100 enum ipc_mux_protocol mux_type);