Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

google/go-pcie-tlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

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.

About

Builds and parses PCIe Transport Layer Packets (TLPs)

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages