audioac97: remove i/o bar magic, fix ac97mixreset busywait-forever timeout
the standard is i/o bar 0 is the mixer and bar 1 is status/control. the magic with the bar sizes made it fail in qemu. so removing it for now as all devices seen so far comply to the standard. if we ever see a sis7012 where this might be swaped uncomment the i=0; the busywait timeout is too long in ac97mixreset() because rd/wr have a timeout on ther own. just remove the busy looping and do a one second delay after mixer reset. (tested with t23)
This commit is contained in:
parent
7265a09524
commit
81f726b2b4
2 changed files with 11 additions and 20 deletions
|
@ -471,15 +471,16 @@ Found:
|
|||
adev->ctlr = ctlr;
|
||||
ctlr->adev = adev;
|
||||
|
||||
if((p->mem[0].bar & 1) == 0 || (p->mem[1].bar & 1) == 0){
|
||||
print("ac97: not i/o regions 0x%04lux 0x%04lux\n", p->mem[0].bar, p->mem[1].bar);
|
||||
return -1;
|
||||
}
|
||||
|
||||
i = 1;
|
||||
if(p->mem[0].size == 64)
|
||||
i = 0;
|
||||
else if(p->mem[1].size == 64)
|
||||
i = 1;
|
||||
else if(p->mem[0].size == 256) /* sis7012 */
|
||||
i = 1;
|
||||
else if(p->mem[1].size == 256)
|
||||
i = 0;
|
||||
if(p->vid == 0x1039 && p->did == 0x7012){
|
||||
ctlr->sis7012 = 1;
|
||||
//i = 0; i/o bars swaped?
|
||||
}
|
||||
ctlr->port = p->mem[i].bar & ~3;
|
||||
if(ioalloc(ctlr->port, p->mem[i].size, 0, "ac97") < 0){
|
||||
print("ac97: ioalloc failed for port 0x%04lux\n", ctlr->port);
|
||||
|
@ -495,8 +496,6 @@ Found:
|
|||
|
||||
irq = p->intl;
|
||||
tbdf = p->tbdf;
|
||||
if(p->vid == 0x1039 && p->did == 0x7012)
|
||||
ctlr->sis7012 = 1;
|
||||
|
||||
print("#A%d: ac97 port 0x%04lux mixport 0x%04lux irq %d\n",
|
||||
adev->ctlrno, ctlr->port, ctlr->mixport, irq);
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "../port/error.h"
|
||||
#include "../port/audioif.h"
|
||||
|
||||
enum { Maxbusywait = 500000 };
|
||||
|
||||
enum {
|
||||
Reset = 0x0,
|
||||
Capmic = 0x1,
|
||||
|
@ -236,7 +234,6 @@ ac97mixreset(Audio *adev, void (*wr)(Audio*,int,ushort), ushort (*rr)(Audio*,int
|
|||
{
|
||||
Mixer *m;
|
||||
ushort t;
|
||||
int i;
|
||||
|
||||
m = malloc(sizeof(Mixer));
|
||||
if(m == nil){
|
||||
|
@ -247,14 +244,9 @@ ac97mixreset(Audio *adev, void (*wr)(Audio*,int,ushort), ushort (*rr)(Audio*,int
|
|||
m->rr = rr;
|
||||
m->wr(adev, Reset, 0);
|
||||
m->wr(adev, Powerdowncsr, 0);
|
||||
|
||||
delay(1000);
|
||||
t = (Adcpower | Dacpower | Anlpower | Refpower);
|
||||
for(i = 0; i < Maxbusywait; i++){
|
||||
if((m->rr(adev, Powerdowncsr) & t) == t)
|
||||
break;
|
||||
microdelay(1);
|
||||
}
|
||||
if(i == Maxbusywait)
|
||||
if((m->rr(adev, Powerdowncsr) & t) != t)
|
||||
print("#A%d: ac97 exhausted waiting powerup\n", adev->ctlrno);
|
||||
|
||||
t = m->rr(adev, Extid);
|
||||
|
|
Loading…
Reference in a new issue