eSPI【Enhanced Serial Peripheral Interface】

前言

  本文主要是参照Intel提供的eSPI规范的1.5版本进行编写,需要该版本规范的可以从下面链接中下载:
  点击这里下载

介绍

  eSPI全称Enhanced Serial Peripheral Interface,即增强型串行外设接口,是Intel在2016年推出的新一代总线接口,是为了替代LPC而设计。eSPI总线是根据SPI总线修改而来的。
  eSPI总线的电气特性与SPI总线的电气特性类似,但有些偏差。
  当eSPI Reset# de-asserted时, CLK必须在Chip Select# asserted边缘处处于低电平。当CLK仍然处于低电平时,从controller启动第一个数据,并由target在时钟的第一个上升沿上采样。后续数据由controller在CLK的下降沿发射,target在时钟的上升沿采样。
  eSPI上的所有事务必须是8位(一个字节)的倍数。

基本协议

  eSPI事务包含了一个由controller驱动的命令阶段、一个周转(TAR)阶段和一个由target驱动的响应阶段。
  命令阶段,包含了一个CMD、一个可选报头(HDR)、一个可选数据和一个CRC。
  响应阶段,包含了一个RSP、一个可选报头(HDR)、一个可选数据、一个状态和一个CRC。
  所有eSPI事务都必须生成CRC,其中CRC字节总是在总线上传输。但是,复位后CRC检查默认为禁用,可以通过SET_CONFIGURATION使能。当禁用CRC检查时,接收方忽略CRC字节。
在这里插入图片描述

  eSPI中包含了4个通道,如下图。
在这里插入图片描述
  Peripheral Channel(Channel 0):为了兼容LPC总线通讯而设计,支持I/O、Memory访问。为KBC、ECI、UART、ShareMemory等Super I/O逻辑外设提供了访问基础。
  Virtual Wire Channel(Channel 1):为了取消x86平台的一些实体功能引脚,转而采用数据包的方式在Master和Slave直接传递引脚状态。例如SCI、SLP_S3、SLP_S4、PLTRST#、SERIRQ等。
  OOB(Tunneled SMBus) Message(Channel 2):采用一个通用的数据包格式,在Master和Slave之间传递大宗数据。
  Run-time Flash Access Channel(Channel 3):为了解决Master和Slave之间SPI Flash共享的问题,以此降低成本。

Alert Event

  Target可以通过向Controller发送Alert event信号来启动事务。Alert event可以通过两种方式发出信号。
  在single controller - single target配置中,I/O[1]引脚可以被target用来指示Alert event。当target需要请求controller的服务时,可以将I/O[1]由tri-state切换到Low并一直保持到Chip Select#拉Low;一旦Chip Select#拉Low后,target必须释放掉I/O[1]的所有权。
  在single controller - Multiple targets配置中,需要一个专用的Alert#引脚。

命令阶段

  eSPI controller在命令阶段向target发起事务,或响应target发出的Alert event。命令阶段包含了一个CMD、一个可选报头(HDR)、一个可选数据和一个CRC。
在这里插入图片描述
  CMD字段由一个字节的命令操作码组成。用于指示通道特定的命令和通讯链路管理事件。如果target接收到一个带有无效命令操作码的数据包,则target必须不响应该事务。事务将使用总线上的默认响应(NO_RESPONSE)终止。

CMD OpcodeEncoding[7:0]Description

eSPI Peripheral Channel

PUT_PC0000_0000Put a posted or completion header and optional data.
Note: It is illegal to issue a PUT_PC unless the target has indicated that it is free to take the Posted or Completion packet.
PUT_NP0000_0010Put a non-posted header and optional data.
Note: It is illegal to issue a PUT_NP unless the target has indicated that it is free to take the Non-Posted packet.
GET_PC0000_0001Get a posted or completion header and optional data.
Note: It is illegal to issue a GET_PC unless the target has indicated that it has a Posted or Completion packet available.
GET_NP0000_0011Get a non-posted header and optional data.
Note: It is illegal to issue a GET_NP unless the target has indicated that it has a Non-Posted packet available.
PUT_IORD_SHORT0100_00C1C01Put a short(1, 2 or 4 bytes) non-posted I/O Read packet.
Note: It is illegal to issue a PUT_IORD_SHORT unless the target has indicated that it is free to take the Non-Posted packet.
PUT_IOWR_SHORT0100_01C1C01Put a short(1, 2 or 4 bytes) non-posted I/O Write packet.
Note: It is illegal to issue a PUT_IOWR_SHORT unless the target has indicated that it is free to take the Non-posted packet.
PUT_MEMRD32_SHORT0100_10C1C01Put a short(1, 2 or 4 bytes) non-posted Memory Read 32 packet.
Note: It is illegal to issue a PUT_MEMRD32_SHORT unless the target has indicated that it is free to take the Non-Posted packet.
PUT_MEMWR32_SHORT0100_11C1C01Put a short(1, 2 or 4 bytes) posted Memory Write 32 packet.
Note: It is illegal to issue a PUT_MEMWR32_SHORT unless the target has indicated that it is free to take the Posted or Completion packet.

