[Sound-open-firmware] [PATCH V3 1/2] ASoc: SOF: Add memory window for all platform

Pan, Xiuli xiuli.pan at linux.intel.com
Mon Mar 5 03:21:43 CET 2018



On 3/3/2018 10:16, Pierre-Louis Bossart wrote:
> And on top on my previous comments this patch causes a kernel oops - 
> likely because the matching patches are not yet merged in the firmware 
> master branch. If there is such a dependency between firmware and 
> driver, please make it clear upfront, thanks.
>
Will resent the patch with cover letter about what the changes about and 
make some modify to avoid too strict dependency that may make bisect hard.

Thanks
Xiuli
> [ 8.767359] sof-audio sof-audio: ipc: send 0x30010000
> [    9.071043] sof-audio sof-audio: error: ipc timed out for 
> 0x30010000 size 0x3c
> [    9.071202] sof-audio sof-audio: error: DSP failed to add widget id 
> 0 type 11 name : PCM0P stream Passthrough Playback reply 0
> [    9.071371] BUG: unable to handle kernel NULL pointer dereference 
> at 0000000000000050
> [    9.071497] IP: sof_widget_unload+0xe/0x90 [snd_sof]
> [    9.071569] PGD 0 P4D 0
> [    9.071615] Oops: 0000 [#1] PREEMPT SMP
> [    9.071674] Modules linked in: nls_iso8859_1 
> snd_soc_sst_byt_cht_da7213(+) intel_rapl intel_soc_dts_thermal 
> intel_soc_dts_iosf intel_powerclamp coretemp crct10dif_pclmul 
> crc32_pclmul ghash_clmulni_intel pcbc snd_hda_codec_hdmi aesni_intel 
> aes_x86_64 crypto_simd glue_helper cryptd snd_soc_rt5670 sof_acpi_dev 
> snd_soc_rt5645 snd_hda_intel snd_sof_intel_hsw snd_sof_intel_byt 
> snd_soc_rt5640 snd_soc_acpi_intel_match snd_sof_intel_bdw 
> snd_soc_rl6231 snd_sof snd_soc_acpi snd_soc_da7213 snd_hda_codec 
> lpc_ich snd_hwdep snd_seq_midi mfd_core snd_hda_core 
> snd_seq_midi_event snd_soc_core shpchp snd_compress snd_rawmidi 
> snd_pcm snd_seq snd_seq_device snd_timer snd soundcore 8250_dw 
> ip_tables x_tables autofs4 hid_generic hid_logitech_hidpp 
> hid_logitech_dj usbhid hid mmc_block i915 i2c_algo_bit drm_kms_helper 
> syscopyarea
> [    9.072676]  sysfillrect sysimgblt fb_sys_fops r8169 drm mii 
> sdhci_acpi video sdhci
> [    9.072797] CPU: 0 PID: 250 Comm: systemd-udevd Not tainted 
> 4.14.0-test+ #14
> [    9.072896] Hardware name: ADI Minnowboard Turbot D0 
> PLATFORM/MinnowBoard Turbot, BIOS MNW2MAX1.X64.0094.R01.1612052239 
> 12/05/2016
> [    9.073054] task: ffff98feb2804240 task.stack: ffffa8cbc06a0000
> [    9.073145] RIP: 0010:sof_widget_unload+0xe/0x90 [snd_sof]
> [    9.073223] RSP: 0018:ffffa8cbc06a36a8 EFLAGS: 00010286
> [    9.073300] RAX: ffffffffc053ca60 RBX: 0000000000000000 RCX: 
> 0000000000000001
> [    9.073399] RDX: 0000000000000003 RSI: ffff98feb9cf1ea0 RDI: 
> ffff98feb9e2cc20
> [    9.073497] RBP: ffffa8cbc06a36b0 R08: 0000000000000000 R09: 
> 0000000000000290
> [    9.073596] R10: ffffa8cbc06a3538 R11: 00000000ffffffff R12: 
> ffff98feb9cf1ea0
> [    9.073695] R13: 0000000000000000 R14: ffff98feb9cf1e00 R15: 
> 00000000ffffff92
> [    9.073794] FS:  00007f6ecf192400(0000) GS:ffff98feb8000000(0000) 
> knlGS:0000000000000000
> [    9.073906] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    9.073987] CR2: 0000000000000050 CR3: 0000000036e2e000 CR4: 
> 00000000001006f0
> [    9.074086] Call Trace:
> [    9.074148]  remove_widget+0x40/0x170 [snd_soc_core]
> [    9.074238]  snd_soc_tplg_widget_remove.part.22+0x22/0x30 
> [snd_soc_core]
> [    9.074348]  soc_tplg_dapm_widget_create+0xd35/0xde0 [snd_soc_core]
> [    9.074461]  soc_tplg_process_headers+0x77b/0x1f80 [snd_soc_core]
> [    9.074554]  ? _raw_spin_lock_irqsave+0x1d/0x50
> [    9.074623]  ? _raw_spin_unlock_irqrestore+0x18/0x30
> [    9.074698]  ? devres_add+0x5f/0x70
> [    9.074755]  ? assign_firmware_buf+0x98/0x200
> [    9.074837]  snd_soc_tplg_component_load+0x6e/0xa0 [snd_soc_core]
> [    9.074932]  snd_sof_load_topology+0x60/0xc0 [snd_sof]
> [    9.075011]  ? __debugfs_create_file+0xce/0x110
> [    9.075084]  sof_pcm_probe+0x41/0xa0 [snd_sof]
> [    9.075164]  snd_soc_platform_drv_probe+0x16/0x20 [snd_soc_core]
> [    9.075264]  soc_probe_component+0x286/0x3d0 [snd_soc_core]
> [    9.075360]  snd_soc_register_card+0x636/0xfd0 [snd_soc_core]
> [    9.075446]  ? __kmalloc_node_track_caller+0xee/0x2b0
> [    9.075537]  devm_snd_soc_register_card+0x41/0x80 [snd_soc_core]
> [    9.075628]  bytcht_da7213_probe+0xb9/0x100 
> [snd_soc_sst_byt_cht_da7213]
> [    9.075725]  platform_drv_probe+0x3b/0xa0
> [    9.075789]  driver_probe_device+0x2ff/0x450
> [    9.081096]  __driver_attach+0xa4/0xe0
> [    9.086348]  ? driver_probe_device+0x450/0x450
> [    9.091586]  bus_for_each_dev+0x62/0x90
> [    9.096787]  driver_attach+0x1e/0x20
> [    9.101990]  bus_add_driver+0x1c7/0x270
> [    9.107182]  ? 0xffffffffc01ac000
> [    9.112364]  driver_register+0x60/0xe0
> [    9.117550]  ? 0xffffffffc01ac000
> [    9.122741]  __platform_driver_register+0x36/0x40
> [    9.127962]  bytcht_da7213_driver_init+0x17/0x1000 
> [snd_soc_sst_byt_cht_da7213]
> [    9.133253]  do_one_initcall+0x50/0x190
> [    9.138528]  ? do_init_module+0x27/0x203
> [    9.143794]  do_init_module+0x5f/0x203
> [    9.149059]  load_module+0x259e/0x2d20
> [    9.154307]  SYSC_finit_module+0xd7/0xf0
> [    9.159532]  ? SYSC_finit_module+0xd7/0xf0
> [    9.164759]  SyS_finit_module+0xe/0x10
> [    9.169966]  do_syscall_64+0x59/0x110
> [    9.175169]  entry_SYSCALL64_slow_path+0x25/0x25
> [    9.180384] RIP: 0033:0x7f6ecea92a49
> [    9.185565] RSP: 002b:00007ffe55acdb88 EFLAGS: 00000246 ORIG_RAX: 
> 0000000000000139
> [    9.190831] RAX: ffffffffffffffda RBX: 00005575ec0f6850 RCX: 
> 00007f6ecea92a49
> [    9.196116] RDX: 0000000000000000 RSI: 00007f6ece77e1c5 RDI: 
> 0000000000000007
> [    9.201427] RBP: 00007f6ece77e1c5 R08: 0000000000000000 R09: 
> 00005575ec0f6850
> [    9.206742] R10: 0000000000000007 R11: 0000000000000246 R12: 
> 0000000000000000
> [    9.212076] R13: 00005575ec0f67f0 R14: 0000000000020000 R15: 
> 00005575ec0f6850
> [    9.217423] Code: 48 05 00 01 00 00 48 89 87 e0 04 00 00 e8 5b ed 
> cb d8 31 c0 5d c3 0f 1f 80 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 53 
> 48 8b 5e 38 <48> 8b 7b 50 48 85 ff 74 38 48 8b 87 90 00 00 00 48 8b 97 
> 88 00
> [    9.223183] RIP: sof_widget_unload+0xe/0x90 [snd_sof] RSP: 
> ffffa8cbc06a36a8
> [    9.228835] CR2: 0000000000000050
> [    9.235140] ---[ end trace d9fd6055d01be8a0 ]---
>
>
> On 03/02/2018 07:38 PM, Pierre-Louis Bossart wrote:
>>
>>
>> On 03/02/2018 03:21 AM, Xiuli Pan wrote:
>>> From: Pan Xiuli <xiuli.pan at linux.intel.com>
>>>
>>> Add memory window handler for BYT, HSW and BDW.
>>>
>>> Signed-off-by: Pan Xiuli <xiuli.pan at linux.intel.com>
>>
>>
>> Can you please run checkpatch --strict and resubmit. Nothing 
>> personal, it's the same for everyone.
>> I have no appetite for fixing this sort of formatting issues myself.
>> See also comments in the code below.
>>
>> CHECK: Comparison to NULL could be written "!sdev->info_window"
>> #67: FILE: sound/soc/sof/hw-bdw.c:402:
>> +    if (sdev->info_window == NULL)
>>
>> CHECK: Blank lines aren't necessary after an open brace '{'
>> #71: FILE: sound/soc/sof/hw-bdw.c:406:
>> +    for (i = 0; i < sdev->info_window->num_windows; i++) {
>> +
>>
>> CHECK: Alignment should match open parenthesis
>> #79: FILE: sound/soc/sof/hw-bdw.c:414:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BDW_DSP_BAR] + inbox_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #86: FILE: sound/soc/sof/hw-bdw.c:421:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BDW_DSP_BAR] + outbox_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #91: FILE: sound/soc/sof/hw-bdw.c:426:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BDW_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #96: FILE: sound/soc/sof/hw-bdw.c:431:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BDW_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #103: FILE: sound/soc/sof/hw-bdw.c:438:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BDW_DSP_BAR] + stream_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #108: FILE: sound/soc/sof/hw-bdw.c:443:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BDW_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #117: FILE: sound/soc/sof/hw-bdw.c:452:
>> +    snd_sof_dsp_mailbox_init(sdev, inbox_offset, inbox_size,
>> +        outbox_offset, outbox_size);
>>
>> CHECK: Alignment should match open parenthesis
>> #147: FILE: sound/soc/sof/hw-bdw.c:480:
>> +    snd_sof_fw_parse_ext_data(sdev,
>> +        MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready));
>>
>> CHECK: Comparison to NULL could be written "!sdev->info_window"
>> #189: FILE: sound/soc/sof/hw-byt.c:172:
>> +    if (sdev->info_window == NULL)
>>
>> CHECK: Blank lines aren't necessary after an open brace '{'
>> #193: FILE: sound/soc/sof/hw-byt.c:176:
>> +    for (i = 0; i < sdev->info_window->num_windows; i++) {
>> +
>>
>> CHECK: Alignment should match open parenthesis
>> #201: FILE: sound/soc/sof/hw-byt.c:184:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BYT_DSP_BAR] + inbox_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #208: FILE: sound/soc/sof/hw-byt.c:191:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BYT_DSP_BAR] + outbox_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #213: FILE: sound/soc/sof/hw-byt.c:196:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BYT_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #218: FILE: sound/soc/sof/hw-byt.c:201:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BYT_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #225: FILE: sound/soc/sof/hw-byt.c:208:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BYT_DSP_BAR] + stream_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #230: FILE: sound/soc/sof/hw-byt.c:213:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[BYT_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #239: FILE: sound/soc/sof/hw-byt.c:222:
>> +    snd_sof_dsp_mailbox_init(sdev, inbox_offset, inbox_size,
>> +        outbox_offset, outbox_size);
>>
>> CHECK: Alignment should match open parenthesis
>> #269: FILE: sound/soc/sof/hw-byt.c:250:
>> +    snd_sof_fw_parse_ext_data(sdev,
>> +        MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready));
>>
>> CHECK: Comparison to NULL could be written "!sdev->info_window"
>> #303: FILE: sound/soc/sof/hw-hsw.c:402:
>> +    if (sdev->info_window == NULL)
>>
>> CHECK: Blank lines aren't necessary after an open brace '{'
>> #307: FILE: sound/soc/sof/hw-hsw.c:406:
>> +    for (i = 0; i < sdev->info_window->num_windows; i++) {
>> +
>>
>> CHECK: Alignment should match open parenthesis
>> #315: FILE: sound/soc/sof/hw-hsw.c:414:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[HSW_DSP_BAR] + inbox_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #322: FILE: sound/soc/sof/hw-hsw.c:421:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[HSW_DSP_BAR] + outbox_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #327: FILE: sound/soc/sof/hw-hsw.c:426:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[HSW_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #332: FILE: sound/soc/sof/hw-hsw.c:431:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[HSW_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #339: FILE: sound/soc/sof/hw-hsw.c:438:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[HSW_DSP_BAR] + stream_offset,
>>
>> CHECK: Alignment should match open parenthesis
>> #344: FILE: sound/soc/sof/hw-hsw.c:443:
>> +            snd_sof_debugfs_create_item(sdev,
>> +                sdev->bar[HSW_DSP_BAR] + elem->offset +
>>
>> CHECK: Alignment should match open parenthesis
>> #353: FILE: sound/soc/sof/hw-hsw.c:452:
>> +    snd_sof_dsp_mailbox_init(sdev, inbox_offset, inbox_size,
>> +        outbox_offset, outbox_size);
>>
>> CHECK: Alignment should match open parenthesis
>> #382: FILE: sound/soc/sof/hw-hsw.c:479:
>> +    snd_sof_fw_parse_ext_data(sdev,
>> +        MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready));
>>
>>> ---
>>> Test with:
>>> Mininow max rt5651 GP-MRB nocodec
>>> SOF master: 1693b66bb1d804ded975767cc1e5911e6ff9c93c
>>> SOF-Tool master: a02abb799405d0e4ad0d6bb46eacf6fbe958c06e
>>> https://github.com/plbossart/sound/tree/topic/sof-v4.14:
>>> 9513a73b981bc1917705671ec54402a7e21672eb
>>>
>>> ---
>>>   sound/soc/sof/hw-apl.c | 11 +++++--
>>>   sound/soc/sof/hw-bdw.c | 86 
>>> ++++++++++++++++++++++++++++++++++++++++++-------
>>>   sound/soc/sof/hw-byt.c | 87 
>>> +++++++++++++++++++++++++++++++++++++++++++-------
>>>   sound/soc/sof/hw-hsw.c | 85 
>>> +++++++++++++++++++++++++++++++++++++++++-------
>>>   4 files changed, 233 insertions(+), 36 deletions(-)
>>>
>>> diff --git a/sound/soc/sof/hw-apl.c b/sound/soc/sof/hw-apl.c
>>> index bfbdd915..de0efe1 100644
>>> --- a/sound/soc/sof/hw-apl.c
>>> +++ b/sound/soc/sof/hw-apl.c
>>> @@ -1089,9 +1089,13 @@ static int apl_prepare(struct snd_sof_dev 
>>> *sdev, unsigned int format,
>>>   static void apl_get_windows(struct snd_sof_dev *sdev)
>>>   {
>>>       struct sof_ipc_window_elem *elem;
>>> +    u32 outbox_offset = 0;
>>> +    u32 stream_offset = 0;
>>> +    u32 inbox_offset = 0;
>>> +    u32 outbox_size = 0;
>>> +    u32 stream_size = 0;
>>> +    u32 inbox_size = 0;
>>>       int i;
>>> -    u32 inbox_offset = 0, outbox_offset = 0;
>>> -    u32 inbox_size = 0, outbox_size = 0;
>>>         if (!sdev->info_window)
>>>           return;
>>> @@ -1135,6 +1139,9 @@ static void apl_get_windows(struct snd_sof_dev 
>>> *sdev)
>>>                               elem->size, "debug");
>>>               break;
>>>           case SOF_IPC_REGION_STREAM:
>>> +            stream_offset =
>>> +                elem->offset + SRAM_WINDOW_OFFSET(elem->id);
>>> +            stream_size = elem->size;
>>>               snd_sof_debugfs_create_item(sdev,
>>>                               sdev->bar[APL_DSP_BAR] +
>>>                               elem->offset +
>>> diff --git a/sound/soc/sof/hw-bdw.c b/sound/soc/sof/hw-bdw.c
>>> index bc3141f..5ec0c5b 100644
>>> --- a/sound/soc/sof/hw-bdw.c
>>> +++ b/sound/soc/sof/hw-bdw.c
>>> @@ -63,7 +63,6 @@ static const struct snd_sof_debugfs_map 
>>> bdw_debugfs[] = {
>>>       {"iram", BDW_DSP_BAR, IRAM_OFFSET, BDW_IRAM_SIZE},
>>>       {"dram", BDW_DSP_BAR, DRAM_OFFSET, BDW_DRAM_SIZE},
>>>       {"shim", BDW_DSP_BAR, SHIM_OFFSET, SHIM_SIZE},
>>> -    {"mbox", BDW_DSP_BAR, MBOX_OFFSET, MBOX_SIZE},
>>>   };
>>>     /*
>>> @@ -379,6 +378,75 @@ static irqreturn_t bdw_irq_thread(int irq, void 
>>> *context)
>>>   /*
>>>    * IPC Firmware ready.
>>>    */
>>> +static void bdw_get_windows(struct snd_sof_dev *sdev)
>>> +{
>>> +    struct sof_ipc_window_elem *elem;
>>> +    u32 outbox_offset = 0;
>>> +    u32 stream_offset = 0;
>>> +    u32 inbox_offset = 0;
>>> +    u32 outbox_size = 0;
>>> +    u32 stream_size = 0;
>>> +    u32 inbox_size = 0;
>>> +    int i;
>>> +
>>> +    if (sdev->info_window == NULL)
>>> +        return;
>> with no error?
>>
>>> +
>>> +    for (i = 0; i < sdev->info_window->num_windows; i++) {
>>> +
>>> +        elem = &sdev->info_window->window[i];
>>> +
>>> +        switch (elem->type) {
>>> +        case SOF_IPC_REGION_UPBOX:
>>> +            inbox_offset = elem->offset + MBOX_OFFSET;
>>> +            inbox_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BDW_DSP_BAR] + inbox_offset,
>>> +                elem->size, "inbox");
>>> +            break;
>>> +        case SOF_IPC_REGION_DOWNBOX:
>>> +            outbox_offset = elem->offset + MBOX_OFFSET;
>>> +            outbox_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BDW_DSP_BAR] + outbox_offset,
>>> +                elem->size, "outbox");
>>> +            break;
>>> +        case SOF_IPC_REGION_TRACE:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BDW_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "etrace");
>>> +            break;
>>> +        case SOF_IPC_REGION_DEBUG:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BDW_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "debug");
>>> +            break;
>>> +        case SOF_IPC_REGION_STREAM:
>>> +            stream_offset = elem->offset + MBOX_OFFSET;
>>> +            stream_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BDW_DSP_BAR] + stream_offset,
>>> +                elem->size, "stream");
>>> +            break;
>>> +        case SOF_IPC_REGION_REGS:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BDW_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "regs");
>>> +            break;
>>> +        default:
>>> +            break;
>> so here you will init a mailbox of size zero? This looks like an 
>> error, why continue with the execution flow.
>>> +        }
>>> +    }
>>> +
>>> +    snd_sof_dsp_mailbox_init(sdev, inbox_offset, inbox_size,
>>> +        outbox_offset, outbox_size);
>>> +
>>> +    dev_dbg(sdev->dev, " mailbox upstream 0x%x - size 0x%x\n",
>>> +        inbox_offset, inbox_size);
>>> +    dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n",
>>> +        outbox_offset, outbox_size);
>>> +}
>>> +
>>>   static int bdw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
>>>   {
>>>       struct sof_ipc_fw_ready *fw_ready = &sdev->fw_ready;
>>> @@ -394,19 +462,15 @@ static int bdw_fw_ready(struct snd_sof_dev 
>>> *sdev, u32 msg_id)
>>>       /* copy data from the DSP FW ready offset */
>>>       bdw_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));
>>>   -    snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
>>> -                 fw_ready->dspbox_size,
>>> -                 fw_ready->hostbox_offset,
>>> -                 fw_ready->hostbox_size);
>>> -
>>> -    dev_dbg(sdev->dev, " mailbox DSP initiated 0x%x - size 0x%x\n",
>>> -        fw_ready->dspbox_offset, fw_ready->dspbox_size);
>>> -    dev_dbg(sdev->dev, " mailbox Host initiated 0x%x - size 0x%x\n",
>>> -        fw_ready->hostbox_offset, fw_ready->hostbox_size);
>>> -
>>>       dev_info(sdev->dev, " Firmware info: version %d:%d-%s build %d 
>>> on %s:%s\n",
>>>            v->major, v->minor, v->tag, v->build, v->date, v->time);
>>>   +    /* now check for extended data */
>>> +    snd_sof_fw_parse_ext_data(sdev,
>>> +        MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready));
>>> +
>>> +    bdw_get_windows(sdev);
>>> +
>>>       return 0;
>>>   }
>>>   diff --git a/sound/soc/sof/hw-byt.c b/sound/soc/sof/hw-byt.c
>>> index 209f72a..031cec6 100644
>>> --- a/sound/soc/sof/hw-byt.c
>>> +++ b/sound/soc/sof/hw-byt.c
>>> @@ -73,7 +73,6 @@ static const struct snd_sof_debugfs_map 
>>> byt_debugfs[] = {
>>>       {"iram", BYT_DSP_BAR, IRAM_OFFSET, IRAM_SIZE},
>>>       {"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE},
>>>       {"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE},
>>> -    {"mbox", BYT_DSP_BAR, MBOX_OFFSET, MBOX_SIZE},
>>>   };
>>>     static const struct snd_sof_debugfs_map cht_debugfs[] = {
>>> @@ -89,7 +88,6 @@ static const struct snd_sof_debugfs_map 
>>> cht_debugfs[] = {
>>>       {"iram", BYT_DSP_BAR, IRAM_OFFSET, IRAM_SIZE},
>>>       {"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE},
>>>       {"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE},
>>> -    {"mbox", BYT_DSP_BAR, MBOX_OFFSET, MBOX_SIZE},
>>>   };
>>>     static void byt_dump(struct snd_sof_dev *sdev, u32 flags)
>>> @@ -197,6 +195,75 @@ static void byt_block_read(struct snd_sof_dev 
>>> *sdev, u32 offset, void *dest,
>>>   /*
>>>    * IPC Firmware ready.
>>>    */
>>> +static void byt_get_windows(struct snd_sof_dev *sdev)
>>> +{
>>> +    struct sof_ipc_window_elem *elem;
>>> +    u32 outbox_offset = 0;
>>> +    u32 stream_offset = 0;
>>> +    u32 inbox_offset = 0;
>>> +    u32 outbox_size = 0;
>>> +    u32 stream_size = 0;
>>> +    u32 inbox_size = 0;
>>> +    int i;
>>> +
>>> +    if (sdev->info_window == NULL)
>>> +        return;
>> no error?
>>> +
>>> +    for (i = 0; i < sdev->info_window->num_windows; i++) {
>>> +
>>> +        elem = &sdev->info_window->window[i];
>>> +
>>> +        switch (elem->type) {
>>> +        case SOF_IPC_REGION_UPBOX:
>>> +            inbox_offset = elem->offset + MBOX_OFFSET;
>>> +            inbox_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BYT_DSP_BAR] + inbox_offset,
>>> +                elem->size, "inbox");
>>> +            break;
>>> +        case SOF_IPC_REGION_DOWNBOX:
>>> +            outbox_offset = elem->offset + MBOX_OFFSET;
>>> +            outbox_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BYT_DSP_BAR] + outbox_offset,
>>> +                elem->size, "outbox");
>>> +            break;
>>> +        case SOF_IPC_REGION_TRACE:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BYT_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "etrace");
>>> +            break;
>>> +        case SOF_IPC_REGION_DEBUG:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BYT_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "debug");
>>> +            break;
>>> +        case SOF_IPC_REGION_STREAM:
>>> +            stream_offset = elem->offset + MBOX_OFFSET;
>>> +            stream_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BYT_DSP_BAR] + stream_offset,
>>> +                elem->size, "stream");
>>> +            break;
>>> +        case SOF_IPC_REGION_REGS:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[BYT_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "regs");
>>> +            break;
>>> +        default:
>>> +            break;
>> same, this looks wrong.
>>> +        }
>>> +    }
>>> +
>>> +    snd_sof_dsp_mailbox_init(sdev, inbox_offset, inbox_size,
>>> +        outbox_offset, outbox_size);
>>> +
>>> +    dev_dbg(sdev->dev, " mailbox upstream 0x%x - size 0x%x\n",
>>> +        inbox_offset, inbox_size);
>>> +    dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n",
>>> +        outbox_offset, outbox_size);
>>> +}
>>> +
>>>   static int byt_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
>>>   {
>>>       struct sof_ipc_fw_ready *fw_ready = &sdev->fw_ready;
>>> @@ -212,19 +279,15 @@ static int byt_fw_ready(struct snd_sof_dev 
>>> *sdev, u32 msg_id)
>>>       /* copy data from the DSP FW ready offset */
>>>       byt_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));
>>>   -    snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
>>> -                 fw_ready->dspbox_size,
>>> -                 fw_ready->hostbox_offset,
>>> -                 fw_ready->hostbox_size);
>>> -
>>> -    dev_dbg(sdev->dev, " mailbox DSP initiated 0x%x - size 0x%x\n",
>>> -        fw_ready->dspbox_offset, fw_ready->dspbox_size);
>>> -    dev_dbg(sdev->dev, " mailbox Host initiated 0x%x - size 0x%x\n",
>>> -        fw_ready->hostbox_offset, fw_ready->hostbox_size);
>>> -
>>>       dev_info(sdev->dev, " Firmware info: version %d:%d-%s build %d 
>>> on %s:%s\n",
>>>            v->major, v->minor, v->tag, v->build, v->date, v->time);
>>>   +    /* now check for extended data */
>>> +    snd_sof_fw_parse_ext_data(sdev,
>>> +        MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready));
>>> +
>>> +    byt_get_windows(sdev);
>>> +
>>>       return 0;
>>>   }
>>>   diff --git a/sound/soc/sof/hw-hsw.c b/sound/soc/sof/hw-hsw.c
>>> index c6366bb..2f36216 100644
>>> --- a/sound/soc/sof/hw-hsw.c
>>> +++ b/sound/soc/sof/hw-hsw.c
>>> @@ -63,7 +63,6 @@ static const struct snd_sof_debugfs_map 
>>> hsw_debugfs[] = {
>>>       {"iram", HSW_DSP_BAR, IRAM_OFFSET, HSW_IRAM_SIZE},
>>>       {"dram", HSW_DSP_BAR, DRAM_OFFSET, HSW_DRAM_SIZE},
>>>       {"shim", HSW_DSP_BAR, SHIM_OFFSET, SHIM_SIZE},
>>> -    {"mbox", HSW_DSP_BAR, MBOX_OFFSET, MBOX_SIZE},
>>>   };
>>>     /*
>>> @@ -380,6 +379,75 @@ static irqreturn_t hsw_irq_thread(int irq, void 
>>> *context)
>>>   /*
>>>    * IPC Firmware ready.
>>>    */
>>> +static void hsw_get_windows(struct snd_sof_dev *sdev)
>>> +{
>>> +    struct sof_ipc_window_elem *elem;
>>> +    u32 outbox_offset = 0;
>>> +    u32 stream_offset = 0;
>>> +    u32 inbox_offset = 0;
>>> +    u32 outbox_size = 0;
>>> +    u32 stream_size = 0;
>>> +    u32 inbox_size = 0;
>>> +    int i;
>>> +
>>> +    if (sdev->info_window == NULL)
>>> +        return;
>> no error?
>>> +
>>> +    for (i = 0; i < sdev->info_window->num_windows; i++) {
>>> +
>>> +        elem = &sdev->info_window->window[i];
>>> +
>>> +        switch (elem->type) {
>>> +        case SOF_IPC_REGION_UPBOX:
>>> +            inbox_offset = elem->offset + MBOX_OFFSET;
>>> +            inbox_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[HSW_DSP_BAR] + inbox_offset,
>>> +                elem->size, "inbox");
>>> +            break;
>>> +        case SOF_IPC_REGION_DOWNBOX:
>>> +            outbox_offset = elem->offset + MBOX_OFFSET;
>>> +            outbox_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[HSW_DSP_BAR] + outbox_offset,
>>> +                elem->size, "outbox");
>>> +            break;
>>> +        case SOF_IPC_REGION_TRACE:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[HSW_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "etrace");
>>> +            break;
>>> +        case SOF_IPC_REGION_DEBUG:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[HSW_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "debug");
>>> +            break;
>>> +        case SOF_IPC_REGION_STREAM:
>>> +            stream_offset = elem->offset + MBOX_OFFSET;
>>> +            stream_size = elem->size;
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[HSW_DSP_BAR] + stream_offset,
>>> +                elem->size, "stream");
>>> +            break;
>>> +        case SOF_IPC_REGION_REGS:
>>> +            snd_sof_debugfs_create_item(sdev,
>>> +                sdev->bar[HSW_DSP_BAR] + elem->offset +
>>> +                MBOX_OFFSET, elem->size, "regs");
>>> +            break;
>>> +        default:
>>> +            break;
>> same here, this looks wrong.
>>> +        }
>>> +    }
>>> +
>>> +    snd_sof_dsp_mailbox_init(sdev, inbox_offset, inbox_size,
>>> +        outbox_offset, outbox_size);
>>> +
>>> +    dev_dbg(sdev->dev, " mailbox upstream 0x%x - size 0x%x\n",
>>> +        inbox_offset, inbox_size);
>>> +    dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n",
>>> +        outbox_offset, outbox_size);
>>> +}
>>> +
>>>   static int hsw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
>>>   {
>>>       struct sof_ipc_fw_ready *fw_ready = &sdev->fw_ready;
>>> @@ -395,18 +463,13 @@ static int hsw_fw_ready(struct snd_sof_dev 
>>> *sdev, u32 msg_id)
>>>       /* copy data from the DSP FW ready offset */
>>>       hsw_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));
>>>   -    snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
>>> -                 fw_ready->dspbox_size,
>>> -                 fw_ready->hostbox_offset,
>>> -                 fw_ready->hostbox_size);
>>> -
>>> -    dev_dbg(sdev->dev, " mailbox DSP initiated 0x%x - size 0x%x\n",
>>> -        fw_ready->dspbox_offset, fw_ready->dspbox_size);
>>> -    dev_dbg(sdev->dev, " mailbox Host initiated 0x%x - size 0x%x\n",
>>> -        fw_ready->hostbox_offset, fw_ready->hostbox_size);
>>> -
>>>       dev_info(sdev->dev, " Firmware info: version %d:%d-%s build %d 
>>> on %s:%s\n",
>>>            v->major, v->minor, v->tag, v->build, v->date, v->time);
>>> +    /* now check for extended data */
>>> +    snd_sof_fw_parse_ext_data(sdev,
>>> +        MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready));
>>> +
>>> +    hsw_get_windows(sdev);
>>>         return 0;
>>>   }
>>
>



More information about the Sound-open-firmware mailing list