⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controller.c

📁 version control, version control
💻 C
📖 第 1 页 / 共 5 页
字号:
	cprint(LINE_CPU+4, col, "- FSB : ");	col += 9;	dprint(LINE_CPU+4, col, fsb, 3,0);	col += 3;	cprint(LINE_CPU+4, col +1, "MHz");	col += 4;	}static void poll_fsb_i875(void) {	double dramclock, dramratio, fsb;	unsigned long mchcfg, smfs;	int coef = getP4PMmultiplier();	/* Find dramratio */	pci_conf_read(0, 0, 0, 0xC6, 2, &mchcfg);	smfs = (mchcfg >> 10)&3;	dramratio = 1;	if ((mchcfg&3) == 3) { dramratio = 1; }	if ((mchcfg&3) == 2) {		if (smfs == 2) { dramratio = 1; }		if (smfs == 1) { dramratio = 1.25; }		if (smfs == 0) { dramratio = 1.5; }	}	if ((mchcfg&3) == 1) {		if (smfs == 2) { dramratio = 0.6666666666; }		if (smfs == 1) { dramratio = 0.8; }		if (smfs == 0) { dramratio = 1; }	}	if ((mchcfg&3) == 0) { dramratio = 0.75; }	/* Compute RAM Frequency */	dramclock = ((extclock /1000) / coef) / dramratio;	fsb = ((extclock /1000) / coef);	/* Print DRAM Freq */	print_fsb_info(dramclock, "RAM : ");	/* Print FSB (only if ECC is not enabled) */	if ( ctrl.mode == ECC_NONE ) {		cprint(LINE_CPU+4, col +1, "- FSB : ");		col += 9;		dprint(LINE_CPU+4, col, fsb, 3,0);		col += 3;		cprint(LINE_CPU+4, col +1, "MHz");		col += 4;	}}static void poll_fsb_p4(void) {	ulong fsb, idetect;	int coef = getP4PMmultiplier();	fsb = ((extclock /1000) / coef);	/* Print FSB */	cprint(LINE_CPU+4, col +1, "/ FSB : ");	col += 9;	dprint(LINE_CPU+4, col, fsb, 3,0);	col += 3;	cprint(LINE_CPU+4, col +1, "MHz");	col += 4;	/* For synchro only chipsets */	pci_conf_read( 0, 0, 0, 0x02, 2, &idetect);	if (idetect == 0x2540 || idetect == 0x254C) {		print_fsb_info(fsb, "RAM : ");	}}static void poll_fsb_i855(void) {	double dramclock, dramratio, fsb ;	unsigned int msr_lo, msr_hi;	ulong mchcfg, centri, idetect;	int coef;	pci_conf_read( 0, 0, 0, 0x02, 2, &idetect);	/* Find multiplier (by MSR) */	/* Is it a Pentium M ? */	if (cpu_id.type == 6) {		rdmsr(0x2A, msr_lo, msr_hi);		coef = (msr_lo >> 22) & 0x1F;		/* Is it an i855GM or PM ? */		if (idetect == 0x3580) {			cprint(LINE_CPU+4, col-1, "i855GM/GME ");			col += 10;		}	} else {		rdmsr(0x2C, msr_lo, msr_hi);		coef = (msr_lo >> 24) & 0x1F;		cprint(LINE_CPU+4, col-1, "i852PM/GM ");		col += 9;	}	fsb = ((extclock /1000) / coef);	/* Print FSB */	cprint(LINE_CPU+4, col, "/ FSB : ");	col += 8;	dprint(LINE_CPU+4, col, fsb, 3,0);	col += 3;	cprint(LINE_CPU+4, col +1, "MHz");	col += 4;	/* Is it a Centrino platform or only an i855 platform ? */	pci_conf_read( 2, 2, 0, 0x02, 2, &centri);	if (centri == 0x1043) {	cprint(LINE_CPU+4, col +1, "/ Centrino Mobile Platform"); }	else { cprint(LINE_CPU+4, col +1, "/ Mobile Platform"); }	/* Compute DRAM Clock */	dramratio = 1;	if (idetect == 0x3580) {		pci_conf_read( 0, 0, 3, 0xC0, 2, &mchcfg);		mchcfg = mchcfg & 0x7;		if (mchcfg == 1 || mchcfg == 2 || mchcfg == 4 || mchcfg == 5) {	dramratio = 1; }		if (mchcfg == 0 || mchcfg == 3) { dramratio = 1.333333333; }		if (mchcfg == 6) { dramratio = 1.25; }		if (mchcfg == 7) { dramratio = 1.666666667; }	} else {		pci_conf_read( 0, 0, 0, 0xC6, 2, &mchcfg);		if (((mchcfg >> 10)&3) == 0) { dramratio = 1; }		else if (((mchcfg >> 10)&3) == 1) { dramratio = 1.666667; }		else { dramratio = 1.333333333; }	}	dramclock = fsb * dramratio;	/* ...and print */	print_fsb_info(dramclock, "RAM : ");}static void poll_fsb_amd32(void) {	unsigned int mcgsrl;	unsigned int mcgsth;	unsigned long temp;	double dramclock;	double coef2;	/* First, got the FID */	rdmsr(0x0c0010015, mcgsrl, mcgsth);	temp = (mcgsrl >> 24)&0x0F;	if ((mcgsrl >> 19)&1) { coef2 = athloncoef2[temp]; }	else { coef2 = athloncoef[temp]; }	if (coef2 == 0) { coef2 = 1; };	/* Compute the final FSB Clock */	dramclock = (extclock /1000) / coef2;	/* ...and print */	print_fsb_info(dramclock, "FSB : ");}static void poll_fsb_nf2(void) {	unsigned int mcgsrl;	unsigned int mcgsth;	unsigned long temp, mempll;	double dramclock, fsb;	double mem_m, mem_n;	float coef;	coef = 10;	/* First, got the FID */	rdmsr(0x0c0010015, mcgsrl, mcgsth);	temp = (mcgsrl >> 24)&0x0F;	if ((mcgsrl >> 19)&1) { coef = athloncoef2[temp]; }	else { coef = athloncoef[temp]; }	/* Get the coef (COEF = N/M) - Here is for Crush17 */	pci_conf_read(0, 0, 3, 0x70, 4, &mempll);	mem_m = (mempll&0x0F);	mem_n = ((mempll >> 4) & 0x0F);	/* If something goes wrong, the chipset is probably a Crush18 */	if ( mem_m == 0 || mem_n == 0 ) {		pci_conf_read(0, 0, 3, 0x7C, 4, &mempll);		mem_m = (mempll&0x0F);		mem_n = ((mempll >> 4) & 0x0F);	}	/* Compute the final FSB Clock */	dramclock = ((extclock /1000) / coef) * (mem_n/mem_m);	fsb = ((extclock /1000) / coef);	/* ...and print */	cprint(LINE_CPU+4, col, "/ FSB : ");	col += 8;	dprint(LINE_CPU+4, col, fsb, 3,0);	col += 3;	cprint(LINE_CPU+4, col +1, "MHz");	print_fsb_info(dramclock, "RAM : ");}/* ------------------ Here the code for Timings detection ------------------ *//* ------------------------------------------------------------------------- */static void poll_timings_nf4ie(void) {	ulong regd0, reg8c, reg9c, reg80;	int cas, rcd, rp, ras;	cprint(LINE_CPU+4, col +1, "- Type : DDR-II");	//Now, read Registers	pci_conf_read( 0, 1, 1, 0xD0, 4, &regd0);	pci_conf_read( 0, 1, 1, 0x80, 1, &reg80);	pci_conf_read( 0, 1, 0, 0x8C, 4, &reg8c);	pci_conf_read( 0, 1, 0, 0x9C, 4, &reg9c);	// Then, detect timings	cas = (regd0 >> 4) & 0x7;	rcd = (reg8c >> 24) & 0xF;	rp = (reg9c >> 8) & 0xF;	ras = (reg8c >> 16) & 0x3F;		print_timings_info(cas, rcd, rp, ras);		if (reg80 & 0x3) {		cprint(LINE_CPU+5, col2, "/ Dual Channel (128 bits)");	} else {		cprint(LINE_CPU+5, col2, "/ Single Channel (64 bits)");	}}static void poll_timings_i925(void) {	// Thanks for CDH optis	ulong dev0, drt, drc, dcc, idetect, temp;	long *ptr;	//Now, read MMR Base Address	pci_conf_read( 0, 0, 0, 0x44, 4, &dev0);	pci_conf_read( 0, 0, 0, 0x02, 2, &idetect);	dev0 &= 0xFFFFC000;	//Set pointer for DRT	ptr=(long*)(dev0+0x114);	drt = *ptr & 0xFFFFFFFF;	//Set pointer for DRC	ptr=(long*)(dev0+0x120);	drc = *ptr & 0xFFFFFFFF;	//Set pointer for DCC	ptr=(long*)(dev0+0x200);	dcc = *ptr & 0xFFFFFFFF;	//Determine DDR or DDR-II	if ((drc & 3) == 2) {		cprint(LINE_CPU+4, col +1, "- Type : DDR-II");	} else {		cprint(LINE_CPU+4, col +1, "- Type : DDR-I");	}	// Now, detect timings	cprint(LINE_CPU+5, col2 +1, "/ CAS : ");	col2 += 9;	// CAS Latency (tCAS)	temp = ((drt >> 8)& 0x3);	if ((drc & 3) == 2){		// Timings DDR-II		if      (temp == 0x0) { cprint(LINE_CPU+5, col2, "5-"); }		else if (temp == 0x1) { cprint(LINE_CPU+5, col2, "4-"); }		else if (temp == 0x2) { cprint(LINE_CPU+5, col2, "3-"); }		else		      { cprint(LINE_CPU+5, col2, "6-"); }	} else {		// Timings DDR-I		if      (temp == 0x0) { cprint(LINE_CPU+5, col2, "3-"); }		else if (temp == 0x1) { cprint(LINE_CPU+5, col2, "2.5-"); col2 +=2;}		else		      { cprint(LINE_CPU+5, col2, "2-"); }	}	col2 +=2;	// RAS-To-CAS (tRCD)	dprint(LINE_CPU+5, col2, ((drt >> 4)& 0x3)+2, 1 ,0);	cprint(LINE_CPU+5, col2+1, "-");	col2 +=2;	// RAS Precharge (tRP)	dprint(LINE_CPU+5, col2, (drt&0x3)+2, 1 ,0);	cprint(LINE_CPU+5, col2+1, "-");	col2 +=2;	// RAS Active to precharge (tRAS)	// If Lakeport, than change tRAS computation (Thanks to CDH, again)	if (idetect > 0x2700)		temp = ((drt >> 19)& 0x1F);	else		temp = ((drt >> 20)& 0x0F);	dprint(LINE_CPU+5, col2, temp , 1 ,0);	(temp < 10)?(col2 += 1):(col2 += 2);	cprint(LINE_CPU+5, col2+1, "/"); col2 +=2;	temp = (dcc&0x3);	if      (temp == 1) { cprint(LINE_CPU+5, col2, " Dual Channel (Asymmetric)"); }	else if (temp == 2) { cprint(LINE_CPU+5, col2, " Dual Channel (Interleaved)"); }	else		    { cprint(LINE_CPU+5, col2, " Single Channel (64 bits)"); }}static void poll_timings_i875(void) {	ulong dev6, dev62;	ulong temp;	float cas;	int rcd, rp, ras;	long *ptr, *ptr2;	/* Read the MMR Base Address & Define the pointer */	pci_conf_read( 0, 6, 0, 0x10, 4, &dev6);	/* Now, the PAT ritual ! (Kant and Luciano will love this) */	pci_conf_read( 0, 6, 0, 0x40, 4, &dev62);	ptr2=(long*)(dev6+0x68);	if ((dev62&0x3) == 0 && ((*ptr2 >> 14)&1) == 1) {		cprint(LINE_CPU+4, col +1, "- PAT : Enabled");	} else {		cprint(LINE_CPU+4, col +1, "- PAT : Disabled");	}	/* Now, we could check some additionnals timings infos) */	ptr=(long*)(dev6+0x60);	// CAS Latency (tCAS)	temp = ((*ptr >> 5)& 0x3);	if (temp == 0x0) { cas = 2.5; } else if (temp == 0x1) { cas = 2; } else { cas = 3; }	// RAS-To-CAS (tRCD)	temp = ((*ptr >> 2)& 0x3);	if (temp == 0x0) { rcd = 4; } else if (temp == 0x1) { rcd = 3; } else { rcd = 2; }	// RAS Precharge (tRP)	temp = (*ptr&0x3);	if (temp == 0x0) { rp = 4; } else if (temp == 0x1) { rp = 3; } else { rp = 2; }	// RAS Active to precharge (tRAS)	temp = ((*ptr >> 7)& 0x7);	ras = 10 - temp;	// Print timings	print_timings_info(cas, rcd, rp, ras);	// Print 64 or 128 bits mode	if (((*ptr2 >> 21)&3) > 0) { 		cprint(LINE_CPU+5, col2, "/ Dual Channel (128 bits)");	} else {		cprint(LINE_CPU+5, col2, "/ Single Channel (64 bits)");	}}static void poll_timings_E7520(void) {	ulong drt, ddrcsr;	float cas;	int rcd, rp, ras;	pci_conf_read( 0, 0, 0, 0x78, 4, &drt);	pci_conf_read( 0, 0, 0, 0x9A, 2, &ddrcsr);	cas = ((drt >> 2) & 3) + 2;	rcd = ((drt >> 10) & 1) + 3;	rp = ((drt >> 9) & 1) + 3;	ras = ((drt >> 14) & 3) + 11;	print_timings_info(cas, rcd, rp, ras);		if ((ddrcsr & 0xF) >= 0xC) {		cprint(LINE_CPU+5, col2, "/ Dual Channel (128 bits)");	} else {		cprint(LINE_CPU+5, col2, "/ Single Channel (64 bits)");	}}static void poll_timings_i855(void) {	ulong drt, temp;	pci_conf_read( 0, 0, 0, 0x78, 4, &drt);	/* Now, we could print some additionnals timings infos) */	cprint(LINE_CPU+5, col2 +1, "/ CAS : ");	col2 += 9;	// CAS Latency (tCAS)	temp = ((drt >> 4)&0x1);	if (temp == 0x0) { cprint(LINE_CPU+5, col2, "2.5-"); col2 += 4;  }	else { cprint(LINE_CPU+5, col2, "2-"); col2 +=2; }	// RAS-To-CAS (tRCD)	temp = ((drt >> 2)& 0x1);	if (temp == 0x0) { cprint(LINE_CPU+5, col2, "3-"); }	else { cprint(LINE_CPU+5, col2, "2-"); }	col2 +=2;	// RAS Precharge (tRP)	temp = (drt&0x1);	if (temp == 0x0) { cprint(LINE_CPU+5, col2, "3-"); }	else { cprint(LINE_CPU+5, col2, "2-"); }	col2 +=2;	// RAS Active to precharge (tRAS)	temp = 7-((drt >> 9)& 0x3);	if (temp == 0x0) { cprint(LINE_CPU+5, col2, "7"); }	if (temp == 0x1) { cprint(LINE_CPU+5, col2, "6"); }	if (temp == 0x2) { cprint(LINE_CPU+5, col2, "5"); }	col2 +=1;}static void poll_timings_E750x(void) {	ulong drt, drc, temp;	float cas;	int rcd, rp, ras;	pci_conf_read( 0, 0, 0, 0x78, 4, &drt);	pci_conf_read( 0, 0, 0, 0x7C, 4, &drc);	if ((drt >> 4) & 1) { cas = 2; } else { cas = 2.5; };	if ((drt >> 1) & 1) { rcd = 2; } else { rcd = 3; };	if (drt & 1) { rp = 2; } else { rp = 3; };	temp = ((drt >> 9) & 3);	if (temp == 2) { ras = 5; } else if (temp == 1) { ras = 6; } else { ras = 7; }	print_timings_info(cas, rcd, rp, ras);	if (((drc >> 22)&1) == 1) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -