consts

package
v2.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2023 License: BSD-3-Clause Imports: 0 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// BasePhysAddr is the absolute physical address where the firmware image ends.
	//
	// See Figure 2.1 in https://www.intel.com/content/dam/www/public/us/en/documents/guides/fit-bios-specification.pdf
	//
	// Note: A firmware image grows towards lower addresses. So an image will be mapped to addresses:
	//       [ BasePhysAddr-length .. BasePhysAddr )
	//
	// Note: SPI chip is mapped into this region. So we actually work directly with data of the SPI chip
	//
	// See also CalculatePhysAddrOfOffset().
	BasePhysAddr = 1 << 32 // "4GB"
)

Variables

View Source
var (
	// HPSignedFileMagic is the magic used to detect if the firmware is actually
	// an HP signed container-file (so it's required to extract/find
	// the firmware image first).
	HPSignedFileMagic = []byte(`--=</Begin HP Signed File Fingerprint\>=--`)

	// HPImageMagic is the magic used to find the beginning of the real
	// firmware image inside of a HP signed container-file
	HPImageMagic = []byte(`HPIMAGE`)
)

Functions

func CalculateOffsetFromPhysAddr

func CalculateOffsetFromPhysAddr(physAddr uint64, imageSize uint64) uint64

CalculateOffsetFromPhysAddr calculates the offset within an image of the physical address (address to a region mapped from the SPI chip).

Examples:

CalculateOffsetFromPhysAddr(0xffffffff, 0x1000) == 0xfff
CalculateOffsetFromPhysAddr(0xffffffc0, 0x1000) == 0xfc0

func CalculatePhysAddrFromTailOffset

func CalculatePhysAddrFromTailOffset(offset uint64) uint64

CalculatePhysAddrFromTailOffset calculates the physical address (address to a region mapped from the SPI chip) using an offset towards down, relatively to BasePhysAddr.

Examples:

CalculatePhysAddrFromTailOffset(0x01) ==  0xffffffff
CalculatePhysAddrFromTailOffset(0x40) ==  0xffffffc0

func CalculateTailOffsetFromPhysAddr

func CalculateTailOffsetFromPhysAddr(physAddr uint64) uint64

CalculateTailOffsetFromPhysAddr calculates the offset (towards down, relatively to BasePhysAddr) of the physical address (address to a region mapped from the SPI chip).

This is the reverse function to CalculatePhysAddrFromTailOffset()

Examples:

CalculateTailOffsetFromPhysAddr(0xffffffff) == 0x01
CalculateTailOffsetFromPhysAddr(0xffffffc0) == 0x40

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL