go-pcie-tlp

module
v0.0.0-...-1354da5 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: Apache-2.0

README

GO-PCIe-TLP

About

This Go library builds and parses PCIe Transport Layer Packets (TLP) as specified in the PCI Express base specification. Coupled with go-pcie-screamer, this library can be used to run PCIe security tests.

Usage

import "github.com/google/go-pcie-tlp/pcie"

// Build memory read TLP.
reqID = pcie.DeviceID {
  Bus:      0x61,
  Device:   0,
  Function: 0,
}
tag := uint8(0x80)
addr := uint64(0x12000)
maxLen := uint32(4096)
tlp, err := pcie.NewMRd(reqID, tag, addr, maxLen)

// Build memory write TLP.
data := []byte{0x41, 0x41, 0x41, 0x41}
tlp, err := pcie.NewMWr(reqID, addr, data)

// Parse completion TLP.
buf := []byte{
  0x4a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x61, 0x00, 0x80, 0x00, 0x41, 0x41, 0x41, 0x41,
  0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}
tlp, err := NewCplFromBytes(buf)

Disclaimer

This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.

Directories

Path Synopsis
Package pcie builds and parses PCIe Transport Layer Packets (TLP).
Package pcie builds and parses PCIe Transport Layer Packets (TLP).

Jump to

Keyboard shortcuts

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