manifest

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: BSD-3-Clause Imports: 6 Imported by: 13

Documentation

Index

Constants

View Source
const BIOSDirectoryTableCookie = 0x44484224 // $BHD

BIOSDirectoryTableCookie is a special identifier of BIOS Directory table level 1

View Source
const BIOSDirectoryTableEntrySize = 16
View Source
const BIOSDirectoryTableLevel2Cookie = 0x324C4224 // $BL2

BIOSDirectoryTableLevel2Cookie is a special identifier of BIOS Directory table level 2

View Source
const EmbeddedFirmwareStructureSignature = 0x55aa55aa

EmbeddedFirmwareStructureSignature is a special identifier of Firmware Embedded Structure

View Source
const PSPBootloaderCookie = 0x31535024 // "$PS1"

PSPBootloaderCookie is a special identifier of a PSP binary

View Source
const PSPDirectoryTableCookie = 0x50535024 // "$PSP"

PSPDirectoryTableCookie is a special identifier of PSP Directory table level 1

View Source
const PSPDirectoryTableEntrySize = 16
View Source
const PSPDirectoryTableLevel2Cookie = 0x324C5024 // "$PL2"

PSPDirectoryTableLevel2Cookie is a special identifier of PSP Directory table level 2

Variables

This section is empty.

Functions

func CalculateBiosDirectoryCheckSum

func CalculateBiosDirectoryCheckSum(biosDirRaw []byte) uint32

CalculateBiosDirectoryCheckSum calculates expected checksum of BIOS Directory represented in serialised form

func CalculatePSPDirectoryCheckSum

func CalculatePSPDirectoryCheckSum(pspDirRaw []byte) uint32

CalculatePSPDirectoryCheckSum calculates expected checksum of PSP Directory represented in serialised form

Types

type AMDFirmware

type AMDFirmware struct {
	// contains filtered or unexported fields
}

AMDFirmware represents an instance of firmware that exposes AMD specific meatadata and structure.

func NewAMDFirmware

func NewAMDFirmware(firmware Firmware) (*AMDFirmware, error)

NewAMDFirmware returns an AMDFirmware structure or an error if internal firmare structures cannot be parsed

func (*AMDFirmware) Firmware

func (a *AMDFirmware) Firmware() Firmware

Firmware returns the internal reference to Firmawre interface

func (*AMDFirmware) PSPFirmware

func (a *AMDFirmware) PSPFirmware() *PSPFirmware

PSPFirmware returns the PSPFirmware reference held by the AMDFirmware object

type BIOSDirectoryTable

type BIOSDirectoryTable struct {
	BIOSDirectoryTableHeader

	Entries []BIOSDirectoryTableEntry
}

BIOSDirectoryTable represents a BIOS Directory Table Header with all entries Table 11 & Table 12 from (1)

func FindBIOSDirectoryTable

func FindBIOSDirectoryTable(image []byte) (*BIOSDirectoryTable, bytes2.Range, error)

FindBIOSDirectoryTable scans firmware for BIOSDirectoryTableCookie and treats remaining bytes as BIOSDirectoryTable

func ParseBIOSDirectoryTable

func ParseBIOSDirectoryTable(data []byte) (*BIOSDirectoryTable, uint64, error)

ParseBIOSDirectoryTable converts input bytes into BIOSDirectoryTable

func (BIOSDirectoryTable) String

func (b BIOSDirectoryTable) String() string

type BIOSDirectoryTableEntry

type BIOSDirectoryTableEntry struct {
	Type       BIOSDirectoryTableEntryType
	RegionType uint8

	ResetImage bool
	CopyImage  bool
	ReadOnly   bool
	Compressed bool
	Instance   uint8
	Subprogram uint8
	RomID      uint8

	Size               uint32
	SourceAddress      uint64
	DestinationAddress uint64
}

BIOSDirectoryTableEntry represents a single entry in BIOS Directory Table Table 12 from (1)

func ParseBIOSDirectoryTableEntry

