pci

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lookup

func Lookup(ids map[string]Vendor, vendor string, device string) (string, string)

Lookup takes PCI hex (as strings) vendor and device ID values and returns human readable labels for both the vendor and device. Returns the input ID value if if label is not found in the ids map.

func NewBusReader

func NewBusReader(g string) (busReader, error)

NewBusReader returns a BusReader, given a glob to match PCI devices against. If it can't glob in pciPath/g then it returns an error. We don't provide an option to do type I or PCIe MMIO config stuff.

Types

type Device

type Device string

Device is a PCI device human readable label

type Devices

type Devices []*PCI

Devices contains a slice of one or more PCI devices

func (Devices) ReadConfig

func (d Devices) ReadConfig() error

ReadConfig reads the config info for all the devices.

func (Devices) ReadConfigRegister

func (d Devices) ReadConfigRegister(offset, size int64) ([]uint64, error)

ReadConfigRegister reads the config info for all the devices.

func (Devices) SetVendorDeviceName

func (d Devices) SetVendorDeviceName()

SetVendorDeviceName sets all numeric IDs of all the devices using the pci device SetVendorDeviceName.

func (Devices) String

func (d Devices) String() string

String stringifies the PCI devices. Currently it just calls the device String().

func (Devices) WriteConfigRegister

func (d Devices) WriteConfigRegister(offset, size int64, val uint64) error

WriteConfigRegister writes the config info for all the devices.

type PCI

type PCI struct {
	Addr       string
	Vendor     string `pci:"vendor"`
	Device     string `pci:"device"`
	VendorName string
	DeviceName string
	FullPath   string
	ExtraInfo  []string
}

PCI is a PCI device. We will fill this in as we add options. For now it just holds two uint16 per the PCI spec.

func (*PCI) ReadConfig

func (p *PCI) ReadConfig() error

ReadConfig reads the config space and adds it to ExtraInfo as a hexdump.

func (*PCI) ReadConfigRegister

func (p *PCI) ReadConfigRegister(offset, size int64) (uint64, error)

ReadConfigRegister reads a configuration register of size 8, 16, 32, or 64. It will only work on little-endian machines.

func (*PCI) SetVendorDeviceName

func (p *PCI) SetVendorDeviceName()

SetVendorDeviceName changes VendorName and DeviceName from a name to a number, if possible.

func (*PCI) String

func (p *PCI) String() string

String concatenates PCI address, Vendor, and Device and other information to make a useful display for the user.

func (*PCI) WriteConfigRegister

func (p *PCI) WriteConfigRegister(offset, size int64, val uint64) error

WriteConfigRegister writes a configuration register of size 8, 16, 32, or 64. It will only work on little-endian machines.

type Vendor

type Vendor struct {
	Name    string
	Devices map[string]Device
}

Vendor is a PCI vendor human readable label. It contains a map of one or more Devices keyed by hex ID.

Jump to

Keyboard shortcuts

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