Library for encoding CPER logs

Clone this repo:

Branches

  1. 2168ee1 Use BCD format timestamps by Aryk Ledet · 5 months ago master
  2. e0e1fc0 Fix section offset to match uefi spec. by Aryk Ledet · 9 months ago
  3. 488513c Use enabled flag for tests. by Aryk Ledet · 11 months ago
  4. cc90226 Use default SectionDescriptor constructor. by Aryk Ledet · 11 months ago
  5. 9021a06 Add polymorphic cper encoder class by Aryk Ledet · 11 months ago

cper-lib

This is a header-only library which provides a generic interface for users to write application specific UEFI CPER log encoders.

How to use this library

The UEFI specification for CPER logs allows for many combinations of Record Header and Section Descriptor properties based on the application. However, the underlying data structure does not change from application to application. To make it easier for gBMC applications to log faults in the CPER format the user only needs to specify the type of Record and Section type(s) that the encoder will need to create.

When developing and testing your application specific encoders, you will need to install this library into your development container.

Below is some pseudo code of how a user would setup their application specific CPER encoder which takes in char array types.

class MyCperEncoder : public CperEncoder<char>
{
    RecordHeader createRecordHeader(...) override
    {...}

    SectionDescriptor createSectionDescriptor(...) override
    {
        if (sectionType == kPlatformMemory)
        {
            return createPlatformMemoryDescriptor();
        }
        else if (sectionType == kOemSection)
        {
            return createOemDescriptor();
        }
        ...
    }

    SectionDescriptor createPlatformMemoryDescriptor()
    {...}

    SectionDescriptor createOemDescriptor()
    {...}
}

To install

meson setup -C builddir
meson install -C builddir

To run unit tests

meson test -C builddir