OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 1:26 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Hd-Audio corb/rirb problem
PostPosted: Tue Aug 24, 2021 10:26 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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-xeneva/blob/master/Aurora/Aurora/drivers/hda/hda.cpp


Top
 Profile  
 
 Post subject: Re: Hd-Audio corb/rirb problem
PostPosted: Tue Aug 24, 2021 11:11 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Code:
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:
_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.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: Hd-Audio corb/rirb problem
PostPosted: Thu Aug 26, 2021 3:16 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
Klakap wrote:
Code:
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:
_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.


Top
 Profile  
 
 Post subject: Re: Hd-Audio corb/rirb problem
PostPosted: Thu Aug 26, 2021 4:58 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
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)

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: Hd-Audio corb/rirb problem
PostPosted: Thu Aug 26, 2021 10:20 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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.


Top
 Profile  
 
 Post subject: Re: Hd-Audio corb/rirb problem
PostPosted: Thu Aug 26, 2021 10:28 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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


Top
 Profile  
 
 Post subject: Re: Hd-Audio corb/rirb problem
PostPosted: Fri Aug 27, 2021 1:14 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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.


Top
 Profile  
 
 Post subject: Re: Hd-Audio corb/rirb problem
PostPosted: Fri Aug 27, 2021 11:37 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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-xeneva/blob/master/Aurora/Aurora/drivers/hda/hda.cpp


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 57 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group