efidevicepath

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACPIPath

type ACPIPath struct {
	Head
	HID uint32
	UID uint32
}

ACPIPath is a ACPI Device Path.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009828A>

func (*ACPIPath) GetHead

func (p *ACPIPath) GetHead() *Head

func (*ACPIPath) ReadFrom

func (p *ACPIPath) ReadFrom(r io.Reader) (n int64, err error)

func (*ACPIPath) Text

func (p *ACPIPath) Text() string

type BIOSBootSpecPath added in v0.6.0

type BIOSBootSpecPath struct {
	Head

	// DeviceType specifies an identification number that
	// describes what type of device this is as defined by the
	// BIOS Boot Specification.
	DeviceType uint16

	// StatusFlag as defined by the BIOS Boot Specification.
	StatusFlag uint16

	// Description is a zero-terminated string that describes
	// this device to a user.
	Description []byte
}

BIOSBootSpecPath is used to describe the booting of non-EFI-aware operating systems.

<https://uefi.org/specs/UEFI/2.9_A/10_Protocols_Device_Path_Protocol.html#bios-boot-specification-device-path-1>

func (*BIOSBootSpecPath) GetHead added in v0.6.0

func (p *BIOSBootSpecPath) GetHead() *Head

func (*BIOSBootSpecPath) ReadFrom added in v0.6.0

func (p *BIOSBootSpecPath) ReadFrom(r io.Reader) (n int64, err error)

func (*BIOSBootSpecPath) Text added in v0.6.0

func (p *BIOSBootSpecPath) Text() string

type CDROMDevicePath

type CDROMDevicePath struct {
	Head

	// BootEntry number from the Boot Catalog. The Initial/Default
	// entry is defined as zero.
	BootEntry uint32

	// PartitionStart is the starting RBA of the partition on the
	// medium. CD-ROMs use Relative logical Block Addressing.
	PartitionStartRBA uint64

	// PartitionSize is the size of the partition in units of
	// Blocks, also called Sectors.
	PartitionSize uint64
}

CDROMDevicePath defines a system partition that exists on a CD-ROM.

Section 10.3.5.2 <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1012169>

func (*CDROMDevicePath) GetHead

func (p *CDROMDevicePath) GetHead() *Head

func (*CDROMDevicePath) ReadFrom

func (p *CDROMDevicePath) ReadFrom(r io.Reader) (n int64, err error)

func (*CDROMDevicePath) Text

func (p *CDROMDevicePath) Text() string

type DevicePath

type DevicePath interface {
	io.ReaderFrom

	GetHead() *Head

	// Text returns a text representation of a Device Path.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1012867>
	Text() string
}

func ParseACPIDevicePath

func ParseACPIDevicePath(f io.Reader, h Head) (p DevicePath, err error)

func ParseBIOSDevicePath added in v0.6.0

func ParseBIOSDevicePath(f io.Reader, h Head) (p DevicePath, err error)

func ParseHardwareDevicePath

func ParseHardwareDevicePath(f io.Reader, h Head) (p DevicePath, err error)

func ParseMediaDevicePath

func ParseMediaDevicePath(f io.Reader, h Head) (p DevicePath, err error)

func ParseMessagingDevicePath

func ParseMessagingDevicePath(r io.Reader, h Head) (p DevicePath, err error)

func ParseUnrecognizedDevicePath

func ParseUnrecognizedDevicePath(r io.Reader, h Head) (p DevicePath, err error)

type DevicePathSubType

type DevicePathSubType uint8

DevicePathSubType varies depending on the DevicePathType value.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009325>

