libfru 3.0.2.gb79b203
FRU Manupulation Library
Loading...
Searching...
No Matches
MultiRecord area

Definitions related to MultiRecord Area. More...

Data Structures

struct  fru_mr_rec_t
 MultiRecord area record type. More...
 

Macros

#define FRU_MR_IS_VALID_TYPE(t)
 The FRU_MR_RAW is not considered a valid type, must be checked separately.
 
#define FRU_MR_OEM_COUNT
 The total number of possible OEM types to Multirecord area records.
 
#define FRU_MR_OEM(n)
 An OEM Multirecord area type, make sure that n is less than FRU_MR_OEM_COUNT.
 
#define FRU_MRR_OEM_MAXDATA
 Maximum length of OEM MR record data in decoded form (NUL-terminated hex string)
 
#define FRU_MRR_RAW_MAXDATA
 Maximum length of Custom/Raw MR record data in decoded form (NUL-terminated hex string)
 
#define FRU_MR_MGMT_IS_SUBTYPE_VALID(mt)
 Is the MR management access record subtype mt valid?
 
#define FRU_MR_MGMT_SUBTYPE_TO_IDX(mt)
 Convert a valid MR Management Access Record subtype into a 0-based index or into -1 if mt is not a valid subtype.
 
#define FRU_MR_MGMT_IDX_TO_SUBTYPE(i)
 Convert a valid 0-based index into an MR Management Access Record subtype or to FRU_MR_MGMT_INVALID if the result would not be a valid subtype.
 
#define FRU_MR_MGMT_MAXDATA
 Maximum length of data in MR Management Access record.
 

Typedefs

typedef void * fru_mr_t
 A pointer to multi-record area descriptor.
 

Enumerations

enum  fru_mr_type_t {
  FRU_MR_MIN ,
  FRU_MR_PSU_INFO ,
  FRU_MR_DC_OUT ,
  FRU_MR_DC_LOAD ,
  FRU_MR_MGMT_ACCESS ,
  FRU_MR_BCR ,
  FRU_MR_ECR ,
  FRU_MR_ASF_FIXED_SMBUS ,
  FRU_MR_ASF_LEGACY_ALERTS ,
  FRU_MR_ASF_REMOTE_CTRL ,
  FRU_MR_EXT_DC_OUT ,
  FRU_MR_EXT_DC_LOAD ,
  FRU_MR_NVME ,
  FRU_MR_NVME_PCIE_PORT ,
  FRU_MR_NVME_TOPOLOGY ,
  FRU_MR_NVME_RSVD_E ,
  FRU_MR_NVME_RSVD_F ,
  FRU_MR_OEM_START ,
  FRU_MR_OEM_END ,
  FRU_MR_MAX ,
  FRU_MR_RAW ,
  FRU_MR_TYPE_COUNT ,
  FRU_MR_ANY ,
  FRU_MR_EMPTY
}
 MultiRecord Area Record Types (Table 16-2) More...
 
enum  fru_mr_mgmt_type_t {
  FRU_MR_MGMT_INVALID ,
  FRU_MR_MGMT_MIN ,
  FRU_MR_MGMT_SYS_URL ,
  FRU_MR_MGMT_SYS_NAME ,
  FRU_MR_MGMT_SYS_PING ,
  FRU_MR_MGMT_COMPONENT_URL ,
  FRU_MR_MGMT_COMPONENT_NAME ,
  FRU_MR_MGMT_COMPONENT_PING ,
  FRU_MR_MGMT_SYS_UUID ,
  FRU_MR_MGMT_MAX ,
  FRU_MR_MGMT_INDEX_COUNT
}
 Management Access Record subtypes (Table 18-6) More...
 
enum  fru_nvme_ff_t { FRU_NVME_FF_UNKNOWN }
 NVMe Form-Factor, see NVMe-MI Spec rev 1.2b, Figure 160. More...
 

Functions

fru_mr_rec_tfru_add_mr (fru_t *fru, size_t index, fru_mr_rec_t *rec)
 Add a multirecord area record.
 
fru_mr_rec_tfru_get_mr (const fru_t *fru, size_t index)
 Get a multirecord area record at the given index.
 
fru_mr_rec_tfru_find_mr (const fru_t *fru, fru_mr_type_t type, size_t *index)
 Find a multirecord area record of the given type or at the given index.
 
bool fru_replace_mr (fru_t *fru, size_t index, fru_mr_rec_t *rec)
 Replace a multirecord area record at the given index.
 
bool fru_delete_mr (fru_t *fru, size_t index)
 Delete a multirecord area record at the given index.
 

