- U32 ret;
-
- ret = MicInitAPI(&micHandle, eTARGET_SCIF_DRIVER, mics, &numMics);
- if (ret != MIC_ACCESS_API_SUCCESS) {
- ERROR("Problem initializing MicAccessAPI: %s",MicGetErrorString(ret));
- }
- INFO("MICs found: %d",numMics);
- if (numMics<0 || numMics>=MAX_MICS)
- return (1);
- else
+ U32 ret;
+ U32 mic_count;
+
+ if (mic_handle)
+ return (0);
+
+ mic_count = (U32) STATIC_ARRAY_SIZE(mics);
+ ret = MicInitAPI(&mic_handle, eTARGET_SCIF_DRIVER, mics, &mic_count);
+ if (ret != MIC_ACCESS_API_SUCCESS) {
+ ERROR("mic plugin: Problem initializing MicAccessAPI: %s",
+ MicGetErrorString(ret));
+ }
+ DEBUG("mic plugin: found: %"PRIu32" MIC(s)",mic_count);
+
+ if (mic_count<0 || mic_count>=MAX_MICS) {
+ ERROR("mic plugin: No Intel MICs in system");
+ return (1);
+ }
+ else {
+ num_mics = mic_count;
+ return (0);
+ }
+}
+
+static int mic_config (const char *key, const char *value) {
+ if (temp_ignore == NULL)
+ temp_ignore = ignorelist_create(1);
+ if (power_ignore == NULL)
+ power_ignore = ignorelist_create(1);
+ if (temp_ignore == NULL || power_ignore == NULL)
+ return (1);
+
+ if (strcasecmp("ShowCPU",key) == 0)
+ {
+ show_cpu = IS_TRUE(value);
+ }
+ else if (strcasecmp("ShowCPUCores",key) == 0)
+ {
+ show_cpu_cores = IS_TRUE(value);
+ }
+ else if (strcasecmp("ShowTemperatures",key) == 0)
+ {
+ show_temps = IS_TRUE(value);
+ }
+ else if (strcasecmp("ShowMemory",key) == 0)
+ {
+ show_memory = IS_TRUE(value);
+ }
+ else if (strcasecmp("ShowPower",key) == 0)
+ {
+ show_power = IS_TRUE(value);
+ }
+ else if (strcasecmp("Temperature",key) == 0)
+ {
+ ignorelist_add(temp_ignore,value);
+ }
+ else if (strcasecmp("IgnoreSelectedTemperature",key) == 0)
+ {
+ int invert = 1;
+ if (IS_TRUE(value))
+ invert = 0;
+ ignorelist_set_invert(temp_ignore,invert);
+ }
+ else if (strcasecmp("Power",key) == 0)
+ {
+ ignorelist_add(power_ignore,value);
+ }
+ else if (strcasecmp("IgnoreSelectedPower",key) == 0)
+ {
+ int invert = 1;
+ if (IS_TRUE(value))
+ invert = 0;
+ ignorelist_set_invert(power_ignore,invert);
+ }
+ else
+ {
+ return (-1);
+ }