pci

package
v0.0.0-...-343224e Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MassStorageController   = 0x01
	NetworkController       = 0x02
	DisplayController       = 0x03 // for GPU
	CommunicationController = 0x07 // for FPGA
	ProcessingAccelerator   = 0x12 // for FPGA
)

Class code

Variables

This section is empty.

Functions

func IDString

func IDString(dom, bus, dev, fun uint32) string

IDString returns given Domain, Bus, Device, FunctionNumber as string

func ParseLocater

func ParseLocater(basePath string) (dom, bus, dev, fun uint32, err error)

ParseLocater parses the pci identifier string

Types

type BasicCap

type BasicCap struct {
	Offset uint16
	ID     byte
	Next   uint16
}

BasicCap represents a PCI capability

type Config

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

Config represents a PCI configuration register

func NewConfig

func NewConfig(p string) *Config

NewConfig creates and initializes a new Config by decoding config register from given path

func (Config) ReadByteFrom

func (c Config) ReadByteFrom(offset uint16) byte

ReadByteFrom reads one-byte as byte value from the given offset

func (Config) ReadDWordFrom

func (c Config) ReadDWordFrom(offset uint16) uint32

ReadDWordFrom reads four-byte as uint32 value from the given offset

func (Config) ReadWordFrom

func (c Config) ReadWordFrom(offset uint16) uint16

ReadWordFrom reads two-byte as uint16 value from the given offset

type Device

type Device struct {
	Path              string
	DeviceID          uint16
	DeviceName        string
	Revision          byte
	VendorID          uint16
	VendorName        string
	SubSystemVendorID uint16
	SubSystemDeviceID uint16
	SubSystemName     string
	ClassID           byte
	ClassName         string
	SubClassID        byte
	SubClassName      string
	InterfaceID       byte
	InterfaceName     string
	Driver            string
	Domain            uint32
	Bus               uint32
	Device            uint32
	Function          uint32
	Numa              uint16
	MaxGen            byte
	MaxSpeed          float32
	MaxWidth          byte
	LinkGen           byte
	LinkSpeed         float32
	LinkWidth         byte
	SlotPowetLimit    float32
	SerialNumber      string
	UncorrectableErrs []string
	CorrectableErrs   []string
	Express           bool // indicates PCIe
	BasicCaps         []*BasicCap
	ExtCaps           []*ExtCap
}

Device represents status of a PCI or PCIe device status

func NewDevice

func NewDevice(path string) *Device

NewDevice creates and initializes a new Device using contents inside of given path

func (*Device) Decode

func (d *Device) Decode() error

Decode makes Device satisfy the mox.Decoder interface

func (Device) IsUnknown

func (d Device) IsUnknown() bool

IsUnknown returns if the device is unknown

func (Device) PCIID

func (d Device) PCIID() string

PCIID returns the device's identifier as Domain:Bus:Device:FunctionNumber

type Devices

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

Devices represents the database of devices

func NewDecoder

func NewDecoder() *Devices

NewDecoder creates and initializes a new slice of Device as Decoder

func (Devices) AllDevices

func (db Devices) AllDevices() []*Device

AllDevices returns a slice of all devices

func (*Devices) Decode

func (devs *Devices) Decode() error

Decode makes Devices satisfy the mox.Decoder interface

func (Devices) FilterByClass

func (db Devices) FilterByClass(cids ...byte) []*Device

FilterByClass returns a slice of device filtered by given class id

type ExtCap

type ExtCap struct {
	Offset uint16
	ID     uint16
	Ver    byte
	Next   uint16
}

ExtCap represents a PCIe capability

Jump to

Keyboard shortcuts

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