func ParseBIOSDirectoryTableEntry(r io.Reader) (*BIOSDirectoryTableEntry, uint64, error)

ParseBIOSDirectoryTableEntry converts input bytes into BIOSDirectoryTableEntry

type BIOSDirectoryTableEntryType

type BIOSDirectoryTableEntryType uint8

BIOSDirectoryTableEntryType is an entry type of BIOS Directory table

const (
	// APCBBinaryEntry denotes APCB binary entry in BIOS Directory table
	APCBBinaryEntry BIOSDirectoryTableEntryType = 0x60
	// APOBBinaryEntry denotes APOB binary in BIOS Directory table
	APOBBinaryEntry BIOSDirectoryTableEntryType = 0x61
	// BIOSRTMVolumeEntry denotes BIOS RTM Volume entry in BIOS Directory table
	BIOSRTMVolumeEntry BIOSDirectoryTableEntryType = 0x62
	// BIOSDirectoryTableLevel2Entry denotes an entry that points to BIOS Directory table level 2
	BIOSDirectoryTableLevel2Entry BIOSDirectoryTableEntryType = 0x70
)

type BIOSDirectoryTableHeader

type BIOSDirectoryTableHeader struct {
	BIOSCookie   uint32
	Checksum     uint32
	TotalEntries uint32
	Reserved     uint32
}

BIOSDirectoryTableHeader represents a BIOS Directory Table Header Table 11 from (1)

type EmbeddedFirmwareStructure

type EmbeddedFirmwareStructure struct {
	Signature                uint32
	Reserved1                [16]byte
	PSPDirectoryTablePointer uint32

	BIOSDirectoryTableFamily17hModels00h0FhPointer uint32
	BIOSDirectoryTableFamily17hModels10h1FhPointer uint32
	BIOSDirectoryTableFamily17hModels30h3FhPointer uint32
	Reserved2                                      uint32
	BIOSDirectoryTableFamily17hModels60h3FhPointer uint32

	Reserved3 [30]byte
}

EmbeddedFirmwareStructure represents Embedded Firmware Structure defined in Table 2 in (1)

func FindEmbeddedFirmwareStructure

func FindEmbeddedFirmwareStructure(firmware Firmware) (*EmbeddedFirmwareStructure, bytes2.Range, error)

FindEmbeddedFirmwareStructure locates and parses Embedded Firmware Structure

func ParseEmbeddedFirmwareStructure

func ParseEmbeddedFirmwareStructure(r io.Reader) (*EmbeddedFirmwareStructure, uint64, error)

ParseEmbeddedFirmwareStructure converts input bytes into EmbeddedFirmwareStructure

type Firmware

type Firmware interface {
	ImageBytes() []byte
	PhysAddrToOffset(physAddr uint64) uint64
	OffsetToPhysAddr(offset uint64) uint64
}

Firmware is an abstraction of a firmware image, obtained for example via flashrom

type FirmwareVersion

type FirmwareVersion [4]byte

FirmwareVersion represents PSP firmware version

func (FirmwareVersion) String

func (v FirmwareVersion) String() string

String converts FirmwareVersion into a string

type PSPDirectoryTable

type PSPDirectoryTable struct {
	PSPDirectoryTableHeader

	Entries []PSPDirectoryTableEntry
}

PSPDirectoryTable represents PSP Directory Table Header with all entries Table 5 in (1)

func FindPSPDirectoryTable

func FindPSPDirectoryTable(image []byte) (*PSPDirectoryTable, bytes2.Range, error)

FindPSPDirectoryTable scans firmware for PSPDirectoryTableCookie and treats remaining bytes as PSPDirectoryTable

func ParsePSPDirectoryTable

func ParsePSPDirectoryTable(data []byte) (*PSPDirectoryTable, uint64, error)

ParsePSPDirectoryTable converts input bytes into PSPDirectoryTable

func (PSPDirectoryTable) String

func (p PSPDirectoryTable) String() string

type PSPDirectoryTableEntry

