tmp = INREG(DEVICE_ID); 
tmp = INREG16(DEVICE_ID); 
static int __devinit radeon_probe_pll_params(struct radeonfb_info *rinfo){	unsigned char ppll_div_sel;	unsigned Ns, Nm, M;	unsigned sclk, mclk, tmp, ref_div;	int hTotal, vTotal, num, denom, m, n;	unsigned long long hz, vclk;	long xtal;	struct timeval start_tv, stop_tv;	long total_secs, total_usecs;	int i;	/* Ugh, we cut interrupts, bad bad bad, but we want some precision	 * here, so... --BenH	 */	/* Flush PCI buffers ? */	tmp = INREG(DEVICE_ID);	local_irq_disable();	for(i=0; i<1000000; i++)		if (((INREG(CRTC_VLINE_CRNT_VLINE) >> 16) & 0x3ff) == 0)			break;	do_gettimeofday(&start_tv);	for(i=0; i<1000000; i++)		if (((INREG(CRTC_VLINE_CRNT_VLINE) >> 16) & 0x3ff) != 0)			break;	for(i=0; i<1000000; i++)		if (((INREG(CRTC_VLINE_CRNT_VLINE) >> 16) & 0x3ff) == 0)			break;		do_gettimeofday(&stop_tv);		local_irq_enable();	total_secs = stop_tv.tv_sec - start_tv.tv_sec;	if (total_secs > 10)		return -1;	total_usecs = stop_tv.tv_usec - start_tv.tv_usec;	total_usecs += total_secs * 1000000;	if (total_usecs < 0)		total_usecs = -total_usecs;	hz = 1000000/total_usecs; 	hTotal = ((INREG(CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8;	vTotal = ((INREG(CRTC_V_TOTAL_DISP) & 0x3ff) + 1);	vclk = (long long)hTotal * (long long)vTotal * hz;	switch((INPLL(PPLL_REF_DIV) & 0x30000) >> 16) {	case 0:	default:		num = 1;		denom = 1;		break;	case 1:		n = ((INPLL(M_SPLL_REF_FB_DIV) >> 16) & 0xff);		m = (INPLL(M_SPLL_REF_FB_DIV) & 0xff);		num = 2*n;		denom = 2*m;		break;	case 2:		n = ((INPLL(M_SPLL_REF_FB_DIV) >> 8) & 0xff);		m = (INPLL(M_SPLL_REF_FB_DIV) & 0xff);		num = 2*n;		denom = 2*m;        break;	}	ppll_div_sel = INREG8(CLOCK_CNTL_INDEX + 1) & 0x3;	radeon_pll_errata_after_index(rinfo);	n = (INPLL(PPLL_DIV_0 + ppll_div_sel) & 0x7ff);	m = (INPLL(PPLL_REF_DIV) & 0x3ff);	num *= n;	denom *= m;	switch ((INPLL(PPLL_DIV_0 + ppll_div_sel) >> 16) & 0x7) {	case 1:		denom *= 2;		break;	case 2:		denom *= 4;		break;	case 3:		denom *= 8;		break;	case 4:		denom *= 3;		break;	case 6:		denom *= 6;   		break;	case 7:		denom *= 12;		break;	}	vclk *= denom;	do_div(vclk, 1000 * num);	xtal = vclk;	if ((xtal > 26900) && (xtal < 27100))		xtal = 2700;	else if ((xtal > 14200) && (xtal < 14400))		xtal = 1432;	else if ((xtal > 29400) && (xtal < 29600))		xtal = 2950;	else {		printk(KERN_WARNING "xtal calculation failed: %ld\n", xtal);		return -1;	}	tmp = INPLL(M_SPLL_REF_FB_DIV);	ref_div = INPLL(PPLL_REF_DIV) & 0x3ff;	Ns = (tmp & 0xff0000) >> 16;	Nm = (tmp & 0xff00) >> 8;	M = (tmp & 0xff);	sclk = round_div((2 * Ns * xtal), (2 * M));	mclk = round_div((2 * Nm * xtal), (2 * M));	/* we're done, hopefully these are sane values */	rinfo->pll.ref_clk = xtal;	rinfo->pll.ref_div = ref_div;	rinfo->pll.sclk = sclk;	rinfo->pll.mclk = mclk;	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/017fb98e70351e9fb5635c299c4d1c50e2f8b823/radeon_base.c/clean/drivers/video/aty/radeon_base.c