dmi_memory_channel

Synopsis

#include <opendmi/entity/memory-channel.h>

typedef struct dmi_memory_channel {
    dmi_memory_channel_type_t    type;
    unsigned short               maximum_load;
    size_t                       device_count;
    dmi_memory_channel_device_t *devices;
} dmi_memory_channel_t;

Description

The dmi_memory_channel_t structure holds the decoded memory channel structure (type 37) of SMBIOS: it lists the memory devices attached to a memory channel, and the load each of them puts on the channel. The loads of all the devices together must not exceed the maximum load of the channel.

When the structures are linked, the library also sets the channel field of each memory device of the list (see dmi_memory_device) to the entity of this structure.

The structure is returned by dmi_entity_info for the structures of type DMI_TYPE(memory_channel), and lives as long as the context it has been decoded in.

Fields

type

Type of memory of the channel, see dmi_memory_channel_type.

maximum_load

Maximum load the channel supports; the sum of the load fields of the devices must not exceed it.

device_count

Number of elements of devices: the devices the structure holds completely, out of the number it declares.

devices

Array of the memory devices attached to the channel, with their loads, see dmi_memory_channel_device; nullptr if there are none.

Examples

dmi_registry_t       *registry = dmi_get_registry(context);
dmi_entity_t         *entity   = dmi_registry_lookup_first(registry,
                                     DMI_TYPE(memory_channel), false);
dmi_memory_channel_t *channel  = dmi_entity_info(entity,
                                     DMI_TYPE(memory_channel));

if (channel != nullptr) {
    const char *type = dmi_memory_channel_type_name(channel->type);

    printf("%s channel, maximum load %u\n",
           type != nullptr ? type : "Unknown", channel->maximum_load);

    for (size_t i = 0; i < channel->device_count; i++)
        printf("Device 0x%04x: load %u\n",
               (unsigned)channel->devices[i].handle,
               (unsigned)channel->devices[i].load);
}

Standards

DMTF SMBIOS Specification (DSP0134), version 2.3 or newer.