Skip to content

Commit 936898a

Browse files
ujfalusiranj063
authored andcommitted
ASoC: SOF: loader: Remove the old fw_ready related code
The fw_ready is handled internally to ipc3, we can remove the old code from the loader.c along with the functions only used by the fw_ready() Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 35ae1a7 commit 936898a

3 files changed

Lines changed: 0 additions & 250 deletions

File tree

‎sound/soc/sof/ipc.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,21 +188,6 @@ int snd_sof_ipc_valid(struct snd_sof_dev *sdev)
188188
}
189189
EXPORT_SYMBOL(snd_sof_ipc_valid);
190190

191-
intsof_ipc_init_msg_memory(structsnd_sof_dev*sdev)
192-
{
193-
structsnd_sof_ipc_msg*msg;
194-
195-
msg=&sdev->ipc->msg;
196-
197-
msg->reply_data=devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL);
198-
if (!msg->reply_data)
199-
return-ENOMEM;
200-
201-
sdev->ipc->max_payload_size=SOF_IPC_MSG_MAX_SIZE;
202-
203-
return0;
204-
}
205-
206191
structsnd_sof_ipc*snd_sof_ipc_init(structsnd_sof_dev*sdev)
207192
{
208193
structsnd_sof_ipc*ipc;

‎sound/soc/sof/loader.c‎

Lines changed: 0 additions & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -86,69 +86,6 @@ static int get_cc_info(struct snd_sof_dev *sdev,
8686
return0;
8787
}
8888

89-
/* parse the extended FW boot data structures from FW boot message */
90-
staticintsnd_sof_fw_parse_ext_data(structsnd_sof_dev*sdev, u32offset)
91-
{
92-
structsof_ipc_ext_data_hdr*ext_hdr;
93-
void*ext_data;
94-
intret=0;
95-
96-
ext_data=kzalloc(PAGE_SIZE, GFP_KERNEL);
97-
if (!ext_data)
98-
return-ENOMEM;
99-
100-
/* get first header */
101-
snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, offset, ext_data,
102-
sizeof(*ext_hdr));
103-
ext_hdr=ext_data;
104-
105-
while (ext_hdr->hdr.cmd==SOF_IPC_FW_READY) {
106-
/* read in ext structure */
107-
snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM,
108-
offset+sizeof(*ext_hdr),
109-
(void*)((u8*)ext_data+sizeof(*ext_hdr)),
110-
ext_hdr->hdr.size-sizeof(*ext_hdr));
111-
112-
dev_dbg(sdev->dev, "found ext header type %d size 0x%x\n",
113-
ext_hdr->type, ext_hdr->hdr.size);
114-
115-
/* process structure data */
116-
switch (ext_hdr->type) {
117-
caseSOF_IPC_EXT_WINDOW:
118-
ret=get_ext_windows(sdev, ext_hdr);
119-
break;
120-
caseSOF_IPC_EXT_CC_INFO:
121-
ret=get_cc_info(sdev, ext_hdr);
122-
break;
123-
caseSOF_IPC_EXT_UNUSED:
124-
caseSOF_IPC_EXT_PROBE_INFO:
125-
caseSOF_IPC_EXT_USER_ABI_INFO:
126-
/* They are supported but we don't do anything here */
127-
break;
128-
default:
129-
dev_info(sdev->dev, "unknown ext header type %d size 0x%x\n",
130-
ext_hdr->type, ext_hdr->hdr.size);
131-
ret=0;
132-
break;
133-
}
134-
135-
if (ret<0) {
136-
dev_err(sdev->dev, "error: failed to parse ext data type %d\n",
137-
ext_hdr->type);
138-
break;
139-
}
140-
141-
/* move to next header */
142-
offset+=ext_hdr->hdr.size;
143-
snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, offset, ext_data,
144-
sizeof(*ext_hdr));
145-
ext_hdr=ext_data;
146-
}
147-
148-
kfree(ext_data);
149-
returnret;
150-
}
151-
15289
staticintext_man_get_fw_version(structsnd_sof_dev*sdev,
15390
conststructsof_ext_man_elem_header*hdr)
15491
{
@@ -358,170 +295,6 @@ static int snd_sof_fw_ext_man_parse(struct snd_sof_dev *sdev,
358295
returnext_man_size;
359296
}
360297

361-
/*
362-
* IPC Firmware ready.
363-
*/
364-
staticvoidsof_get_windows(structsnd_sof_dev*sdev)
365-
{
366-
structsof_ipc_window_elem*elem;
367-
u32outbox_offset=0;
368-
u32stream_offset=0;
369-
u32inbox_offset=0;
370-
u32outbox_size=0;
371-
u32stream_size=0;
372-
u32inbox_size=0;
373-
u32debug_size=0;
374-
u32debug_offset=0;
375-
intwindow_offset;
376-
inti;
377-
378-
if (!sdev->info_window) {
379-
dev_err(sdev->dev, "error: have no window info\n");
380-
return;
381-
}
382-
383-
for (i=0; i<sdev->info_window->num_windows; i++) {
384-
elem=&sdev->info_window->window[i];
385-
386-
window_offset=snd_sof_dsp_get_window_offset(sdev, elem->id);
387-
if (window_offset<0) {
388-
dev_warn(sdev->dev, "warn: no offset for window %d\n",
389-
elem->id);
390-
continue;
391-
}
392-
393-
switch (elem->type) {
394-
caseSOF_IPC_REGION_UPBOX:
395-
inbox_offset=window_offset+elem->offset;
396-
inbox_size=elem->size;
397-
snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
398-
inbox_offset,
399-
elem->size, "inbox",
400-
SOF_DEBUGFS_ACCESS_D0_ONLY);
401-
break;
402-
caseSOF_IPC_REGION_DOWNBOX:
403-
outbox_offset=window_offset+elem->offset;
404-
outbox_size=elem->size;
405-
snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
406-
outbox_offset,
407-
elem->size, "outbox",
408-
SOF_DEBUGFS_ACCESS_D0_ONLY);
409-
break;
410-
caseSOF_IPC_REGION_TRACE:
411-
snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
412-
window_offset+elem->offset,
413-
elem->size, "etrace",
414-
SOF_DEBUGFS_ACCESS_D0_ONLY);
415-
break;
416-
caseSOF_IPC_REGION_DEBUG:
417-
debug_offset=window_offset+elem->offset;
418-
debug_size=elem->size;
419-
snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
420-
window_offset+elem->offset,
421-
elem->size, "debug",
422-
SOF_DEBUGFS_ACCESS_D0_ONLY);
423-
break;
424-
caseSOF_IPC_REGION_STREAM:
425-
stream_offset=window_offset+elem->offset;
426-
stream_size=elem->size;
427-
snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
428-
stream_offset,
429-
elem->size, "stream",
430-
SOF_DEBUGFS_ACCESS_D0_ONLY);
431-
break;
432-
caseSOF_IPC_REGION_REGS:
433-
snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
434-
window_offset+elem->offset,
435-
elem->size, "regs",
436-
SOF_DEBUGFS_ACCESS_D0_ONLY);
437-
break;
438-
caseSOF_IPC_REGION_EXCEPTION:
439-
sdev->dsp_oops_offset=window_offset+elem->offset;
440-
snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
441-
window_offset+elem->offset,
442-
elem->size, "exception",
443-
SOF_DEBUGFS_ACCESS_D0_ONLY);
444-
break;
445-
default:
446-
dev_err(sdev->dev, "error: get illegal window info\n");
447-
return;
448-
}
449-
}
450-
451-
if (outbox_size==0||inbox_size==0) {
452-
dev_err(sdev->dev, "error: get illegal mailbox window\n");
453-
return;
454-
}
455-
456-
sdev->dsp_box.offset=inbox_offset;
457-
sdev->dsp_box.size=inbox_size;
458-
459-
sdev->host_box.offset=outbox_offset;
460-
sdev->host_box.size=outbox_size;
461-
462-
sdev->stream_box.offset=stream_offset;
463-
sdev->stream_box.size=stream_size;
464-
465-
sdev->debug_box.offset=debug_offset;
466-
sdev->debug_box.size=debug_size;
467-
468-
dev_dbg(sdev->dev, " mailbox upstream 0x%x - size 0x%x\n",
469-
inbox_offset, inbox_size);
470-
dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n",
471-
outbox_offset, outbox_size);
472-
dev_dbg(sdev->dev, " stream region 0x%x - size 0x%x\n",
473-
stream_offset, stream_size);
474-
dev_dbg(sdev->dev, " debug region 0x%x - size 0x%x\n",
475-
debug_offset, debug_size);
476-
}
477-
478-
/* check for ABI compatibility and create memory windows on first boot */
479-
intsof_fw_ready(structsnd_sof_dev*sdev, u32msg_id)
480-
{
481-
structsof_ipc_fw_ready*fw_ready=&sdev->fw_ready;
482-
intoffset;
483-
intret;
484-
485-
/* mailbox must be on 4k boundary */
486-
offset=snd_sof_dsp_get_mailbox_offset(sdev);
487-
if (offset<0) {
488-
dev_err(sdev->dev, "error: have no mailbox offset\n");
489-
returnoffset;
490-
}
491-
492-
dev_dbg(sdev->dev, "ipc: DSP is ready 0x%8.8x offset 0x%x\n",
493-
msg_id, offset);
494-
495-
/* no need to re-check version/ABI for subsequent boots */
496-
if (!sdev->first_boot)
497-
return0;
498-
499-
/*
500-
* copy data from the DSP FW ready offset
501-
* Subsequent error handling is not needed for BLK_TYPE_SRAM
502-
*/
503-
ret=snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, offset, fw_ready,
504-
sizeof(*fw_ready));
505-
if (ret) {
506-
dev_err(sdev->dev,
507-
"error: unable to read fw_ready, read from TYPE_SRAM failed\n");
508-
returnret;
509-
}
510-
511-
/* make sure ABI version is compatible */
512-
ret=snd_sof_ipc_valid(sdev);
513-
if (ret<0)
514-
returnret;
515-
516-
/* now check for extended data */
517-
snd_sof_fw_parse_ext_data(sdev, offset+sizeof(structsof_ipc_fw_ready));
518-
519-
sof_get_windows(sdev);
520-
521-
returnsof_ipc_init_msg_memory(sdev);
522-
}
523-
EXPORT_SYMBOL(sof_fw_ready);
524-
525298
/* generic module parser for mmaped DSPs */
526299
intsnd_sof_parse_module_memcpy(structsnd_sof_dev*sdev,
527300
structsnd_sof_mod_hdr*module)

