github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/fit/ent_fit_header_entry.go (about)

     1  // Copyright 2017-2021 the LinuxBoot Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package fit
     6  
     7  import (
     8  	"encoding/binary"
     9  	"io"
    10  )
    11  
    12  // EntryFITHeaderEntry represents a FIT entry of type "FIT Header Entry" (0x00)
    13  type EntryFITHeaderEntry struct{ EntryBase }
    14  
    15  var _ EntryCustomGetDataSegmentSizer = (*EntryFITHeaderEntry)(nil)
    16  
    17  func (entry *EntryFITHeaderEntry) CustomGetDataSegmentSize(firmware io.ReadSeeker) (uint64, error) {
    18  	// See "1.2.2" of the specification.
    19  	// FITHeaderEntry contains "_FIT_   " string instead of an address.
    20  	// And we shouldn't do anything in this case.
    21  	return 0, nil
    22  }
    23  
    24  var _ EntryCustomRecalculateHeaderser = (*EntryFITHeaderEntry)(nil)
    25  
    26  func (entry *EntryFITHeaderEntry) CustomRecalculateHeaders() error {
    27  	mostCommonRecalculateHeadersOfEntry(entry)
    28  
    29  	// See 4.2 of the FIT specification.
    30  	entry.Headers.Address = Address64(binary.LittleEndian.Uint64([]byte("_FIT_   ")))
    31  	return nil
    32  }