Virtual Wire Channel

PUT_VWIRE0000_0100Put a Tunneled virtual wire packet.
GET_VWIRE0000_0101Get a Tunneled virtual wire packket.

OOB Message Channel

PUT_OOB0000_0110Put an OOB(Tunneled SMBus) message.
Note: It is illegal to issue a PUT_OOB unless the target has indicated that it is free to take the OOB message.
GET_OOB0000_0111Get an OOB(Tunneled SMBus) message.
Note: It is illegal to issue a GET_OOB unless the target has indicated that it has an OOB message available to send.

Flash Access Channel

PUT_FLASH_C0000_1000Put a Flash Access completion.
Used in Controller Attached Flash Sharing mode for the controller to return a flash access completion to the target.
Note: It is illegal to issue a PUT_FLASH_C unless the target has indicated that it is free to take the Flash Access completion.
GET_FLASH_NP0000_1001Get a non-posted Flash Access request.
Used in Controller Attached Flash Sharing mode for the target to issue a flash access request to the controller.
Note: It is illegal to issue a GET_FLASH_NP unless the target has indicated that it has a non-posted Flash Access request available to send.
PUT_FLASH_NP0000_1010Put a non-posted Flash Access request.
Used in Target Attached Flash Sharing mode for the controller to issue a flash access request to the target.
Note: It is illegal to issue a PUT_FLASH_NP unless the target has indicated that it is free to take the non-posted Flash Access request.
GET_FLASH_C0000_1011Get a Flash Access completion.
Used in Target Attached Flash Sharing mode for the target to return a flash access completion to the controller.
Note: It is illegal to issue a GET_FLASH_C unless the target has indicated that it has a Flash Access completion available to send.

Channel Independent2

GET_STATUS0010_0101Command initiated by the controller to read the status register of the target.
SET_CONFIGURATION0010_0010Command to set the capabilities of the target as part of the initialization. This is typically done after the controller discovers the capabilities of the target.
GET_CONFIGURATION0010_0001Command to discover the capabilities of the target ass part of the initialization.
RESET1111_1111In-band RESET command.

注意:
  1. 操作码编码C1C01表示请求的长度。地址和长度不能跨越DWord边界。

Encoding[1:0]
C1C0
Request Length
001 byte
012 bytes
10Reserved
114 bytes

  2. 该部分命令与通道无关,在eSPI Reset# deassertion后启用。

Turn-Around(TAR)

  在命令阶段的最后一位在数据线上发出后,数据线进入Turn-Around window。eSPI controller需要将所有数据线驱动到逻辑’1’,用于Turn-Around window的第一个时钟,然后将数据线置于tri-state。Turn-Around window的时钟数量固定为2个串行时钟
在这里插入图片描述

响应阶段

  响应阶段由eSPI target驱动,以响应eSPI controller发起得命令。该阶段由一个RSP操作码、可选报头(HDR)、可选数据、状态和CRC组成。

RSP操作码

  RSP操作码是一个8位字段,由一个响应码和一个响应修饰符组成,如下图:
在这里插入图片描述

RESPONSEEncodingDescription
[7:6][5:4][3:0]
ACCEPTR1R01RSV1000Command was successfully received. If the command was a PUT_NP, a response of ACCEPT means that the non-posted transaction is being completed as a "connected" transaction.
DEFFER00RSV0001Only valid in response to a PUT_NP. A non-posted command was successfully received, and completing the non-posted transaction is deferred to a future split completion.
NON_FATAL_ERROR00RSV0010The received command had an error with non-fatal severity. The error does not affect the ability to process the received command.
FATAL_ERROR00RSV0011The received command had a fatal error that prevented the transaction layer packet from being successfully processed. Fatal errors include malformed transactions, Put without Free, Get without Avail and so forth.
WAIT_STATE00RSV1111Adds one byte-time of delay when responding to a transaction on the bus.
NO_RESPONSE11111111The response encoding of all 1's is defined as no response. It is the default response to the GET_CONFIGURATION when no target is present as a result of the weak pull-up on the data lines. It is also the default response when fatal CRC error is detected on the command packet, or when command opcode is not supported and the target must not drive the response phase.

