static void smi_init(void)
{
	int i;
	SMI_Init();
	SMI_PowerOn();

	if (do_smi() == 1) {
		for (i=0; i< SMI_LARB_NUMBER; i++) {
			// TODO: need to re-check here
			if ((i==3) || (i==4))
				continue;
			SMI_Disable(i);
			SMI_SetSMIBMCfg(i, smi_larb[i].port, smi_larb[i].desttype, smi_larb[i].rwtype);
			if (smi_larb[i].mode == 1) {
				enable_master_cnt += 1;
			}
		}
		//SMI_SetMonitorControl(0);  //SMIBMCfgEx default
		SMI_SetMonitorControl(&monitorctrl);

		for (i=0; i< SMI_COMM_NUMBER; i++) {
			SMI_Comm_Disable(i);
			SMI_SetCommBMCfg(i, smi_comm[i].port, smi_comm[i].desttype, smi_comm[i].rwtype);
			if (smi_comm[i].mode == 1) {
				enable_master_cnt += 1;
			}
		}
	} else if (do_smi() == 2) {
		toggle_idx = 0;
		toggle_port(toggle_idx);
	} else if (do_smi() == 3) {
		toggle_master_max = toggle_master_min = -1;
		for (i=0; i<SMI_ALLPORT_COUNT*4; i++) {
			if (allport[i].master == toggle_master) {
				if (toggle_master_min == -1) {
					toggle_master_max = i;
					toggle_master_min = i;
				}
				if (i > toggle_master_max) {
					toggle_master_max = i;
				}
				if (i < toggle_master_min) {
					toggle_master_min = i;
				}
			}
		}
		printk("smi toggle min=%d, max=%d\n",toggle_master_min,toggle_master_max);
		if (toggle_master_min >=0 ) {
			toggle_idx = toggle_master_min;
			toggle_port(toggle_idx);
		}
	} else if (do_smi() == 4) {

	}
}
static void met_smi_stop(void)
{
	if (do_smi()) {
		smi_stop();
		smi_uninit();
	}
}
Exemple #3
0
static void met_smi_stop(void)
{
	/* HW setting */
	if (do_smi()) {
		smi_stop();
		smi_uninit();
	}
}
static void met_smi_start(void)
{
	if (do_smi()) {
        //printk("do smi\n");
		smi_init();
		smi_stop();
		smi_start();
	}
}
static void met_smi_start(void)
{
#ifdef DEBUG_MET_SMI_TEST_PATTERN
	int i;

	for (i=0; i<SMI_LARB_NUMBER; i++) {
		printk("master = %d, "
			"port = %d, "
			"rwtype = %d, "
			"desttype = %d, "
			"bustype = %d, "
			"mode = %d\n",
			smi_larb[i].master,
			smi_larb[i].port,
			smi_larb[i].rwtype,
			smi_larb[i].desttype,
			smi_larb[i].bustype,
			smi_larb[i].mode);
	}
	for (i=0; i<SMI_COMM_NUMBER; i++) {
		printk("master = %d, "
			"port = %d, "
			"rwtype = %d, "
			"desttype = %d, "
			"bustype = %d, "
			"mode = %d\n",
			smi_comm[i].master,
			smi_comm[i].port,
			smi_comm[i].rwtype,
			smi_comm[i].desttype,
			smi_comm[i].bustype,
			smi_comm[i].mode);
	}
	printk("requesttype = %d, "
		"toggle_cnt = %d, "
		"count = %d, "
		"portnum = %d\n",
		monitorctrl.bRequestSelection,
		toggle_cnt,
		count,
		portnum);
#else
	//printk("do smi mode=%d, toggle_idx=%d, idx220_port=%lu\n", do_smi(), toggle_idx, allport[220].port);
	if (do_smi()) {
        //printk("do smi\n");
		smi_init();
		smi_stop();
		smi_start();
	}
#endif
}
static void met_smi_polling(unsigned long long stamp, int cpu)
{
	unsigned char count=0;
	unsigned int smi_value[100];  //TODO: need re-check
	static int times=0;
	static int toggle_stop=0;

	if (do_smi() == 1) { //single port polling
		count = smi_polling(smi_value);
		//printk("smi_polling result count=%d\n",count);
		if (count) {
			ms_smi(stamp, count, smi_value);
		}
	} else if (toggle_stop == 0) {
		if (do_smi() == 2) { //all-toggling
			//count = smi_toggle_polling(smi_value);
			count = smi_dump_polling(smi_value);
			if (count) {
				//printk("smi_polling result count=%d\n",count);
				ms_smit(stamp, count, smi_value);
			}
			if (times == toggle_cnt) {//switch port
				toggle_idx = (toggle_idx + 1) % (SMI_ALLPORT_COUNT*4);
				//toggle_idx = toggle_idx + 1;
				//if (toggle_idx < SMI_ALLPORT_COUNT*4) {
					toggle_port(toggle_idx);
				//}
				/* else {
					toggle_stop = 1;	//stop smi polling
					return;
				} */
				times = 0;
			} else {
				times++;
			}
		} else if (do_smi() == 3) { //per-master toggling
			//count = smi_toggle_polling(smi_value);
			count = smi_dump_polling(smi_value);
			if (count) {
				//printk("smi_polling result count=%d\n",count);
				ms_smit(stamp, count, smi_value);
			}
			if (times == toggle_cnt) {//switch port
				toggle_idx = toggle_idx + 1;
				if (toggle_idx > toggle_master_max) {
					toggle_idx = toggle_master_min;
				}
				toggle_port(toggle_idx);
				times = 0;
			} else {
				times++;
			}
		} else if (do_smi() == 4) { //toggle all and stop
			count = smi_dump_polling(smi_value);
			if (count) {
				ms_smit(stamp, count, smi_value);
			}
			if (times == toggle_cnt) {//switch port
				//toggle_idx = (toggle_idx + 1) % (SMI_ALLPORT_COUNT*4);
				toggle_idx = toggle_idx + 1;
				if (toggle_idx < SMI_ALLPORT_COUNT*4) {
					toggle_port(toggle_idx);
				} else {
					toggle_stop = 1;	//stop smi polling
					return;
				}
				times = 0;
			} else {
				times++;
			}
		}
	}
}
Exemple #7
0
static void smi_init(void)
{
	int i, j;

	// TODO: need to re-check here
	MET_SMI_PowerOn();

	if (do_smi() == 1) {
		for (i=0; i< SMI_LARB_NUMBER; i++) {
			MET_SMI_Disable(i);
			if (parallel_mode == 0) {
				MET_SMI_LARB_SetCfg(i,
						0,
						larb_req_type,
						smi_larb[i].rwtype,
						smi_larb[i].desttype);
				MET_SMI_LARB_SetPortNo(
					i,
					0,
					smi_larb[i].port);
			} else {
				/* Don't care: req type, rw type, dst type */
				MET_SMI_LARB_SetCfg(i,
						1,
						larb_req_type,
						smi_larb[i].rwtype,
						smi_larb[i].desttype);
				for (j=0; j<NPORT_IN_PM; j++) {
					if (larb_pm_port[i][j] != -1)
						MET_SMI_LARB_SetPortNo(
							i,
							j,
							larb_pm_port[i][j]);
				}
			}
		}
		for (i=0; i< SMI_COMM_NUMBER; i++) {
			MET_SMI_Comm_Disable(i);
			if (parallel_mode == 0) {
				MET_SMI_COMM_SetCfg(
						i,
						0,
						comm_req_type);
				MET_SMI_COMM_SetPortNo(
						i,
						0,
						smi_comm[i].port);
				MET_SMI_COMM_SetRWType(
						i,
						0,
						smi_comm[i].rwtype);
			} else {
				MET_SMI_COMM_SetCfg(
						i,
						1,
						comm_req_type);
				for (j=0; j<NPORT_IN_PM; j++) {
					if (comm_pm_port[i][j] != -1)
						MET_SMI_COMM_SetPortNo(
							i,
							j,
							comm_pm_port[i][j]);
						MET_SMI_COMM_SetRWType(
							i,
							j,
							comm_pm_rw_type[i][j]);
				}
			}
		}
	} else if (do_smi() == 2) {
		toggle_idx = 0;
		toggle_port(toggle_idx);
	} else if (do_smi() == 3) {
		toggle_master_max = toggle_master_min = -1;
		for (i=0; i<SMI_ALLPORT_COUNT*4; i++) {
			if (allport[i].master == toggle_master) {
				if (toggle_master_min == -1) {
					toggle_master_max = i;
					toggle_master_min = i;
				}
				if (i > toggle_master_max) {
					toggle_master_max = i;
				}
				if (i < toggle_master_min) {
					toggle_master_min = i;
				}
			}
		}
		if (toggle_master_min >=0 ) {
			toggle_idx = toggle_master_min;
			toggle_port(toggle_idx);
		}
	} else if (do_smi() == 4) {
	}
}