Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit d3a0171

Browse files
dkosawaJuston Li
authored and
Juston Li
committed
Updated show dimm cmd to show Non-functional when dimms are disabled
Signed-off-by: Daniel K Osawa <[email protected]>
1 parent fdaa9b1 commit d3a0171

File tree

5 files changed

+45
-20
lines changed

5 files changed

+45
-20
lines changed

src/cli/features/core/ShowDeviceCommand.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ std::string ShowDeviceCommand::convertHealthState(NVM_UINT16 healthState)
217217
map[DEVICE_HEALTH_CRITICAL] = TR("Critical Failure");
218218
map[DEVICE_HEALTH_FATAL] = TR("Non-recoverable error");
219219
map[DEVICE_HEALTH_UNMANAGEABLE] = TR("Unmanageable");
220+
map[DEVICE_HEALTH_NONFUNCTIONAL] = TR("Non-functional");
220221
return map[healthState];
221222
}
222223

@@ -225,6 +226,7 @@ std::string ShowDeviceCommand::convertManageabilityState(manageability_state sta
225226
std::map<NVM_UINT64, std::string> map;
226227
map[MANAGEMENT_VALIDCONFIG] = TR("Manageable");
227228
map[MANAGEMENT_INVALIDCONFIG] = TR("Unmanageable");
229+
map[MANAGEMENT_NON_FUNCTIONAL] = TR("Non-functional");
228230
map[MANAGEMENT_UNKNOWN] = TR("Unknown");
229231
return map[state];
230232
}

src/core/device/Device.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,20 @@ NVM_UINT32 Device::getSku()
452452
NVM_UINT16 Device::getHealthState()
453453
{
454454
LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);
455-
NVM_UINT16 healthState = isManageable() ? getDeviceStatusHealth()
456-
: DEVICE_HEALTH_UNMANAGEABLE;
457-
return healthState;
455+
enum manageability_state manageableState = getManageabilityState();
456+
if (MANAGEMENT_INVALIDCONFIG == manageableState)
457+
{
458+
return DEVICE_HEALTH_UNMANAGEABLE;
459+
}
460+
else if(MANAGEMENT_UNKNOWN == manageableState)
461+
{
462+
return DEVICE_HEALTH_UNMANAGEABLE;
463+
}
464+
else if (MANAGEMENT_NON_FUNCTIONAL == manageableState)
465+
{
466+
return DEVICE_HEALTH_NONFUNCTIONAL;
467+
}
468+
return getDeviceStatusHealth();
458469
}
459470

460471
bool Device::isNew()

src/core/device/Device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static const NVM_UINT16 MEMORY_CAPABILITY_MEMORYMODE = 0;
5252
static const NVM_UINT16 MEMORYTYPE_CAPABILITY_APPDIRECTMODE = 2;
5353

5454
static const NVM_UINT16 DEVICE_HEALTH_UNMANAGEABLE = 65534;
55+
static const NVM_UINT16 DEVICE_HEALTH_NONFUNCTIONAL = 65533;
5556

5657
static const NVM_UINT16 DEVICE_LAST_SHUTDOWN_STATUS_UKNOWN = 0;
5758
static const NVM_UINT16 DEVICE_LAST_SHUTDOWN_STATUS_FW_FLUSH_COMPLETE = 1;

src/lib/device.c

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ int add_firmware_properties_to_device(struct device_discovery *p_device)
268268
if ((rc = fw_get_identify_dimm(p_device->device_handle.handle,
269269
&id_dimm)) != NVM_SUCCESS)
270270
{
271+
p_device->manageability = MANAGEMENT_NON_FUNCTIONAL;
271272
COMMON_LOG_ERROR_F(
272273
"Unable to get identify dimm information for handle: [%d]",
273274
p_device->device_handle.handle);
@@ -284,16 +285,6 @@ int add_firmware_properties_to_device(struct device_discovery *p_device)
284285
}
285286
s_memset(&id_dimm, sizeof (id_dimm));
286287
}
287-
else
288-
{
289-
COMMON_LOG_WARN_F("Device with handle %u has a controller or programming interface "
290-
"that is not supported."
291-
"SubsystemVendorID=%hu, SubsystemDeviceID=%hu, "
292-
"first Interface Format Code=%hu",
293-
p_device->device_handle.handle,
294-
p_device->subsystem_vendor_id, p_device->subsystem_device_id,
295-
p_device->interface_format_codes[0]);
296-
}
297288

298289
COMMON_LOG_EXIT_RETURN_I(rc);
299290
return rc;
@@ -349,12 +340,31 @@ void add_smbios_properties_to_populated_devices(struct device_discovery *p_devic
349340
enum manageability_state get_manageability_from_topology(struct nvm_topology *p_topology)
350341
{
351342
COMMON_LOG_ENTRY();
352-
enum manageability_state result = MANAGEMENT_INVALIDCONFIG;
353-
if (!NFIT_DIMM_STATE_IS_DISABLED(p_topology->state_flags) &&
354-
is_device_interface_format_supported(p_topology) &&
355-
is_device_subsystem_controller_supported(p_topology))
356-
{
357-
result = MANAGEMENT_VALIDCONFIG;
343+
enum manageability_state result = MANAGEMENT_VALIDCONFIG;
344+
if (NFIT_DIMM_STATE_IS_DISABLED(p_topology->state_flags))
345+
{
346+
result = MANAGEMENT_NON_FUNCTIONAL;
347+
COMMON_LOG_WARN_F("NFIT declares device with handle %u is disabled. ",
348+
p_topology->device_handle.handle);
349+
}
350+
else if (!is_device_interface_format_supported(p_topology))
351+
{
352+
result = MANAGEMENT_INVALIDCONFIG;
353+
COMMON_LOG_WARN_F("Device with handle %u programming interface "
354+
"that is not supported."
355+
"first Interface Format Code=%hu",
356+
p_topology->device_handle.handle,
357+
p_topology->fmt_interface_codes[0]);
358+
}
359+
else if (!is_device_subsystem_controller_supported(p_topology))
360+
{
361+
result = MANAGEMENT_INVALIDCONFIG;
362+
COMMON_LOG_WARN_F("Device with handle %u has a controller "
363+
"that is not supported."
364+
"SubsystemVendorID=%hu, SubsystemDeviceID=%hu, ",
365+
p_topology->device_handle.handle,
366+
p_topology->subsystem_vendor_id,
367+
p_topology->subsystem_device_id);
358368
}
359369

360370
COMMON_LOG_EXIT_RETURN_I(result);

src/lib/nvm_management.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ enum manageability_state
128128
{
129129
MANAGEMENT_UNKNOWN = 0, // Device is not recognized or manageability cannot be determined.
130130
MANAGEMENT_VALIDCONFIG = 1, // Device is fully manageable.
131-
MANAGEMENT_INVALIDCONFIG = 2 // Device is recognized but cannot be managed.
131+
MANAGEMENT_INVALIDCONFIG = 2, // Device is recognized but cannot be managed.
132+
MANAGEMENT_NON_FUNCTIONAL = 3 // Device is disabled per NFIT
132133
};
133134

134135
/*

0 commit comments

Comments
 (0)