注意:
  1.响应编码R1R0始终为“00”,但具有ACCEPT响应的GET_STATUS除外,该响应具有以下定义:

Encoding[7:6]
R1R0
Description
00No append.
01A peripheral(channel 0) completion is appended.
10A Virtual Wire(channel 1) packet is appended.
11A Flash Access(channel 3) completion is appended. This is only applicable when target attached flash sharing is supported and in operation.

状态

  16位Status字段用于提供信息,例如来自target的新挂起请求和队列空闲信息。该字段反映了在总线上传输状态字段时target的实时状态。
在这里插入图片描述

STATUSBits
Position
Description

Target's Rx queues Free

PC_FREE0When '1', indicates the target is free to accept at least one channel 0 peripheral posted or completion header and data up to maximum payload size.
NP_FREE1When '1', indicates the target is free to accept at least one channel 0 peripheral non-posted header and 1 DW of Data(if applicable).
VWIRE_FREE2This bit must be always a '1'. Tunneling of channel 1 virtual wires is not flow controller.
OOB_FREE3When '1', indicates the target is free to accept at least one channel 2 OOB(tunneled SMBus) message with data up to maximum payload size.

Target's Tx queues Available

PC_AVAIL4When '1', indicates the target has a channel 0 peripheral posted or completion header and optional data up to maximum payload size available to send.
NP_AVAIL5When '1', indicates the target has a channel o peripheral non-posted header available to send.
VWIRE_AVAIL6When '1', indicates the target has a channel 1 tunneled virtual wire available to send.
OOB_AVAIL7When '1', indicates the target has a channel 2 OOB(tunneled SMBus) message with data up to maximum payload size available to send.

Target's Rx queues Free

FLASH_C_FREE8When '1', indicates the target is free to accept at least one channel 3 Flash Access completion header and data up to maximum payload size.
This bit must be always a '1'. The target must be able to accept the completion for the non-posted request it sends.
This bit is only applicable when controller attached flash sharing is supported and in operation. Otherwise, the bit is a don't care.
FLASH_NP_FREE9When '1', indicates the target is free to accept at least one channel 3 Flash Access non-posted header and data up to maximum payload size. This bit is only applicable when target attached flash sharing is supported and in operation. Otherwise, the bit is a don't care.
Reserved11:10Reserved.

Target's Tx queues Available

FLASH_C_AVAIL12When '1', indicates the target has a channel 3 Flash Access completion header and data up to maximum payload size available to send.
This bit is only applicable when target attached flash sharing is supported and in operation. Otherwise, the bit is a don't care.
FLASH_NP_AVAIL13When '1', indicates the target has a channel 3 Flash Access non-posted header and data up to maximum payload size available to send.
This bit is only applicable when controller attached flash sharing is supported and in operation. Otherwise, the bit is a don't care.
Reserved15:14Reserved.

等待状态

  在响应阶段,eSPI target的所有事务都支持WAIT_STATEs。在2个时钟循环(TAR)窗口之后,eSPI target在使用ACCEPT、DEFER、NON_FATAL_ERROR或FATAL_ERROR终止事务之前,允许使用WAIT_STATE响应码进行响应。在响应阶段开始时,eSPI target可以插入一个或多个WAIT_STATE响应码,直至eSPI controller配置的最大WAIT_STATE值
  WAIT_STATE响应码提供的额外延迟是一个字节时间,它分别对应于Single Mode下的8个串行时钟,Dual Mode下的4个串行时钟,Quad Mode下的2两个串行时钟。
在这里插入图片描述

Capabilities and Configuration Registers

  功能和配置寄存器位通过eSPI reset#复位。GET_CONFIGURATION和SET_CONFIGURATION命令用于访问这些寄存器。当使用SET_CONFIGURATION命令配置寄存器时,target的新寄存器值将仅在Chip Select# deasserted时生效。
  从偏移量800h到FFFh的寄存器被保留为特定于平台。这为特定于平台的应用程序提供了2KB的寄存器空间。
  具体每个寄存器的内容大家可以查看spec。

Start(Hex)End(Hex)Register Name
000 003 Reserved
004 007 Device Identification
008 00B General Capabilities and Configurations
00C 00F Reserved
010 013 Channel 0 Capabilites and Configurations
014 01F Reserved
020 023 Channel 1 Capabilites and Configurations
024 02F Reserved
030 033 Channel 2 Capabilites and Configurations
034 03F Reserved
040 043 Channel 3 Capabilites and Configurations
044 7FF Reserved
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凛雨a

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值