* Reference : PETrainerScriptManual_v*.pdf
☞ http://teledynelecroy.com/protocolanalyzer/pci-express/summit-z3-16-exerciser-with-smbus-support
* LeCroy Exerciser Script - NVMe (1)
☞ http://ya-n-ds.tistory.com/3116
< Basic Structure for Packet Command >
## TLP for PCIe Configuration
Packet=TLP {
TLPType = // CfgWr0/1, CfgRd0/1
… Parameters …
Register = 0x10
Payload = ( dword1, …, ) // Big-endian format for Payload
}
Wait=TLP { TLPType = Cpl }
Wait=2000 // unit : [us]
## TLP for Memory Access
Packet=TLP {
TLPType = // MWr32/64, MRd32/64, …
Length = // in Dword unit ( 1~1024 )
Address = // BAR based. Little-endian format for Address
Payload = // Incr, Random, Zeros, Ones
}
cf. Other TLPType : IoRd/Wr, Msg*, Cpl*
## DLLP for PM
Wait=DLLP { DLLPType = PM_Enter_L1 }
Packet=DLLP {
DLLPType = PM_Request_Ack
… Parameters … // CRC, Field, Count
}
cf. Other DLLPType : Ack, Nak, InitFC*, UpdateFC*, PM*, NOP, Vendor
< Link Command >
Link = // L0, L0s, L1, L23, Disabled, HotReset, Recovery, PERST_Assert, PERST_Deassert, ...
< Config Command >
## Config= TLP
Config = TLP {
AutoSeqNumber = // Yes, No
AutoLCRC = // Yes, No
ReplayTimer = // in [ns]
AutoRetrain = // Yes, No
TagGeneration = // Manual, Defualt, ...
...
}
## Config= AckNak
Config = AckNak {
AckNak = Nak
...
}
## Config = Transactions
Config = Transactions {
AutoCfgCompletion = // Yes, No
AutoMemIoCompletion = // Yes, No
EnableUR = // Yes, No // with AutoMemIoCompletion = Yes
EnableCA = // Yes, No
Poisoned = // Yes, No
...
}
## Config = Definitions
Config = Definitions {
my_register = 0x24 // Any Integer
my_tlptype = CfgWr0 // Pre-defined value
my_payload = ( 0x12345678 0xAABBCCDD 0x01020304 ) // Payload array
my_wait_message = "my wait" // String
}
< TLP Command Examples >
## Config Write - BAR0
Packet=TLP {
TLPType = CfgWr0
PSN = 3 // Packet Sequence number. 'Incr' can be used for multiple TLPs
Tag = 3
Length = 1 // unit : Dword
FirstDwBe = 0xf
Register = 0x10 // BAR0
Payload = 0x00000080 } // Big endian for data
Wait=TLP { TLPType = Cpl }
## Config Read - Command Register
Packet=TLP {
TLPType = CfgRd0
Length = 1
FirstDwBe = 0xf
DeviceId = (1:0:1) // (BusNumber[7:0]:DeviceNumber[4:0]:FunctionNumber[2:0])
Register = 0x4 } // Command Register
Wait=TLP { TLPType = CplD }
## Config Write - Device/Power State
Config = Definitions {
PM_CAP_BASE = 0x40
OFFSET_PMCS = 0x4 }
Packet=TLP {
TLPType = CfgWr0
Length = 1
FirstDwBe = 0x1 // Access to only 1st Byte
Register = (PM_CAP_BASE + OFFSET_PMCS) // 0x44 : PM Control and Statsus
Payload = 0x03000000 // bit[1:0] 11(D3), 10(D2), 01(D1), 00(D0)
}
Wait=TLP { TLPType = Cpl }
## Memory Write - Set CC.EN, MPS
Config = Definitions {
BAR0_BASE = 0x80000000
OFFSET_CC = 0x14 }
Packet=TLP {
TLPType = MWr32
Length = 1
Tag = 49
LastDwBe = 0x0
FirstDwBe = 0x3 // Access to only 1st, 2nd Byte
Address = (BAR0_BASE + OFFSET_CC) // Controller Configuration
Payload = 0x01460000 // = 0x0000_4600 (Little Endian) - MPS=16MB
// bit[15:14] SHN, bit[10:07] MPS, bit[6:4] CSS, bit[0] EN
}
Wait = 500000
## Message, DLLP - Trigger PME_TURN_OFF
Packet=TLP {
TLPType=Msg
MessageCode = PME_Turn_Off
MessageRoute = FromRootComplex
}
Wait=DLLP { DLLPType = PM_Enter_L1 }
Packet=DLLP
{
DLLPType = PM_Request_Ack
}
< Template, Include >
## Template Basic - Pre-defined Packet format
; Base Template
Template = TLP {
Name = "SomeTlp3"
TLPType = MRd32
RequesterID = (0:1:2)
Length = 0x40
LastDwBe = 0xF
FirstDwBe = 0xF
Address = 0x10000 }
; Another template based on the “SomeTlp3”
; The Name, TLPType, Address of “SomeTlp3” is overridden
; with new values for “SomeTlp4” template
Template = “SomeTlp3” {
Name = "SomeTlp4“ // New Template name
TLPType = MRd32
Address = 0x10040 }
; Packet with a different Length from “SomeTlp3” Template
Packet = “SomeTlp3” {
Length = 0x80 }
; Packet with a different Length from “SomeTlp4” Template
Packet = “SomeTlp4” {
Length = 0x80 }
## Include - Includes the PETrainer script file inline
Include = "c:/Testing/included1.peg “
Include = "included2.peg“ // Relative path
Include = “../included3.peg“
cf. : 'Config = General' command cannot be executed in the include file
< Vendor Defined message >
☞ https://www.dmtf.org/sites/default/files/standards/documents/DSP0238_1.0.1.pdf : MCTP PCle VDM Transport Binding Specification
## Vendor Defined Message for MCTP
template = TLP
{
Name = "Temp_PCIe_VDM_Header"
PSN = Incr
;; ** PCIe Medium-Specifice Header
;; 1st Dword ( Byte0~3 )
TLPType=MsgD ; Fmt[6:5]=11b(4DW Header with Data) + Type[4:3]=10b(Message)
;MessageRoute = ByID ; Type[2:0] ( ByID = 010b = 0x2 ) If necessary
MessageRoute = 0x2
Length = 2 ; Payload size = 2 Dword
;; 2nd Dword ( Byte4~7 )
RequesterID = (1:0:0)
Tag = 0x00 ; Rsvd[7:6] + PadLen[5:4] + MCTP VDM Code(0000b)
; PadLen = 0 for Aligned Payload
MessageCode = Vendor_Defined_Type1 ; Should be VDM type 1 for MCTP packets = 0x7F
;; 3rd DWord ( Byte8~11 )
DeviceID = (2:0:0) ; Byte8,9
VendorId = 0x1AB4 ; Byte10,11 - DMTF Vendor ID
;; 4th Dword ( Byte12~15 : MCTP Transport Header )
;VendorData = 0x0108F0C8 ; Big Endian - Packet Seq # = 00b, Message Tag=0x0
VendorData = 0x0108F0EB ; Big Endian - Packet Seq # = 10b, Message Tag=0x3
;Byte12 bit[3:0]=Header Version=1 / Byte13=Destination EID=0x08 / Byte14=Source EID=0xF0
; cf. Byte13 - Destination EID : 0=Null EID, 1~7=Reserved for Future definition, 0xFF=Broadcast EID
;Byte15 : bit[7]=SOM , bit[6]=EOM are set to 1, bit[5:4]=Pkt # =0
;Byte15 : bit[3]=TO(Tag Owner) =1(=Requester) / bit[2:0]=Msg Tag
;;** PCIe VDM Data = MCTP Packet Payload ( Message body - Command dependent )
;1st Dword
; Byte1 - bit[7] Integrity =0b, bit[6:0] Message Type('MCTP Control'=000_0000b)
; Byte2 - bit[7]=Rq('1'=Request), bit[6]=D(Datagram=0), bit[4:0]=Instance ID
; Byte3 - Command Code=0x01(=Set EID)
; Byte4 - bit[1:0] MCTP_CMD_SETID_Operation
; ( 00b=Set ID, 01b=Force ID, 10b=Reset EID, 11b=Set Discovered Flag )
;2nd Dword
; Byte1 - MCTP_CMD_SEID_EPID= 0x09 / Byte2~4 - PAD=0x0 ( determined by 'Pad Len' )
;Payload = (0x00800100 0x09000000)
}
Config=Definitions {
COUNT_LOOP = 1
;PAYLOAD_SIZE_DWORD = 0xF // 64B->0xF, 128B-> 0x1F, 256B->0x3F, 512B->0x7
}
;Repeat = Begin { Count = COUNT_REPEAT Counter=qq }
Loop = Begin { count = COUNT_LOOP }
Packet="Temp_PCIe_VDM_Header"
{
;;** PCIe VDM Data = MCTP Packet Payload ( Message body )
;1st Dword
; Byte1=Message Type('MCTP Control'=000_0000b),
; Byte2 - bit[7]=Rq('1'=Request), bit[6]=D(Datagram=0), bit[4:0]=Instance ID
; Byte3 - Command Code=0x01(=Set ID)
; Byte4 - bit[1:0] MCTP_CMD_SETID_Operation
; ( 00b=Set ID, 01b=Force ID, 10b=Reset EID, 11b=Set Discovered Flag )
;2nd Dword
; Byte1 - MCTP_CMD_SEID_EPID= 0x09 / Byte2~4 - PAD=0x0 ( determined by 'Pad Len' )
;; Variables for Test
;; ** PCIe Medium-Specifice Header
;; 1st Dword ( Byte0~3 )
Length = 2 ; 8B // Payload size = 2 Dword for Set EID ( example )
;Length = COUNT_REPEAT // Defined Variable can be used
;Length = (15 & PAYLOAD_SIZE_DWORD) // Limit payload size up to 15
;Length = 16 ; // 16-64B, 32-128B, 64-256B, 128-512B
;; 2nd Dword ( Byte4~7 )
Tag = 0x00 // Byte4 : Rsvd[7:6] + PadLen[5:4] + MCTP VDM Code(0000b), PadLen = 0 for Aligned Payload
;; 4th Dword ( Byte12~16 )
VendorData = ( (VENDOR_DATA_SETID&0xFFFFFFC8) | ( (qq&0x3)<<4 ) | (qq&0x7) ) // Big Endian
;; Payload
;; 1st, 2nd Dword - MCTP CTRL SetEID format
;Payload = (PAYLOAD_SETID_1ST_DW PAYLOAD_SETID_2ND_DW)
; Payload = (0x00800100 0x09000000)
; Payload = (0x00800100 0x09000000 0x2 0x3) // Dword = 4
; Payload = (0x00800100 0x09000000 0x2 0x3 0x4 0x5 0x6 0x7) // Dword = 8
;; Payload pattern
Payload = Incr // Other patterns : AllOnes, Zeros, Random
}
wait=DLLP { DLLPType = Ack }
Loop = End
;Repeat = End
-------