const (

	// PCISubType defines the path to the PCI configuration space
	// address for a PCI device.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009481>
	PCISubType DevicePathSubType

	// PCCARDSubType has no other documentation apart from its
	// binary structure.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009549>
	PCCARDSubType

	// MemoryMappedSubType has no other documentation apart from
	// its binary structure.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009609>
	MemoryMappedSubType

	// VendorHardwareSubType is a vendor-defined hardware
	// Device Paths.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009690>
	VendorHardwareSubType

	// ControllerSubType has no other documentation apart from
	// its binary structure.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009756>
	ControllerSubType

	// BMCSubType defines the path to a
	// Baseboard Management Controller (BMC) host interface.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1355840>
	BMCSubType
)
const (

	// HardDriveSubType represents a partition on a hard drive.
	HardDriveSubType DevicePathSubType

	// CDROMSubType defines a system partition that exists on a CD-ROM.
	CDROMSubType

	// VendorMediaSubType is a vendor-defined media Device Path.
	VendorMediaSubType

	FilePathSubType
	MediaProtocolSubType

	PIWGFirmwareFileSubType
	PIWGFirmwareVolumeSubType

	RelativeOffsetRangeSubType

	RAMDiskSubType
)
const (

	// EndSingleSubType terminates one Device Path instance and
	// denotes the start of another.
	EndSingleSubType DevicePathSubType

	// EndEntireSubType terminates an entire Device Path.
	EndEntireSubType DevicePathSubType = 0xff
)
const (
	ACPISubType DevicePathSubType
)
const (
	BIOSBootSpecSubType DevicePathSubType
)

type DevicePathType

type DevicePathType uint8

DevicePathType is used in Head to distinguish individual Device Path node types.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009325>

const (

	// HardwareType describes a device that is attached to the
	// resource domain of a system.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009458>
	HardwareType DevicePathType

	// ACPIType contains ACPI Device IDs that represent a
	// device’s Plug and Play Hardware ID and its corresponding
	// unique persistent ID.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009807>
	ACPIType

	// MessagingType describes the connection of a device outside
	// the resource domain of the system.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1010040>
	MessagingType

	// MediaType describes the portion of a medium that is being
	// abstracted by a boot service.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1352757>
	MediaType

	// BIOSBootType describes the booting of non-EFI-aware
	// operating systems.
	//
	// <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1376904>
	BIOSBootType

	// EndOfPathType terminates a Hardware Device Path node.
	EndOfPathType DevicePathType = 0x7F
)

type DevicePaths

type DevicePaths []DevicePath

DevicePaths defines the programmatic path to a device.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009325>

func (*DevicePaths) AllText

func (p *DevicePaths) AllText() (out []string)

func (*DevicePaths) ReadFrom

func (p *DevicePaths) ReadFrom(r io.Reader) (n int64, err error)

type EndOfPath

type EndOfPath struct{ Head }

EndOfPath terminates a Device Path.

func (*EndOfPath) GetHead

func (p *EndOfPath) GetHead() *Head

func (*EndOfPath) ReadFrom

func (p *EndOfPath) ReadFrom(r io.Reader) (n int64, err error)

func (*EndOfPath) Text

func (p *EndOfPath) Text() string

type FilePathDevicePath

type FilePathDevicePath struct {
	Head

	PathName []byte
}

FilePathDevicePath describes a file path node.

func (*FilePathDevicePath) GetHead

func (p *FilePathDevicePath) GetHead() *Head

func (*FilePathDevicePath) ReadFrom

func (p *FilePathDevicePath) ReadFrom(r io.Reader) (n int64, err error)

func (*FilePathDevicePath) Text

func (f *FilePathDevicePath) Text() string

type HardDriveMediaDevicePath

type HardDriveMediaDevicePath struct {
	Head

	// PartitionNumber describes the entry in a partition table,
	// starting with entry 1.  Partition number zero represents
	// the entire device.
	PartitionNumber uint32

	// PartitionStartLBA is the starting LBA of the partition on
	// the hard drive.
	PartitionStartLBA uint64

	// Size of the partition in units of Logical Blocks.
	PartitionSizeLBA uint64

	// PartitionSignature is the partition signature. Its value
	// depends on the SignatureType field.
	// 	- If SignatureType is 0, this field has to be
	// 	initialized with 16 zeroes.
	// 	- If SignatureType is 1, the MBR signature is stored
	// 	in the first 4 bytes of this field. The other 12 bytes
	// 	are initialized with zeroes.
	// 	- If SignatureType is 2, this field contains a 16 byte signature
	PartitionSignature [16]byte

	// PartitionFormat describes the format of the partition table.
	PartitionFormat PartitionFormat

	SignatureType SignatureType
}

