diff options
author | Peter Schiffer <pschiffe@redhat.com> | 2014-01-22 18:37:13 +0100 |
---|---|---|
committer | Peter Schiffer <pschiffe@redhat.com> | 2014-01-22 18:37:13 +0100 |
commit | 691b44e7cba10446b7f8dc3df83e312ab63f97d9 (patch) | |
tree | 8f74815a8332ac71d76d54007b4e4989b394a354 /src/hardware | |
parent | 8fadcf4e0b4e1015ded16dc06b0944718cdc9144 (diff) | |
download | openlmi-providers-691b44e7cba10446b7f8dc3df83e312ab63f97d9.tar.gz openlmi-providers-691b44e7cba10446b7f8dc3df83e312ab63f97d9.tar.xz openlmi-providers-691b44e7cba10446b7f8dc3df83e312ab63f97d9.zip |
Hardware: updated LMI_PhysicalMemoryProvider
* be more picky when choosing bank locator
* take into account Configured Clock Speed field from dmidecode
* display speed only if the data is available
Diffstat (limited to 'src/hardware')
-rw-r--r-- | src/hardware/LMI_PhysicalMemoryProvider.c | 7 | ||||
-rw-r--r-- | src/hardware/dmidecode.c | 36 |
2 files changed, 22 insertions, 21 deletions
diff --git a/src/hardware/LMI_PhysicalMemoryProvider.c b/src/hardware/LMI_PhysicalMemoryProvider.c index c65cd20..9413967 100644 --- a/src/hardware/LMI_PhysicalMemoryProvider.c +++ b/src/hardware/LMI_PhysicalMemoryProvider.c @@ -87,8 +87,6 @@ static CMPIStatus LMI_PhysicalMemoryEnumInstances( get_form_factor(dmi_memory.modules[i].form_factor)); LMI_PhysicalMemory_Set_MemoryType(&lmi_phys_mem, get_memory_type(dmi_memory.modules[i].type)); - LMI_PhysicalMemory_Set_Speed(&lmi_phys_mem, - dmi_memory.modules[i].speed_time); LMI_PhysicalMemory_Set_BankLabel(&lmi_phys_mem, dmi_memory.modules[i].bank_label); LMI_PhysicalMemory_Set_ElementName(&lmi_phys_mem, @@ -111,6 +109,11 @@ static CMPIStatus LMI_PhysicalMemoryEnumInstances( LMI_PhysicalMemory_Set_DataWidth(&lmi_phys_mem, dmi_memory.modules[i].data_width); + if (dmi_memory.modules[i].speed_time) { + LMI_PhysicalMemory_Set_Speed(&lmi_phys_mem, + dmi_memory.modules[i].speed_time); + } + KReturnInstance(cr, lmi_phys_mem); } diff --git a/src/hardware/dmidecode.c b/src/hardware/dmidecode.c index 7f5c6d4..a457db0 100644 --- a/src/hardware/dmidecode.c +++ b/src/hardware/dmidecode.c @@ -918,25 +918,19 @@ short dmi_get_memory(DmiMemory *memory) } continue; } - if (strstr(buffer[i], "Locator:")) { - if (strstr(buffer[i], "Bank Locator:")) { - /* Memory Module Bank Label */ - buf = copy_string_part_after_delim(buffer[i], "Bank Locator: "); - if (buf) { - memory->modules[curr_mem].bank_label = buf; - buf = NULL; - continue; - } - } else { - /* Slot */ - buf = copy_string_part_after_delim(buffer[i], "Locator: "); - if (buf) { - sscanf(buf, "%*s %d", &memory->modules[curr_mem].slot); - free(buf); - buf = NULL; - continue; - } + /* Memory Module Bank Label and Slot ID */ + buf = copy_string_part_after_delim(buffer[i], "Locator: "); + if (buf) { + if (memory->modules[curr_mem].slot != -1) { + continue; + } + if (strncasecmp(buf, "bank ", 5) != 0) { + continue; } + sscanf(buf, "%*s %d", &memory->modules[curr_mem].slot); + memory->modules[curr_mem].bank_label = buf; + buf = NULL; + continue; } /* Form Factor */ buf = copy_string_part_after_delim(buffer[i], "Form Factor: "); @@ -969,7 +963,11 @@ short dmi_get_memory(DmiMemory *memory) /* Speed in MHz */ buf = copy_string_part_after_delim(buffer[i], "Speed: "); if (buf) { - sscanf(buf, "%u", &memory->modules[curr_mem].speed_clock); + if (strstr(buffer[i], "Configured Clock Speed: ")) { + sscanf(buf, "%u", &memory->modules[curr_mem].speed_clock); + } else if (memory->modules[curr_mem].speed_clock == 0) { + sscanf(buf, "%u", &memory->modules[curr_mem].speed_clock); + } free(buf); buf = NULL; continue; |