type PSPDirectoryTableEntry struct {
	Type            PSPDirectoryTableEntryType
	Subprogram      uint8
	ROMId           uint8
	Size            uint32
	LocationOrValue uint64
}

PSPDirectoryTableEntry represents a single entry in PSP Directory Table Table 5 in (1)

func ParsePSPDirectoryTableEntry

func ParsePSPDirectoryTableEntry(r io.Reader) (*PSPDirectoryTableEntry, uint64, error)

ParsePSPDirectoryTableEntry converts input bytes into PSPDirectoryTableEntry

type PSPDirectoryTableEntryType

type PSPDirectoryTableEntryType uint8

PSPDirectoryTableEntryType is an entry type of PSP Directory table

const (
	// AMDPublicKeyEntry denotes AMD public key entry in PSP Directory table
	AMDPublicKeyEntry PSPDirectoryTableEntryType = 0x00
	// PSPBootloaderFirmwareEntry denotes a PSP bootloader firmware entry in PSP Directory table
	PSPBootloaderFirmwareEntry PSPDirectoryTableEntryType = 0x01
	// PSPDirectoryTableLevel2Entry denotes an entry that points to PSP Directory table level 2
	PSPDirectoryTableLevel2Entry PSPDirectoryTableEntryType = 0x40
)

type PSPDirectoryTableHeader

type PSPDirectoryTableHeader struct {
	PSPCookie      uint32
	Checksum       uint32
	TotalEntries   uint32
	AdditionalInfo uint32
}

PSPDirectoryTableHeader represents a BIOS Directory Table Header Tables 3&4 from (1)

type PSPFirmware

type PSPFirmware struct {
	EmbeddedFirmware      EmbeddedFirmwareStructure
	EmbeddedFirmwareRange bytes2.Range

	PSPDirectoryLevel1      *PSPDirectoryTable
	PSPDirectoryLevel1Range bytes2.Range
	PSPDirectoryLevel2      *PSPDirectoryTable
	PSPDirectoryLevel2Range bytes2.Range

	BIOSDirectoryLevel1      *BIOSDirectoryTable
	BIOSDirectoryLevel1Range bytes2.Range
	BIOSDirectoryLevel2      *BIOSDirectoryTable
	BIOSDirectoryLevel2Range bytes2.Range
}

PSPFirmware contains essential parts of the AMD's PSP firmware internals

type PSPHeader

type PSPHeader struct {
	Reserved1 [16]byte
	Cookie    uint32
	Reserved2 [76]byte
	Version   FirmwareVersion
	Reserved3 [156]byte
}

PSPHeader represents a header of each firmware binary See: https://doc.coreboot.org/soc/amd/psp_integration.html

func ParsePSPHeader

func ParsePSPHeader(r io.Reader) (*PSPHeader, error)

ParsePSPHeader parses the PSP header that is supposed to be the beginning of each PSP binary

func (*PSPHeader) CookieLength

func (h *PSPHeader) CookieLength() uint64

CookieLength returns the size in bytes of field Cookie

func (*PSPHeader) CookieOffset

func (h *PSPHeader) CookieOffset() uint64

CookieOffset returns the offset in bytes of field Cookie

func (*PSPHeader) Reserved1Length

func (h *PSPHeader) Reserved1Length() uint64

func (*PSPHeader) Reserved1Offset

func (h *PSPHeader) Reserved1Offset() uint64

Reserved1Offset returns the offset in bytes of field Reserved1

func (*PSPHeader) Reserved2Length

func (h *PSPHeader) Reserved2Length() uint64

Reserved2Length returns the size in bytes of field Reserved2

func (*PSPHeader) Reserved2Offset

func (h *PSPHeader) Reserved2Offset() uint64

Reserved2Offset returns the offset in bytes of field Reserved2

func (*PSPHeader) VersionLength

func (h *PSPHeader) VersionLength() uint64

VersionLength returns the size in bytes of field Version

func (*PSPHeader) VersionOffset

func (h *PSPHeader) VersionOffset() uint64

VersionOffset returns the offset in bytes of field Version

Jump to

Keyboard shortcuts

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