Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only
0002  *
0003  * Copyright (C) 2020-21 Intel Corporation.
0004  */
0005 
0006 #ifndef IOSM_IPC_IMEM_H
0007 #define IOSM_IPC_IMEM_H
0008 
0009 #include <linux/skbuff.h>
0010 
0011 #include "iosm_ipc_mmio.h"
0012 #include "iosm_ipc_pcie.h"
0013 #include "iosm_ipc_uevent.h"
0014 #include "iosm_ipc_wwan.h"
0015 #include "iosm_ipc_task_queue.h"
0016 
0017 struct ipc_chnl_cfg;
0018 
0019 /* IRQ moderation in usec */
0020 #define IRQ_MOD_OFF 0
0021 #define IRQ_MOD_NET 1000
0022 #define IRQ_MOD_TRC 4000
0023 
0024 /* Either the PSI image is accepted by CP or the suspended flash tool is waken,
0025  * informed that the CP ROM driver is not ready to process the PSI image.
0026  * unit : milliseconds
0027  */
0028 #define IPC_PSI_TRANSFER_TIMEOUT 3000
0029 
0030 /* Timeout in 20 msec to wait for the modem to boot up to
0031  * IPC_MEM_DEVICE_IPC_INIT state.
0032  * unit : milliseconds (500 * ipc_util_msleep(20))
0033  */
0034 #define IPC_MODEM_BOOT_TIMEOUT 500
0035 
0036 /* Wait timeout for ipc status reflects IPC_MEM_DEVICE_IPC_UNINIT
0037  * unit : milliseconds
0038  */
0039 #define IPC_MODEM_UNINIT_TIMEOUT_MS 30
0040 
0041 /* Pending time for processing data.
0042  * unit : milliseconds
0043  */
0044 #define IPC_PEND_DATA_TIMEOUT 500
0045 
0046 /* The timeout in milliseconds for application to wait for remote time. */
0047 #define IPC_REMOTE_TS_TIMEOUT_MS 10
0048 
0049 /* Timeout for TD allocation retry.
0050  * unit : milliseconds
0051  */
0052 #define IPC_TD_ALLOC_TIMER_PERIOD_MS 100
0053 
0054 /* Host sleep target is host */
0055 #define IPC_HOST_SLEEP_HOST 0
0056 
0057 /* Host sleep target is device */
0058 #define IPC_HOST_SLEEP_DEVICE 1
0059 
0060 /* Sleep message, target host: AP enters sleep / target device: CP is
0061  * allowed to enter sleep and shall use the host sleep protocol
0062  */
0063 #define IPC_HOST_SLEEP_ENTER_SLEEP 0
0064 
0065 /* Sleep_message, target host: AP exits  sleep / target device: CP is
0066  * NOT allowed to enter sleep
0067  */
0068 #define IPC_HOST_SLEEP_EXIT_SLEEP 1
0069 
0070 #define IMEM_IRQ_DONT_CARE (-1)
0071 
0072 #define IPC_MEM_MAX_CHANNELS 8
0073 
0074 #define IPC_MEM_MUX_IP_SESSION_ENTRIES 8
0075 
0076 #define IPC_MEM_MUX_IP_CH_IF_ID 0
0077 
0078 #define TD_UPDATE_DEFAULT_TIMEOUT_USEC 1900
0079 
0080 #define FORCE_UPDATE_DEFAULT_TIMEOUT_USEC 500
0081 
0082 /* Sleep_message, target host: not applicable  / target device: CP is
0083  * allowed to enter sleep and shall NOT use the device sleep protocol
0084  */
0085 #define IPC_HOST_SLEEP_ENTER_SLEEP_NO_PROTOCOL 2
0086 
0087 /* in_band_crash_signal IPC_MEM_INBAND_CRASH_SIG
0088  * Modem crash notification configuration. If this value is non-zero then
0089  * FEATURE_SET message will be sent to the Modem as a result the Modem will
0090  * signal Crash via Execution Stage register. If this value is zero then Modem
0091  * will use out-of-band method to notify about it's Crash.
0092  */
0093 #define IPC_MEM_INBAND_CRASH_SIG 1
0094 
0095 /* Extra headroom to be allocated for DL SKBs to allow addition of Ethernet
0096  * header
0097  */
0098 #define IPC_MEM_DL_ETH_OFFSET 16
0099 
0100 #define IPC_CB(skb) ((struct ipc_skb_cb *)((skb)->cb))
0101 #define IOSM_CHIP_INFO_SIZE_MAX 100
0102 
0103 #define FULLY_FUNCTIONAL 0
0104 #define IOSM_DEVLINK_INIT 1
0105 
0106 /* List of the supported UL/DL pipes. */
0107 enum ipc_mem_pipes {
0108     IPC_MEM_PIPE_0 = 0,
0109     IPC_MEM_PIPE_1,
0110     IPC_MEM_PIPE_2,
0111     IPC_MEM_PIPE_3,
0112     IPC_MEM_PIPE_4,
0113     IPC_MEM_PIPE_5,
0114     IPC_MEM_PIPE_6,
0115     IPC_MEM_PIPE_7,
0116     IPC_MEM_PIPE_8,
0117     IPC_MEM_PIPE_9,
0118     IPC_MEM_PIPE_10,
0119     IPC_MEM_PIPE_11,
0120     IPC_MEM_PIPE_12,
0121     IPC_MEM_PIPE_13,
0122     IPC_MEM_PIPE_14,
0123     IPC_MEM_PIPE_15,
0124     IPC_MEM_PIPE_16,
0125     IPC_MEM_PIPE_17,
0126     IPC_MEM_PIPE_18,
0127     IPC_MEM_PIPE_19,
0128     IPC_MEM_PIPE_20,
0129     IPC_MEM_PIPE_21,
0130     IPC_MEM_PIPE_22,
0131     IPC_MEM_PIPE_23,
0132     IPC_MEM_MAX_PIPES
0133 };
0134 
0135 /* Enum defining channel states. */
0136 enum ipc_channel_state {
0137     IMEM_CHANNEL_FREE,
0138     IMEM_CHANNEL_RESERVED,
0139     IMEM_CHANNEL_ACTIVE,
0140     IMEM_CHANNEL_CLOSING,
0141 };
0142 
0143 /* Time Unit */
0144 enum ipc_time_unit {
0145     IPC_SEC = 0,
0146     IPC_MILLI_SEC = 1,
0147     IPC_MICRO_SEC = 2,
0148     IPC_NANO_SEC = 3,
0149     IPC_PICO_SEC = 4,
0150     IPC_FEMTO_SEC = 5,
0151     IPC_ATTO_SEC = 6,
0152 };
0153 
0154 /**
0155  * enum ipc_ctype - Enum defining supported channel type needed for control
0156  *          /IP traffic.
0157  * @IPC_CTYPE_WWAN:     Used for IP traffic
0158  * @IPC_CTYPE_CTRL:     Used for Control Communication
0159  */
0160 enum ipc_ctype {
0161     IPC_CTYPE_WWAN,
0162     IPC_CTYPE_CTRL,
0163 };
0164 
0165 /* Pipe direction. */
0166 enum ipc_mem_pipe_dir {
0167     IPC_MEM_DIR_UL,
0168     IPC_MEM_DIR_DL,
0169 };
0170 
0171 /* HP update identifier. To be used as data for ipc_cp_irq_hpda_update() */
0172 enum ipc_hp_identifier {
0173     IPC_HP_MR = 0,
0174     IPC_HP_PM_TRIGGER,
0175     IPC_HP_WAKEUP_SPEC_TMR,
0176     IPC_HP_TD_UPD_TMR_START,
0177     IPC_HP_TD_UPD_TMR,
0178     IPC_HP_FAST_TD_UPD_TMR,
0179     IPC_HP_UL_WRITE_TD,
0180     IPC_HP_DL_PROCESS,
0181     IPC_HP_NET_CHANNEL_INIT,
0182     IPC_HP_CDEV_OPEN,
0183 };
0184 
0185 /**
0186  * struct ipc_pipe - Structure for Pipe.
0187  * @tdr_start:          Ipc private protocol Transfer Descriptor Ring
0188  * @channel:            Id of the sio device, set by imem_sio_open,
0189  *              needed to pass DL char to the user terminal
0190  * @skbr_start:         Circular buffer for skbuf and the buffer
0191  *              reference in a tdr_start entry.
0192  * @phy_tdr_start:      Transfer descriptor start address
0193  * @old_head:           last head pointer reported to CP.
0194  * @old_tail:           AP read position before CP moves the read
0195  *              position to write/head. If CP has consumed the
0196  *              buffers, AP has to freed the skbuf starting at
0197  *              tdr_start[old_tail].
0198  * @nr_of_entries:      Number of elements of skb_start and tdr_start.
0199  * @max_nr_of_queued_entries:   Maximum number of queued entries in TDR
0200  * @accumulation_backoff:   Accumulation in usec for accumulation
0201  *              backoff (0 = no acc backoff)
0202  * @irq_moderation:     timer in usec for irq_moderation
0203  *              (0=no irq moderation)
0204  * @pipe_nr:            Pipe identification number
0205  * @irq:            Interrupt vector
0206  * @dir:            Direction of data stream in pipe
0207  * @td_tag:         Unique tag of the buffer queued
0208  * @buf_size:           Buffer size (in bytes) for preallocated
0209  *              buffers (for DL pipes)
0210  * @nr_of_queued_entries:   Aueued number of entries
0211  * @is_open:            Check for open pipe status
0212  */
0213 struct ipc_pipe {
0214     struct ipc_protocol_td *tdr_start;
0215     struct ipc_mem_channel *channel;
0216     struct sk_buff **skbr_start;
0217     dma_addr_t phy_tdr_start;
0218     u32 old_head;
0219     u32 old_tail;
0220     u32 nr_of_entries;
0221     u32 max_nr_of_queued_entries;
0222     u32 accumulation_backoff;
0223     u32 irq_moderation;
0224     u32 pipe_nr;
0225     u32 irq;
0226     enum ipc_mem_pipe_dir dir;
0227     u32 td_tag;
0228     u32 buf_size;
0229     u16 nr_of_queued_entries;
0230     u8 is_open:1;
0231 };
0232 
0233 /**
0234  * struct ipc_mem_channel - Structure for Channel.
0235  * @channel_id:     Instance of the channel list and is return to the user
0236  *          at the end of the open operation.
0237  * @ctype:      Control or netif channel.
0238  * @index:      unique index per ctype
0239  * @ul_pipe:        pipe objects
0240  * @dl_pipe:        pipe objects
0241  * @if_id:      Interface ID
0242  * @net_err_count:  Number of downlink errors returned by ipc_wwan_receive
0243  *          interface at the entry point of the IP stack.
0244  * @state:      Free, reserved or busy (in use).
0245  * @ul_sem:     Needed for the blocking write or uplink transfer.
0246  * @ul_list:        Uplink accumulator which is filled by the uplink
0247  *          char app or IP stack. The socket buffer pointer are
0248  *          added to the descriptor list in the kthread context.
0249  */
0250 struct ipc_mem_channel {
0251     int channel_id;
0252     enum ipc_ctype ctype;
0253     int index;
0254     struct ipc_pipe ul_pipe;
0255     struct ipc_pipe dl_pipe;
0256     int if_id;
0257     u32 net_err_count;
0258     enum ipc_channel_state state;
0259     struct completion ul_sem;
0260     struct sk_buff_head ul_list;
0261 };
0262 
0263 /**
0264  * enum ipc_phase - Different AP and CP phases.
0265  *          The enums defined after "IPC_P_ROM" and before
0266  *          "IPC_P_RUN" indicates the operating state where CP can
0267  *          respond to any requests. So while introducing new phase
0268  *          this shall be taken into consideration.
0269  * @IPC_P_OFF:      On host PC, the PCIe device link settings are known
0270  *          about the combined power on. PC is running, the driver
0271  *          is loaded and CP is in power off mode. The PCIe bus
0272  *          driver call the device power mode D3hot. In this phase
0273  *          the driver the polls the device, until the device is in
0274  *          the power on state and signals the power mode D0.
0275  * @IPC_P_OFF_REQ:  The intermediate phase between cleanup activity starts
0276  *          and ends.
0277  * @IPC_P_CRASH:    The phase indicating CP crash
0278  * @IPC_P_CD_READY: The phase indicating CP core dump is ready
0279  * @IPC_P_ROM:      After power on, CP starts in ROM mode and the IPC ROM
0280  *          driver is waiting 150 ms for the AP active notification
0281  *          saved in the PCI link status register.
0282  * @IPC_P_PSI:      Primary signed image download phase
0283  * @IPC_P_EBL:      Extended bootloader pahse
0284  * @IPC_P_RUN:      The phase after flashing to RAM is the RUNTIME phase.
0285  */
0286 enum ipc_phase {
0287     IPC_P_OFF,
0288     IPC_P_OFF_REQ,
0289     IPC_P_CRASH,
0290     IPC_P_CD_READY,
0291     IPC_P_ROM,
0292     IPC_P_PSI,
0293     IPC_P_EBL,
0294     IPC_P_RUN,
0295 };
0296 
0297 /**
0298  * struct iosm_imem - Current state of the IPC shared memory.
0299  * @mmio:           mmio instance to access CP MMIO area /
0300  *              doorbell scratchpad.
0301  * @ipc_protocol:       IPC Protocol instance
0302  * @ipc_task:           Task for entry into ipc task queue
0303  * @wwan:           WWAN device pointer
0304  * @mux:            IP Data multiplexing state.
0305  * @sio:            IPC SIO data structure pointer
0306  * @ipc_port:           IPC PORT data structure pointer
0307  * @pcie:           IPC PCIe
0308  * @trace:          IPC trace data structure pointer
0309  * @dev:            Pointer to device structure
0310  * @ipc_requested_state:    Expected IPC state on CP.
0311  * @channels:           Channel list with UL/DL pipe pairs.
0312  * @ipc_devlink:        IPC Devlink data structure pointer
0313  * @ipc_status:         local ipc_status
0314  * @nr_of_channels:     number of configured channels
0315  * @startup_timer:      startup timer for NAND support.
0316  * @hrtimer_period:     Hr timer period
0317  * @tdupdate_timer:     Delay the TD update doorbell.
0318  * @fast_update_timer:      forced head pointer update delay timer.
0319  * @td_alloc_timer:     Timer for DL pipe TD allocation retry
0320  * @adb_timer:          Timer for finishing the ADB.
0321  * @rom_exit_code:      Mapped boot rom exit code.
0322  * @enter_runtime:      1 means the transition to runtime phase was
0323  *              executed.
0324  * @ul_pend_sem:        Semaphore to wait/complete of UL TDs
0325  *              before closing pipe.
0326  * @app_notify_ul_pend:     Signal app if UL TD is pending
0327  * @dl_pend_sem:        Semaphore to wait/complete of DL TDs
0328  *              before closing pipe.
0329  * @app_notify_dl_pend:     Signal app if DL TD is pending
0330  * @phase:          Operating phase like runtime.
0331  * @pci_device_id:      Device ID
0332  * @cp_version:         CP version
0333  * @device_sleep:       Device sleep state
0334  * @run_state_worker:       Pointer to worker component for device
0335  *              setup operations to be called when modem
0336  *              reaches RUN state
0337  * @ev_irq_pending:     0 means inform the IPC tasklet to
0338  *              process the irq actions.
0339  * @flag:           Flag to monitor the state of driver
0340  * @td_update_timer_suspended:  if true then td update timer suspend
0341  * @ev_mux_net_transmit_pending:0 means inform the IPC tasklet to pass
0342  * @reset_det_n:        Reset detect flag
0343  * @pcie_wake_n:        Pcie wake flag
0344  * @debugfs_wwan_dir:       WWAN Debug FS directory entry
0345  * @debugfs_dir:        Debug FS directory for driver-specific entries
0346  */
0347 struct iosm_imem {
0348     struct iosm_mmio *mmio;
0349     struct iosm_protocol *ipc_protocol;
0350     struct ipc_task *ipc_task;
0351     struct iosm_wwan *wwan;
0352     struct iosm_mux *mux;
0353     struct iosm_cdev *ipc_port[IPC_MEM_MAX_CHANNELS];
0354     struct iosm_pcie *pcie;
0355 #ifdef CONFIG_WWAN_DEBUGFS
0356     struct iosm_trace *trace;
0357 #endif
0358     struct device *dev;
0359     enum ipc_mem_device_ipc_state ipc_requested_state;
0360     struct ipc_mem_channel channels[IPC_MEM_MAX_CHANNELS];
0361     struct iosm_devlink *ipc_devlink;
0362     u32 ipc_status;
0363     u32 nr_of_channels;
0364     struct hrtimer startup_timer;
0365     ktime_t hrtimer_period;
0366     struct hrtimer tdupdate_timer;
0367     struct hrtimer fast_update_timer;
0368     struct hrtimer td_alloc_timer;
0369     struct hrtimer adb_timer;
0370     enum rom_exit_code rom_exit_code;
0371     u32 enter_runtime;
0372     struct completion ul_pend_sem;
0373     u32 app_notify_ul_pend;
0374     struct completion dl_pend_sem;
0375     u32 app_notify_dl_pend;
0376     enum ipc_phase phase;
0377     u16 pci_device_id;
0378     int cp_version;
0379     int device_sleep;
0380     struct work_struct run_state_worker;
0381     u8 ev_irq_pending[IPC_IRQ_VECTORS];
0382     unsigned long flag;
0383     u8 td_update_timer_suspended:1,
0384        ev_mux_net_transmit_pending:1,
0385        reset_det_n:1,
0386        pcie_wake_n:1;
0387 #ifdef CONFIG_WWAN_DEBUGFS
0388     struct dentry *debugfs_wwan_dir;
0389     struct dentry *debugfs_dir;
0390 #endif
0391 };
0392 
0393 /**
0394  * ipc_imem_init - Initialize the shared memory region
0395  * @pcie:   Pointer to core driver data-struct
0396  * @device_id:  PCI device ID
0397  * @mmio:   Pointer to the mmio area
0398  * @dev:    Pointer to device structure
0399  *
0400  * Returns:  Initialized imem pointer on success else NULL
0401  */
0402 struct iosm_imem *ipc_imem_init(struct iosm_pcie *pcie, unsigned int device_id,
0403                 void __iomem *mmio, struct device *dev);
0404 
0405 /**
0406  * ipc_imem_pm_s2idle_sleep - Set PM variables to sleep/active for
0407  *                s2idle sleep/active
0408  * @ipc_imem:   Pointer to imem data-struct
0409  * @sleep:  Set PM Variable to sleep/active
0410  */
0411 void ipc_imem_pm_s2idle_sleep(struct iosm_imem *ipc_imem, bool sleep);
0412 
0413 /**
0414  * ipc_imem_pm_suspend - The HAL shall ask the shared memory layer
0415  *           whether D3 is allowed.
0416  * @ipc_imem:   Pointer to imem data-struct
0417  */
0418 void ipc_imem_pm_suspend(struct iosm_imem *ipc_imem);
0419 
0420 /**
0421  * ipc_imem_pm_resume - The HAL shall inform the shared memory layer
0422  *          that the device is active.
0423  * @ipc_imem:   Pointer to imem data-struct
0424  */
0425 void ipc_imem_pm_resume(struct iosm_imem *ipc_imem);
0426 
0427 /**
0428  * ipc_imem_cleanup -   Inform CP and free the shared memory resources.
0429  * @ipc_imem:   Pointer to imem data-struct
0430  */
0431 void ipc_imem_cleanup(struct iosm_imem *ipc_imem);
0432 
0433 /**
0434  * ipc_imem_irq_process - Shift the IRQ actions to the IPC thread.
0435  * @ipc_imem:   Pointer to imem data-struct
0436  * @irq:    Irq number
0437  */
0438 void ipc_imem_irq_process(struct iosm_imem *ipc_imem, int irq);
0439 
0440 /**
0441  * imem_get_device_sleep_state - Get the device sleep state value.
0442  * @ipc_imem:   Pointer to imem instance
0443  *
0444  * Returns: device sleep state
0445  */
0446 int imem_get_device_sleep_state(struct iosm_imem *ipc_imem);
0447 
0448 /**
0449  * ipc_imem_td_update_timer_suspend - Updates the TD Update Timer suspend flag.
0450  * @ipc_imem:   Pointer to imem data-struct
0451  * @suspend:    Flag to update. If TRUE then HP update doorbell is triggered to
0452  *      device without any wait. If FALSE then HP update doorbell is
0453  *      delayed until timeout.
0454  */
0455 void ipc_imem_td_update_timer_suspend(struct iosm_imem *ipc_imem, bool suspend);
0456 
0457 /**
0458  * ipc_imem_channel_close - Release the channel resources.
0459  * @ipc_imem:       Pointer to imem data-struct
0460  * @channel_id:     Channel ID to be cleaned up.
0461  */
0462 void ipc_imem_channel_close(struct iosm_imem *ipc_imem, int channel_id);
0463 
0464 /**
0465  * ipc_imem_channel_alloc - Reserves a channel
0466  * @ipc_imem:   Pointer to imem data-struct
0467  * @index:  ID to lookup from the preallocated list.
0468  * @ctype:  Channel type.
0469  *
0470  * Returns: Index on success and failure value on error
0471  */
0472 int ipc_imem_channel_alloc(struct iosm_imem *ipc_imem, int index,
0473                enum ipc_ctype ctype);
0474 
0475 /**
0476  * ipc_imem_channel_open - Establish the pipes.
0477  * @ipc_imem:       Pointer to imem data-struct
0478  * @channel_id:     Channel ID returned during alloc.
0479  * @db_id:      Doorbell ID for trigger identifier.
0480  *
0481  * Returns: Pointer of ipc_mem_channel on success and NULL on failure.
0482  */
0483 struct ipc_mem_channel *ipc_imem_channel_open(struct iosm_imem *ipc_imem,
0484                           int channel_id, u32 db_id);
0485 
0486 /**
0487  * ipc_imem_td_update_timer_start - Starts the TD Update Timer if not running.
0488  * @ipc_imem:   Pointer to imem data-struct
0489  */
0490 void ipc_imem_td_update_timer_start(struct iosm_imem *ipc_imem);
0491 
0492 /**
0493  * ipc_imem_ul_write_td - Pass the channel UL list to protocol layer for TD
0494  *            preparation and sending them to the device.
0495  * @ipc_imem:   Pointer to imem data-struct
0496  *
0497  * Returns: TRUE of HP Doorbell trigger is pending. FALSE otherwise.
0498  */
0499 bool ipc_imem_ul_write_td(struct iosm_imem *ipc_imem);
0500 
0501 /**
0502  * ipc_imem_ul_send - Dequeue SKB from channel list and start with
0503  *        the uplink transfer.If HP Doorbell is pending to be
0504  *        triggered then starts the TD Update Timer.
0505  * @ipc_imem:   Pointer to imem data-struct
0506  */
0507 void ipc_imem_ul_send(struct iosm_imem *ipc_imem);
0508 
0509 /**
0510  * ipc_imem_channel_update - Set or modify pipe config of an existing channel
0511  * @ipc_imem:       Pointer to imem data-struct
0512  * @id:         Channel config index
0513  * @chnl_cfg:       Channel config struct
0514  * @irq_moderation: Timer in usec for irq_moderation
0515  */
0516 void ipc_imem_channel_update(struct iosm_imem *ipc_imem, int id,
0517                  struct ipc_chnl_cfg chnl_cfg, u32 irq_moderation);
0518 
0519 /**
0520  * ipc_imem_channel_free -Free an IPC channel.
0521  * @channel:    Channel to be freed
0522  */
0523 void ipc_imem_channel_free(struct ipc_mem_channel *channel);
0524 
0525 /**
0526  * ipc_imem_hrtimer_stop - Stop the hrtimer
0527  * @hr_timer:   Pointer to hrtimer instance
0528  */
0529 void ipc_imem_hrtimer_stop(struct hrtimer *hr_timer);
0530 
0531 /**
0532  * ipc_imem_pipe_cleanup - Reset volatile pipe content for all channels
0533  * @ipc_imem:   Pointer to imem data-struct
0534  * @pipe:   Pipe to cleaned up
0535  */
0536 void ipc_imem_pipe_cleanup(struct iosm_imem *ipc_imem, struct ipc_pipe *pipe);
0537 
0538 /**
0539  * ipc_imem_pipe_close - Send msg to device to close pipe
0540  * @ipc_imem:   Pointer to imem data-struct
0541  * @pipe:   Pipe to be closed
0542  */
0543 void ipc_imem_pipe_close(struct iosm_imem *ipc_imem, struct ipc_pipe *pipe);
0544 
0545 /**
0546  * ipc_imem_phase_update - Get the CP execution state
0547  *            and map it to the AP phase.
0548  * @ipc_imem:   Pointer to imem data-struct
0549  *
0550  * Returns: Current ap updated phase
0551  */
0552 enum ipc_phase ipc_imem_phase_update(struct iosm_imem *ipc_imem);
0553 
0554 /**
0555  * ipc_imem_phase_get_string - Return the current operation
0556  *               phase as string.
0557  * @phase:  AP phase
0558  *
0559  * Returns: AP phase string
0560  */
0561 const char *ipc_imem_phase_get_string(enum ipc_phase phase);
0562 
0563 /**
0564  * ipc_imem_msg_send_feature_set - Send feature set message to modem
0565  * @ipc_imem:       Pointer to imem data-struct
0566  * @reset_enable:   0 = out-of-band, 1 = in-band-crash notification
0567  * @atomic_ctx:     if disabled call in tasklet context
0568  *
0569  */
0570 void ipc_imem_msg_send_feature_set(struct iosm_imem *ipc_imem,
0571                    unsigned int reset_enable, bool atomic_ctx);
0572 
0573 /**
0574  * ipc_imem_ipc_init_check - Send the init event to CP, wait a certain time and
0575  *               set CP to runtime with the context information
0576  * @ipc_imem:   Pointer to imem data-struct
0577  */
0578 void ipc_imem_ipc_init_check(struct iosm_imem *ipc_imem);
0579 
0580 /**
0581  * ipc_imem_channel_init - Initialize the channel list with UL/DL pipe pairs.
0582  * @ipc_imem:       Pointer to imem data-struct
0583  * @ctype:      Channel type
0584  * @chnl_cfg:       Channel configuration struct
0585  * @irq_moderation: Timer in usec for irq_moderation
0586  */
0587 void ipc_imem_channel_init(struct iosm_imem *ipc_imem, enum ipc_ctype ctype,
0588                struct ipc_chnl_cfg chnl_cfg, u32 irq_moderation);
0589 
0590 /**
0591  * ipc_imem_devlink_trigger_chip_info - Inform devlink that the chip
0592  *                  information are available if the
0593  *                  flashing to RAM interworking shall be
0594  *                  executed.
0595  * @ipc_imem:   Pointer to imem structure
0596  *
0597  * Returns: 0 on success, -1 on failure
0598  */
0599 int ipc_imem_devlink_trigger_chip_info(struct iosm_imem *ipc_imem);
0600 
0601 void ipc_imem_adb_timer_start(struct iosm_imem *ipc_imem);
0602 
0603 #endif