‎sound/soc/sof/sof-priv.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ struct snd_sof_dsp_ops {
182182
int (*load_firmware)(structsnd_sof_dev*sof_dev); /* mandatory */
183183
int (*load_module)(structsnd_sof_dev*sof_dev,
184184
structsnd_sof_mod_hdr*hdr); /* optional */
185-
/*
186-
* FW ready checks for ABI compatibility and creates
187-
* memory windows at first boot
188-
*/
189-
int (*fw_ready)(structsnd_sof_dev*sdev, u32msg_id); /* mandatory */
190185

191186
/* connect pcm substream to a host stream */
192187
int (*pcm_open)(structsnd_sof_dev*sdev,
@@ -609,7 +604,6 @@ int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg
609604
void*reply_data, size_treply_bytes);
610605
intsof_ipc_send_msg(structsnd_sof_dev*sdev, void*msg_data, size_tmsg_bytes,
611606
size_treply_bytes);
612-
intsof_ipc_init_msg_memory(structsnd_sof_dev*sdev);
613607

614608
staticinlinevoidsnd_sof_ipc_process_reply(structsnd_sof_dev*sdev, u32msg_id)
615609
{
@@ -681,8 +675,6 @@ int sof_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
681675
intsof_block_read(structsnd_sof_dev*sdev, enumsnd_sof_fw_blk_typeblk_type,
682676
u32offset, void*dest, size_tsize);
683677

684-
intsof_fw_ready(structsnd_sof_dev*sdev, u32msg_id);
685-
686678
intsof_ipc_msg_data(structsnd_sof_dev*sdev,
687679
structsnd_pcm_substream*substream,
688680
void*p, size_tsz);

0 commit comments

Comments
 (0)