HardDriveMediaDevicePath represents a partition on a hard drive.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1012056>

func (*HardDriveMediaDevicePath) GetHead

func (p *HardDriveMediaDevicePath) GetHead() *Head

func (*HardDriveMediaDevicePath) ReadFrom

func (p *HardDriveMediaDevicePath) ReadFrom(r io.Reader) (n int64, err error)

func (*HardDriveMediaDevicePath) Text

func (p *HardDriveMediaDevicePath) Text() string
type Head struct {
	Type    DevicePathType
	SubType DevicePathSubType

	// Length describes the size of this structure including
	// variable length data in bytes. Length is always 4 + n bytes.
	Length uint16
}

Head provides generic path/location information concerning a physical device or logical device.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1009264>

func (*Head) Is

type PCIDevicePath

type PCIDevicePath struct {
	Head
	Function byte
	Device   byte
}

PCIDevicePath is a PCI Device Path.

Section 10.3.2.1 "PCI Device Path"

func (*PCIDevicePath) GetHead

func (p *PCIDevicePath) GetHead() *Head

func (*PCIDevicePath) ReadFrom

func (p *PCIDevicePath) ReadFrom(r io.Reader) (n int64, err error)

func (*PCIDevicePath) Text

func (p *PCIDevicePath) Text() string

type PartitionFormat

type PartitionFormat uint8

PartitionFormat describes the partition format.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1012056>

const (

	// PCATPartitionFormat describes a PC-AT compatible legacy
	// MBR. Partition Start and Partition Size come from
	// PartitionStartingLBA and PartitionSizeInLBA in
	// HardDriveMediaDevicePath for the partition.
	PCATPartitionFormat PartitionFormat

	// GUIDPartitionFormat describes a GUID Partition Table.
	GUIDPartitionFormat
)

func (PartitionFormat) String

func (i PartitionFormat) String() string

type SignatureType

type SignatureType uint8

SignatureType describes the signature type.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1012056>

const (
	// NoneSignatureType means No Disk Signature.
	NoneSignatureType SignatureType = iota

	// PCATSignatureType means the 32-bit signature from
	// address 0x1b8 of the type 0x01 MBR.
	PCATSignatureType

	// GUIDSignatureType means the signature from a GUID
	// partition table.
	GUIDSignatureType
)

func (SignatureType) String

func (i SignatureType) String() string

type UnrecognizedDevicePath

type UnrecognizedDevicePath struct {
	Head

	Data []byte
}

UnrecognizedDevicePath represents a Device Path that is unimplemented.

func (*UnrecognizedDevicePath) GetHead

func (p *UnrecognizedDevicePath) GetHead() *Head

func (*UnrecognizedDevicePath) ReadFrom

func (p *UnrecognizedDevicePath) ReadFrom(r io.Reader) (n int64, err error)

func (*UnrecognizedDevicePath) Text

func (p *UnrecognizedDevicePath) Text() string

type VendorMediaDevicePath

type VendorMediaDevicePath struct {
	Head

	// VendorGUID is the Vendor-assigned GUID that defines the
	// data that follows.
	VendorGUID efiguid.GUID

	// VendorDefinedData is the Vendor-defined variable size data.
	VendorDefinedData []byte
}

VendorMediaDevicePath describes a file path node.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#G14.1012246>

func (*VendorMediaDevicePath) GetHead

func (p *VendorMediaDevicePath) GetHead() *Head

func (*VendorMediaDevicePath) ReadFrom

func (p *VendorMediaDevicePath) ReadFrom(r io.Reader) (n int64, err error)

func (*VendorMediaDevicePath) Text

func (p *VendorMediaDevicePath) Text() string

Jump to

Keyboard shortcuts

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