Detailed Description

Definitions related to MultiRecord Area.

Macro Definition Documentation

◆ FRU_MR_IS_VALID_TYPE

#define FRU_MR_IS_VALID_TYPE (   t)

The FRU_MR_RAW is not considered a valid type, must be checked separately.

◆ FRU_MR_MGMT_IDX_TO_SUBTYPE

#define FRU_MR_MGMT_IDX_TO_SUBTYPE (   i)

Convert a valid 0-based index into an MR Management Access Record subtype or to FRU_MR_MGMT_INVALID if the result would not be a valid subtype.

◆ FRU_MR_MGMT_IS_SUBTYPE_VALID

#define FRU_MR_MGMT_IS_SUBTYPE_VALID (   mt)

Is the MR management access record subtype mt valid?

◆ FRU_MR_MGMT_MAXDATA

#define FRU_MR_MGMT_MAXDATA

Maximum length of data in MR Management Access record.

◆ FRU_MR_MGMT_SUBTYPE_TO_IDX

#define FRU_MR_MGMT_SUBTYPE_TO_IDX (   mt)

Convert a valid MR Management Access Record subtype into a 0-based index or into -1 if mt is not a valid subtype.

◆ FRU_MR_OEM

#define FRU_MR_OEM (   n)

An OEM Multirecord area type, make sure that n is less than FRU_MR_OEM_COUNT.

◆ FRU_MR_OEM_COUNT

#define FRU_MR_OEM_COUNT

The total number of possible OEM types to Multirecord area records.

◆ FRU_MRR_OEM_MAXDATA

#define FRU_MRR_OEM_MAXDATA

Maximum length of OEM MR record data in decoded form (NUL-terminated hex string)

◆ FRU_MRR_RAW_MAXDATA

#define FRU_MRR_RAW_MAXDATA

Maximum length of Custom/Raw MR record data in decoded form (NUL-terminated hex string)

Typedef Documentation

◆ fru_mr_t

typedef void* fru_mr_t

A pointer to multi-record area descriptor.

Not for direct modification by the user. See fru_t.

Enumeration Type Documentation

◆ fru_mr_mgmt_type_t

Management Access Record subtypes (Table 18-6)

Enumerator
FRU_MR_MGMT_INVALID 

Invalid subtype, do not use.

FRU_MR_MGMT_MIN 

The minimum valid (real) subtype.

FRU_MR_MGMT_SYS_URL 

System URL.

FRU_MR_MGMT_SYS_NAME 

System Name.

FRU_MR_MGMT_SYS_PING 

System Ping Address.

FRU_MR_MGMT_COMPONENT_URL 

Component URL.

FRU_MR_MGMT_COMPONENT_NAME 

Component Name.

FRU_MR_MGMT_COMPONENT_PING 

Component Ping Address.

FRU_MR_MGMT_SYS_UUID 

System Unique ID.

FRU_MR_MGMT_MAX 

The maximum valid subtype.

FRU_MR_MGMT_INDEX_COUNT 

The count of 0-based indices of valid subtypes, can be used as an array dimension.

◆ fru_mr_type_t

MultiRecord Area Record Types (Table 16-2)

The ASF_* types are per Alert Standard Format Spec rev 2.0 (DSP0136).

The NVME_* types are per NVME-MI Spec rev 1.2b, section 8.2.

Enumerator
FRU_MR_MIN 

The minimum valid MR record type that can be saved.

FRU_MR_PSU_INFO 

PSU Information.

FRU_MR_DC_OUT 

DC Output.

FRU_MR_DC_LOAD 

DC Load.

FRU_MR_MGMT_ACCESS 

Management Access Record.

FRU_MR_BCR 

Base Compatibility Record.

FRU_MR_ECR 

Extended Compatibility Record.

FRU_MR_ASF_FIXED_SMBUS 

ASF Fixed SMBus Addresses.

FRU_MR_ASF_LEGACY_ALERTS 

ASF Lecacy-Device Alerts.

FRU_MR_ASF_REMOTE_CTRL 

ASF Remote Control.

FRU_MR_EXT_DC_OUT 

Extended DC Output.

FRU_MR_EXT_DC_LOAD 

Extended DC Load.

FRU_MR_NVME 

NVMe Information.

FRU_MR_NVME_PCIE_PORT 

NVMe PCIe Port.

FRU_MR_NVME_TOPOLOGY 

NVMe Topolgy.

FRU_MR_NVME_RSVD_E 

Reserved.

FRU_MR_NVME_RSVD_F 

Reserved.

FRU_MR_OEM_START 

Start of OEM range.

