@@ -93,9 +93,35 @@ static void mbox_reply_fn(const struct device *mbox, void *arg)
9393 ipc_get ()-> is_notification_pending = false;
9494}
9595
96+ /* "Host Page Table" support. This isn't really a page table, it's a
97+ * packed array of PPN addresses (basically a scatter/gather list)
98+ * used to configure the buffer used for dummy_dma, which is a "DMA"
99+ * driver that works by directly copying data in shared memory. And
100+ * somewhat confusingly, it's itself configured at runtime by "DMA"
101+ * over the same mechanism (instead of e.g. by a IPC command, which
102+ * would fit just fine!). All of this is degenerate with MTK anyway,
103+ * because the actual addresses being passed are in a DRAM region
104+ * dedicated for the purpose and are AFAICT guaranteed contiguous.
105+ *
106+ * Note: the 256 byte page table size is fixed by protocol in the
107+ * kernel driver, but here in SOF it's always been a platform symbol.
108+ * But it's not tunable! Don't touch it.
109+ */
110+ static uint8_t hostbuf_ptable [256 ];
111+ static struct ipc_data_host_buffer mtk_host_buffer ;
112+
113+ struct ipc_data_host_buffer * ipc_platform_get_host_buffer (struct ipc * ipc )
114+ {
115+ return & mtk_host_buffer ;
116+ }
117+
96118/* Called out of ipc_init(), which is called out of platform_init() below */
97119int platform_ipc_init (struct ipc * ipc )
98120{
121+ mtk_host_buffer .page_table = hostbuf_ptable ;
122+ mtk_host_buffer .dmac = dma_get (DMA_DIR_HMEM_TO_LMEM , 0 , DMA_DEV_HOST ,
123+ DMA_ACCESS_SHARED );
124+
99125 schedule_task_init_edf (& ipc -> ipc_task , SOF_UUID (zipc_task_uuid ),
100126 & ipc_task_ops , ipc , 0 , 0 );
101127
@@ -118,7 +144,7 @@ void interrupt_clear_mask(uint32_t irq, uint32_t mask)
118144{
119145 /* This is required out of dma_multi_chan_domain but nothing
120146 * defines it in Zephyr builds. Stub with a noop here,
121- * knowing that MTK DMA devices don't have interrupts.
147+ * knowing that MTK " DMA" " devices" don't have interrupts.
122148 */
123149}
124150
@@ -146,8 +172,8 @@ int platform_init(struct sof *sof)
146172{
147173 clocks_init (sof );
148174 sof -> platform_timer_domain = zephyr_domain_init (PLATFORM_DEFAULT_CLOCK );
149- ipc_init (sof );
150175 mtk_dai_init (sof );
176+ ipc_init (sof );
151177 scheduler_init_edf ();
152178 scheduler_init_ll (sof -> platform_timer_domain );
153179 sof -> platform_dma_domain =
0 commit comments