Hd-Audio corb/rirb problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Hd-Audio corb/rirb problem

Post by Kamal123 »

Hi, currently writing hd-audio driver. I have passed the reset process, my driver resets the controller and take it out of reset mode. It also setup corb and rirb. But the problem is I can send command but I receive 0 response, tested in virtual box latest version and qemu.
I iterate through statests register for codec. I found only one codec in vbox and it's fine. But I couldn't received any response in rirb buffer.
My code- https://github.com/manaskamal/aurora-xe ... da/hda.cpp
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Hd-Audio corb/rirb problem

Post by Klakap »

Code: Select all

rirb_base = (uintptr_t)get_physical_address((uint64_t)_ihd_audio.rirb);
_aud_outl_(RIRBLBASE, rirb_base);
_aud_outl_(RIRBUBASE, rirb_base >> 32);
CORB/RIRB is memory aligned, LBASE register has first 7 bits hardwired to zero.

Code: Select all

_aud_outw_ (CORBRP, 0x8000);

_aud_outw_ (CORBRP, 0x0);
You have to wait a little between these commands, and you have to be sure that CORB RP set bit 15 after first command and that bit 15 is clear after second command.

Also it is important that in RIRB you receive 8 bytes, from whose is first dword response to verb.
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Re: Hd-Audio corb/rirb problem

Post by Kamal123 »

Klakap wrote:

Code: Select all

rirb_base = (uintptr_t)get_physical_address((uint64_t)_ihd_audio.rirb);
_aud_outl_(RIRBLBASE, rirb_base);
_aud_outl_(RIRBUBASE, rirb_base >> 32);
CORB/RIRB is memory aligned, LBASE register has first 7 bits hardwired to zero.

Code: Select all

_aud_outw_ (CORBRP, 0x8000);

_aud_outw_ (CORBRP, 0x0);
You have to wait a little between these commands, and you have to be sure that CORB RP set bit 15 after first command and that bit 15 is clear after second command.

Also it is important that in RIRB you receive 8 bytes, from whose is first dword response to verb.

Thank you so much for your reply, It's still not working, I get 0 response. If I use immediate commands interface, I get response only in qemu not in virtual box.
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Hd-Audio corb/rirb problem

Post by Klakap »

Because you set CORB write pointer to 0, you have to write first command to CORB entry 1, then increase CORB write pointer to 1 and read response from RIRB entry 1. (by CORB entry 1 I mean CORB_MEMORY+4 bytes and by RIRB entry 1 RIRB_MEMORY+8 bytes)
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Re: Hd-Audio corb/rirb problem

Post by Kamal123 »

Klakap wrote:Because you set CORB write pointer to 0, you have to write first command to CORB entry 1, then increase CORB write pointer to 1 and read response from RIRB entry 1. (by CORB entry 1 I mean CORB_MEMORY+4 bytes and by RIRB entry 1 RIRB_MEMORY+8 bytes)
Thank you so much for pointing my mistake, now I get response from hd audio controller. In qemu I found one audio output, and in virtual box I found three audio output.
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Re: Hd-Audio corb/rirb problem

Post by Kamal123 »

Kamal123 wrote:
Klakap wrote:Because you set CORB write pointer to 0, you have to write first command to CORB entry 1, then increase CORB write pointer to 1 and read response from RIRB entry 1. (by CORB entry 1 I mean CORB_MEMORY+4 bytes and by RIRB entry 1 RIRB_MEMORY+8 bytes)
Thank you so much for pointing my mistake, now I get response from hd audio controller. In qemu I found one audio output, and in virtual box I found three audio output.
Sorry!!..again I was doing wrong, I was not iterating through num_widgets. Now I get one audio output, one audio input and two pin complex in qemu and one audio output in virtual box. Once again, thank you so much
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Re: Hd-Audio corb/rirb problem

Post by Kamal123 »

Hi, i found a problem with virtual box, seems that virtual box don't update corb read pointer.. I send verb after increasing the corb write pointer. But virtual box keeps the corb read pointer in between 0 and 1.
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Re: Hd-Audio corb/rirb problem

Post by Kamal123 »

Ok, it's working now, corb dma engine was not started properly, I was using _aud_outl_ instead of _aud_outb_, since corbctl is 1 byte in size. Now, I am getting list of widgets in virtual box, with vendor I'd 8384.
My code -> https://github.com/manaskamal/aurora-xe ... da/hda.cpp
Post Reply