FRU_MR_OEM_END 

End of OEM range.

FRU_MR_MAX 

The maximum valid MR record type that can be saved.

FRU_MR_RAW 

The raw type.

Any of the above types that aren't yet directly supported

FRU_MR_TYPE_COUNT 

Total number of MR record types (including 'raw')

FRU_MR_ANY 

Any MR Record type, for use with fru_find_mr() only.

FRU_MR_EMPTY 

MR Record is empty, will be skipped during saving.

◆ fru_nvme_ff_t

NVMe Form-Factor, see NVMe-MI Spec rev 1.2b, Figure 160.

Not yet implemented

Enumerator
FRU_NVME_FF_UNKNOWN 

Function Documentation

◆ fru_add_mr()

fru_mr_rec_t * fru_add_mr ( fru_t fru,
size_t  index,
fru_mr_rec_t rec 
)

Add a multirecord area record.

Allocates a new multirecord area record structure, adds it to the given FRU info structure, and fills it with provided data. You may discard/free the source rec after a successfull call to this function.

Automatically sets fru->presence[FRU_MR] = true

Parameters
[in,out]fruThe decoded FRU information structure to modify.
[in]indexIndex in the MR record list at which to add the new record. Specify FRU_LIST_TAIL to add the new record at the end of the list, or FRU_LIST_HEAD to insert it at the head.
[in]recThe decoded MultiRecord area record structure to add. If NULL, an empty record of FRU_MR_EMPTY type is added.
Returns
A pointer to the allocated record inside the MR area
Return values
NULLFailure, sets fru_errno

◆ fru_delete_mr()

bool fru_delete_mr ( fru_t fru,
size_t  index 
)

Delete a multirecord area record at the given index.

Finds the record at the given index in the MultiRecord area, and deletes it. Automatically marks the MR area in fru as not present upon deletion of the last entry.

Parameters
[in,out]fruThe decoded FRU information structure to modify.
[in]indexIndex of the record to replace
Returns
Success status
Return values
trueSuccess
falseFailure, sets fru_errno

◆ fru_find_mr()

fru_mr_rec_t * fru_find_mr ( const fru_t fru,
fru_mr_type_t  type,
size_t *  index 
)

Find a multirecord area record of the given type or at the given index.

Finds the record in the MultiRecord area using the record type and the starting index. Updates index when the record is found, sets it to the index of the found record. If the found record was the last in the list, then sets fru_errno.code to FEMREND (but succeeds)

If type is FRU_MR_ANY, then index must point to a non-negative value indicating the index of the record to fetch. In this case the value pointed to by index doesn't change.

Parameters
[in]fruThe decoded FRU information structure to search.
[in]typeType of the record to search for.
[in,out]indexStarting index of the MultiRecord area record to begin the search with. Upon success, the index of the found record. You may specify FRU_LIST_HEAD to start searching from the very start of the list.
Returns
A pointer to the found record inside the MR area
Return values
NULLFailure, sets fru_errno, doesn't update index

◆ fru_get_mr()

fru_mr_rec_t * fru_get_mr ( const fru_t fru,
size_t  index 
)

Get a multirecord area record at the given index.

Finds the record at the given index in the MultiRecord area and returns a pointer to it or NULL if not found.

If the requested index is the last one, then along with returning a valid pointer to the entry at that index, the function will also set fru_errno.code to FEMREND.

Hint

You may use index FRU_LIST_HEAD to check if the MR area is empty:

// MR area is empty!
}
#define FRU_LIST_HEAD
Add entry at the head of the list, used by fru_add_mr() and alike.
Definition fru.h:817
fru_mr_rec_t * fru_get_mr(const fru_t *fru, size_t index)
Get a multirecord area record at the given index.
Parameters
[in]fruThe decoded FRU information structure to search.
[in]indexIndex of the record to fetch from the the MR record list Specify FRU_LIST_HEAD to get the first record or to check whether the list is empty.
Returns
A pointer to the found record inside the MR area
Return values
NULLFailure, sets fru_errno

◆ fru_replace_mr()

bool fru_replace_mr ( fru_t fru,
size_t  index,
fru_mr_rec_t rec 
)

Replace a multirecord area record at the given index.

Finds the record at the given index in the MultiRecord area, and replaces its contents with those from the provided structure. The original rec can be safely discarded after the call.

Parameters
[in,out]fruThe decoded FRU information structure to modify.
[in]indexIndex of the record to replace.
[in]recThe decoded MultiRecord area record structure to use instead of the found one
Returns
Success status
Return values
trueSuccess
falseFailure, sets fru_errno