strcpy(dmi->processor.asset_tag,dmi_string(h, data[0x21]));
strcpy(dmi->processor.part_number,dmi_string(h, data[0x22]));
break;
- case 17: /* 3.3.18 Memory Device */
+ case 6: /* 3.3.7 Memory Module Information */
+ if(h->length<0x0C) break;
+ dmi->memory_module_count++;
+ s_memory_module *module = &dmi->memory_module[dmi->memory_module_count-1];
+ dmi->memory_module[dmi->memory_module_count-1].filled=true;
+ strncpy(module->socket_designation, dmi_string(h, data[0x04]),
+ sizeof(module->socket_designation));
+ dmi_memory_module_connections(data[0x05], module->bank_connections);
+ dmi_memory_module_speed(data[0x06], module->speed);
+ dmi_memory_module_types(WORD(data+0x07), " ", module->type);
+ dmi_memory_module_size(data[0x09], module->installed_size);
+ dmi_memory_module_size(data[0x0A], module->enabled_size);
+ dmi_memory_module_error(data[0x0B], "\t\t", module->error_status);
+ break;
+ case 7: /* 3.3.8 Cache Information */
+ if(h->length<0x0F) break;
+ dmi->cache_count++;
+ if (dmi->cache_count > MAX_DMI_CACHE_ITEMS) break;
+ strcpy(dmi->cache[dmi->cache_count-1].socket_designation,
+ dmi_string(h, data[0x04]));
+ sprintf(dmi->cache[dmi->cache_count-1].configuration,
+ "%s, %s, %u",
+ WORD(data+0x05)&0x0080?"Enabled":"Disabled",
+ WORD(data+0x05)&0x0008?"Socketed":"Not Socketed",
+ (WORD(data+0x05)&0x0007)+1);
+ strcpy(dmi->cache[dmi->cache_count-1].mode,
+ dmi_cache_mode((WORD(data+0x05)>>8)&0x0003));
+ strcpy(dmi->cache[dmi->cache_count-1].location,
+ dmi_cache_location((WORD(data+0x05)>>5)&0x0003));
+ dmi->cache[dmi->cache_count-1].installed_size =
+ dmi_cache_size(WORD(data+0x09));
+ dmi->cache[dmi->cache_count-1].max_size =
+ dmi_cache_size(WORD(data+0x07));
+ dmi_cache_types(WORD(data+0x0B), " ",
+ dmi->cache[dmi->cache_count-1].supported_sram_types);
+ dmi_cache_types(WORD(data+0x0D), " ",
+ dmi->cache[dmi->cache_count-1].installed_sram_types);
+ if(h->length<0x13) break;
+ dmi->cache[dmi->cache_count-1].speed = data[0x0F]; /* ns */
+ strcpy(dmi->cache[dmi->cache_count-1].error_correction_type,
+ dmi_cache_ec_type(data[0x10]));
+ strcpy(dmi->cache[dmi->cache_count-1].system_type,
+ dmi_cache_type(data[0x11]));
+ strcpy(dmi->cache[dmi->cache_count-1].associativity,
+ dmi_cache_associativity(data[0x12]));
+ break;
+ case 17: /* 3.3.18 Memory Device */
if (h->length < 0x15) break;
dmi->memory_count++;
+ if (dmi->memory_count > MAX_DMI_MEMORY_ITEMS) break;
s_memory *mem = &dmi->memory[dmi->memory_count-1];
dmi->memory[dmi->memory_count-1].filled=true;
dmi_memory_array_error_handle(WORD(data + 0x06),mem->error);
hardware->dmi.memory[bank].part_number);
}
+static void show_dmi_cache(int argc, char** argv,
+ struct s_hardware *hardware)
+{
+ if (!hardware->dmi.cache_count) {
+ printf("cache information not found on your system, see "
+ "`show list' to see which module is available.\n");
+ return;
+ }
+
+ int cache = strtol(argv[0], NULL, 10);
+
+ if (argc != 1 || cache > hardware->dmi.cache_count) {
+ printf("show cache [0-%d]\n", hardware->dmi.cache_count-1);
+ return;
+ }
+
+ reset_more_printf();
+
+ more_printf("Cache Information #%d\n", cache);
+ more_printf(" Socket Designation : %s\n",
+ hardware->dmi.cache[cache].socket_designation);
+ more_printf(" Configuration : %s\n",
+ hardware->dmi.cache[cache].configuration);
+ more_printf(" Operational Mode : %s\n",
+ hardware->dmi.cache[cache].mode);
+ more_printf(" Location : %s\n",
+ hardware->dmi.cache[cache].location);
+ more_printf(" Installed Size : %u KB",
+ hardware->dmi.cache[cache].installed_size);
+ more_printf("\n");
+ more_printf(" Maximum Size : %u KB",
+ hardware->dmi.cache[cache].max_size);
+ more_printf("\n");
+ more_printf(" Supported SRAM Types : %s",
+ hardware->dmi.cache[cache].supported_sram_types);
+ more_printf("\n");
+ more_printf(" Installed SRAM Type : %s",
+ hardware->dmi.cache[cache].installed_sram_types);
+ more_printf("\n");
+ more_printf(" Speed : %u ns",
+ hardware->dmi.cache[cache].speed);
+ more_printf("\n");
+ more_printf(" Error Correction Type : %s\n",
+ hardware->dmi.cache[cache].error_correction_type);
+ more_printf(" System Type : %s\n",
+ hardware->dmi.cache[cache].system_type);
+ more_printf(" Associativity : %s\n",
+ hardware->dmi.cache[cache].associativity);
+}
+
+ void show_dmi_memory_module(int argc, char** argv,
+ struct s_hardware *hardware)
+ {
+ int module = -1;
+
+ /* Sanitize arguments */
+ if (argc > 0)
+ module = strtol(argv[0], (char **)NULL, 10);
+
+ if (errno == ERANGE || module < 0) {
+ printf("This module number is incorrect\n");
+ return;
+ }
+
+ if ((module >= hardware->dmi.memory_module_count) || (module < 0)) {
+ printf("Module number %d doesn't exist\n", module);
+ return;
+ }
+
+ if (hardware->dmi.memory_module[module].filled == false) {
+ printf("Module %d doesn't contain any information\n", module);
+ return;
+ }
+
+ printf("Memory Module %d\n", module);
+ printf(" Socket Designation : %s\n",
+ hardware->dmi.memory_module[module].socket_designation);
+ printf(" Bank Connections : %s\n",
+ hardware->dmi.memory_module[module].bank_connections);
+ printf(" Current Speed : %s\n",
+ hardware->dmi.memory_module[module].speed);
+ printf(" Type : %s\n",
+ hardware->dmi.memory_module[module].type);
+ printf(" Installed Size : %s\n",
+ hardware->dmi.memory_module[module].installed_size);
+ printf(" Enabled Size : %s\n",
+ hardware->dmi.memory_module[module].enabled_size);
+ printf(" Error Status : %s\n",
+ hardware->dmi.memory_module[module].error_status);
+ }
+
void main_show_dmi(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{