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 int SMI_Open(struct inode * a_pstInode, struct file * a_pstFile) { if(g_Occupied) { return -1; } g_Occupied = 1; //printk("SMI Monitor opened!!\n"); SMI_PowerOn(); return 0; }
int SMIProc_smi_pow_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { char cmd_buf[64] = {'\0'}; unsigned long buf_size = (count < (sizeof(cmd_buf) - 1)) ? (count) : (sizeof(cmd_buf) - 1); // if (copy_from_user(cmd_buf, buffer, buf_size)) return -EFAULT; sscanf(cmd_buf, "%lu ", &smi_power); if(smi_power > 0) { SMI_PowerOn(); } else { SMI_PowerOff(); } return count; }