rem: uint16 sr = ich_reg_read_16(chan_pi->regbase + (config->swap_reg ? ICH_REG_X_PICB : ICH_REG_X_SR));
add: uint16 sr = ich_reg_read_16(chan_pi->regbase + GET_REG_X_SR(config));
context: int32 ich_int(void *unused){	uint32 sta;	sta = ich_reg_read_32(ICH_REG_GLOB_STA);		if ((sta & STA_INTMASK) == 0)		return B_UNHANDLED_INTERRUPT;		if (sta & (STA_S0RI | STA_S1RI | STA_S2RI)) {		/* ignore and clear resume interrupt(s) */		ich_reg_write_32(ICH_REG_GLOB_STA, sta & (STA_S0RI | STA_S1RI | STA_S2RI));	}		if (sta & STA_POINT) { // pcm-out		uint16 sr = ich_reg_read_16(chan_po->regbase + (config->swap_reg ? ICH_REG_X_PICB : ICH_REG_X_SR));		sr &= SR_FIFOE | SR_BCIS | SR_LVBCI;		if (sr & SR_BCIS) { // a buffer completed			int32 count;			int32 civ;			/* shedule playback of the next buffers */					civ = ich_reg_read_8(chan_po->regbase + ICH_REG_X_CIV);			ich_reg_write_8(chan_po->regbase + ICH_REG_X_LVI, (civ + 28) % ICH_BD_COUNT);			/* calculate played buffer count since last interrupt */			if (civ <= chan_po->lastindex)				count = civ + ICH_BD_COUNT - chan_po->lastindex;			else				count = civ - chan_po->lastindex;						if (count != 1)				dprintf(DRIVER_NAME ": lost %ld po interrupts\n",count - 1);						acquire_spinlock(&slock);			chan_po->played_real_time = system_time();			chan_po->played_frames_count += count * BUFFER_FRAMES_COUNT;			chan_po->lastindex = civ;			chan_po->backbuffer = chan_po->buffer[(civ + 1) % ICH_BD_COUNT];			release_spinlock(&slock);			get_sem_count(chan_po->buffer_ready_sem, &count);			if (count <= 0)				release_sem_etc(chan_po->buffer_ready_sem,1,B_DO_NOT_RESCHEDULE);		}		ich_reg_write_16(chan_po->regbase + (config->swap_reg ? ICH_REG_X_PICB : ICH_REG_X_SR),sr);	}	if (sta & STA_PIINT) { // pcm-in		uint16 sr = ich_reg_read_16(chan_pi->regbase + (config->swap_reg ? ICH_REG_X_PICB : ICH_REG_X_SR));		sr &= SR_FIFOE | SR_BCIS | SR_LVBCI;		if (sr & SR_BCIS) { // a buffer completed			int32 count;			int32 civ;			/* shedule record of the next buffers */					civ = ich_reg_read_8(chan_pi->regbase + ICH_REG_X_CIV);			ich_reg_write_8(chan_pi->regbase + ICH_REG_X_LVI, (civ + 28) % ICH_BD_COUNT);			/* calculate recorded buffer count since last interrupt */			if (civ <= chan_pi->lastindex)				count = civ + ICH_BD_COUNT - chan_pi->lastindex;			else				count = civ - chan_pi->lastindex;						if (count != 1)				dprintf(DRIVER_NAME ": lost %ld pi interrupts\n",count - 1);						acquire_spinlock(&slock);			chan_pi->played_real_time = system_time();			chan_pi->played_frames_count += count * BUFFER_FRAMES_COUNT;			chan_pi->lastindex = civ;			chan_pi->backbuffer = chan_pi->buffer[(ICH_BD_COUNT - (civ - 1)) % ICH_BD_COUNT];			release_spinlock(&slock);			get_sem_count(chan_pi->buffer_ready_sem, &count);			if (count <= 0)				release_sem_etc(chan_pi->buffer_ready_sem,1,B_DO_NOT_RESCHEDULE);		}		ich_reg_write_16(chan_pi->regbase + (config->swap_reg ? ICH_REG_X_PICB : ICH_REG_X_SR),sr);	}	if (sta & STA_MINT) { // mic-in		uint16 sr = ich_reg_read_16(chan_mc->regbase + (config->swap_reg ? ICH_REG_X_PICB : ICH_REG_X_SR));		sr &= SR_FIFOE | SR_BCIS | SR_LVBCI;		if (sr & SR_BCIS) { // a buffer completed			release_sem_etc(chan_mc->buffer_ready_sem,1,B_DO_NOT_RESCHEDULE);		}		ich_reg_write_16(chan_mc->regbase + (config->swap_reg ? ICH_REG_X_PICB : ICH_REG_X_SR),sr);	}	return B_HANDLED_INTERRUPT;}