change handling of bars. as per cinap. Reference: /n/atom/patch/applied2013/ac97bars Date: Thu Oct 3 20:34:40 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/k10/audioac97.c Thu Oct 3 20:33:57 2013 +++ /sys/src/nix/k10/audioac97.c Thu Oct 3 20:33:58 2013 @@ -415,15 +415,15 @@ 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 %#P %#P\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 %#.4ux\n", ctlr->port); @@ -439,8 +439,6 @@ irq = p->intl; tbdf = p->tbdf; - if(p->vid == 0x1039 && p->did == 0x7012) - ctlr->sis7012 = 1; print("#A%d: ac97: port %#.4ux mixport %#.4ux irq %d\n", adev->ctlrno, ctlr->port, ctlr->mixport, irq); --- /sys/src/9/pc/audioac97.c Thu Oct 3 20:33:59 2013 +++ /sys/src/9/pc/audioac97.c Thu Oct 3 20:34:00 2013 @@ -415,15 +415,15 @@ 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 %#P %#P\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 %#.4ux\n", ctlr->port); @@ -439,8 +439,6 @@ irq = p->intl; tbdf = p->tbdf; - if(p->vid == 0x1039 && p->did == 0x7012) - ctlr->sis7012 = 1; print("#A%d: ac97: port %#.4ux mixport %#.4ux irq %d\n", adev->ctlrno, ctlr->port, ctlr->mixport, irq); --- /sys/src/9/pcpae/audioac97.c Thu Oct 3 20:34:01 2013 +++ /sys/src/9/pcpae/audioac97.c Thu Oct 3 20:34:02 2013 @@ -415,15 +415,15 @@ 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 %#P %#P\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 %#.4ux\n", ctlr->port); @@ -439,8 +439,6 @@ irq = p->intl; tbdf = p->tbdf; - if(p->vid == 0x1039 && p->did == 0x7012) - ctlr->sis7012 = 1; print("#A%d: ac97: port %#.4ux mixport %#.4ux irq %d\n", adev->ctlrno, ctlr->port, ctlr->mixport, irq);