目录
处理层描述符(Transaction Descriptor)
本文主要内容来自PCI_Express System Architecture 第四章“Packet-Based Transactions”内容学习。
事务层包(TLP)概述
前面介绍过TLP包主要四种类型为:
- 内存Memory
- IO
- 配置Configuration
- 消息Message
对memory的读写包分为读请求包和响应包、写请求包(不需要存储器的响应包);I/O类型的读写请求都需要相应包;配置类型的包的读写请求也有响应包。这些包请求还可以按属性来分类:NP-nonposted, 即请求需要返回completion的响应包;还有一种就是post,不需要completion返回响应包。TLP 包类型如下表
TLP 包结构
事务层包(TLP) 有三部分组成,帧头、数据、摘要(或者称ECRC),如下图所示:
每种TLP包都有一定的格式的帧头,根据不同包的特性还有数据负荷(Data Payload)和摘要(TLP Digest).帧头中的数据用来对包的管理和控制,Data Playload 用啦存放有效数据。TLP Digest中存放32位的ECRC校验。TLP包传递以DW为长度单位,发送端不得超过“Device Control Register” 中的“max payload Size”的数值,接收端中,所接收的数据量也不能超过接收端”Device Control Register”中的“Max Payload Size”数值。
TLP包组件 |
协议层 |
功能 |
帧头(HDR) |
事务层 |
TLP 头标长 3 或者 4 个 DW,格式和内容随事物类型变化 |
数据(DATA) |
事务层 |
可选段,为 TLP 帧头定义下的数据段,如果该 TLP 不携带数据,那该段为空 |
摘要(DIG) |
事务层 |
可选段,基于头标、数据字段计算出来的 CRC,称为 ECRC。通常长度为1DW |
TLP 包帧头格式
如下图所示,1个DW为4Byte,头标(HDR)长度可以是3DW或者4DW,图中以4DW为例子。
TLP包帧头格式解析:
Header Field |
Header Location |
Field Use |
Fmt[1:0] |
Byte 0->Bit 6:5 |
TLP 头的大小是由 3 个双字还是 4 个双字组成,当前 TLP 是否包含有效负载。 |
Type[4:0] |
Byte 0->Bit 4:0 |
TLP 使用的总线事务 |
TC(Traffic Class) |
Byte 1->Bit 6:4 |
TLP 的服务层次和用于映射的虚拟通道,PCIe 总线规定了 8 </ |