Ethernet Subsystem Intel® FPGA IP User Guide

ID 773413
Date 11/04/2024
Public
Document Table of Contents

4.3. Subsystem Abstraction Layer (SAL)

The following figure illustrates the Subsystem Abstraction Layer (SAL).

The Subsystem Abstraction Layer (SAL) consists of a NIOS processor and an M20K memory which hosts the NIOS firmware. The main functionality of the SAL is to provide an abstraction layer for the external software to access the functionality of the Ethernet Subsystem via MMIO requests through the AXI-Lite interface.

Figure 6. Subsystem Abstraction Layer (SAL) Block Diagram

The software running on the host CPU communicates with the NIOS soft processor via four 32-bit Subsystem registers: HSSI Command/Status, HSSI Control/Address, HSSI Write Data and HSSI Read Data CSRs.

The external software can make simple “peek/poke” style transaction requests to the NIOS using a traditional asynchronous handshake procedure described below. Please take note that the NIOS processor is not optimized for speed. It is expected to take a few microseconds to complete and acknowledge most transactions.

Handshake procedure:

  • CPU fills control/address control register and commands to be executed.
  • CPU subsequently asserts write/read command bit in command/status control register.
  • NIOS observes and executes request.
  • NIOS asserts BUSY bit in HSSI Command/Status register.
  • NIOS asserts ACK_TRANS bit and clears the BUSY bit in the HSSI Command/Status register upon completion.
  • CPU observes ACK_TRANS and ERROR bit status and write 0 to clear Command/Status register

The Command/Status register is used to trigger application specific functions in the firmware (written in C code). The host would write the SAL command into Control/Address register as desired then write to Command/Status to start the function. An optional return value appears in the Read Data register.

Table 19.  Subsystem Abstraction Layer Commands
HSSI Command/Status   HSSI Control/Address   HSSI Write Data HSSI Read Data
[6:5] - ROffset [4:4] - Error [3:3] - BUSY [2:2] - ACK_TRANS [1:1] - WRITE_CMD [0:0] - READ_CMD     [7:0] - SAL Command    
0 0 0 0 1 0 reserved[31:7] 0x0 - NOP    
0 0 0 0 0 1 reserved[31:16] 0 - 255- Port[15:8] 0x1 - get_hssi_profile   [19:0] - Current Profile
0 0 0 0 1 0 reserved[31:16] 0 - 255- Port[15:8] 0x2 - set_hssi_profile [19:0] - Next Profile  
0 0 0 0 0 1 LSB[31] reserved[30:21] 0-30 - Counters[20:16] 0 - 255- Port[15:8] 0x3 - read_MAC_statistic    
0 0 0 0 0 1 reserved[31:16] 0 - 255- Port[15:8] 0x4 - get_mtu    
Register Offset[1:0] 0 0 0 1 0 Address[25:2] 0x5 - set_csr [31:0] - Write CSR Data  
Register Offset[1:0] 0 0 0 0 1 Address[25:2] 0x6 - get_csr   [31:0] - Read CSR Data
0 0 0 0 1 0 reserved[31:16] 0 - 255- Port[15:8] 0x7 - enable_loopback    
0 0 0 0 1 0 reserved[31:16] 0 - 255- Port[15:8] 0x8 - disable_loopback    
0 0 0 0 1 0 reserved[30:18] 0 - 1 - RX[17] 0 - 1 - TX[16] 0 - 255- Port[15:8] 0x9 - reset MAC statistic    
0 0 0 0 1 0 reserved[31:16] 0 - 255- Port[15:8] 0xA - set_mtu    
0 0 0 0 0 1 reserved[31:16] 0 - 255- Port[15:8] 0xB - ncsi_get_link_status   [31:0] - Read CSR Data
0 0 0 0 0 0     0xC - 0xFE - reserved    
0 0 0 0 0 1 reserved[31:7] 0xFF - firmware_version   [31:0] Firmware Version

The following example demonstrates how the host software would execute the get_mtu and enable_internal_loopback SAL commands on port 0 channel 0.

Command:get_mtu

  • Write HSSI Control/Address Register: 0x4 to bit [7:0](SAL Command), 0x0 to bit[11:8](Port), 0x0 to bit[15:12](Channel).
  • Write HSSI Command/Status Register to configure READ_CMD = 1, WRITE_CMD = 0
  • Poll ACK_TRANS, BUSY and ERROR bits of HSSI Command/Status Register.
  • If ACK_TRANS = 1 and BUSY/ERROR = 0, read HSSI Read Data Register for MTU value.
  • Write 0x0 to clear HSSI Command/Status Register and HSSI Control/Address Register.

Command:enable_loopback

  • Write HSSI Control/Address Register: 0x7 to bit [7:0] (SAL Command), 0x0 to bit[11:8](Port), 0x0 to bit[15:12](Channel).
  • Write HSSI Command/Status Register to configure READ_CMD = 0, WRITE_CMD = 1, ACK_TRANS = 0
  • Poll ACK_TRANS, BUSY and ERROR bits of HSSI Command/Status Register.
  • If ACK_TRANS = 1 and BUSY/ERROR = 0, loopback is enabled successfully
  • Write 0x0 to clear HSSI Command/Status Register and HSSI Control/Address Register

SAL Hardware continuously polls the HSSI Command/Status Register to determine any new request from software.

If the READ_CMD = 1, WRITE_CMD = 0 and ACK_TRANS = 0, it indicates software has issued a read command to SAL registers.

  • SAL Hardware reads the HSSI Control/Address register
  • SAL Hardware asserts BUSY at bit[3] and perform action based on SAL command.
  • Upon successful completion:
    • SAL Hardware asserts the ACK_TRANS at bit[2], de-asserts BUSY at bit[3], de-asserts ERROR at bit[4] of HSSI Command/Status register and writeback the read data in HSSI Read Data register.
  • If command does not complete within the Timeout threshold (10ms):
    • SAL Hardware exits from command execution
    • SAL Hardware de-asserts BUSY at bit[3] and asserts ERROR at bit[4] of HSSI Command/Status register

If the READ_CMD = 0, WRITE_CMD = 1 and ACK_TRANS = 0, it indicates software issued a write command to SAL registers.

  • SAL Hardware reads the HSSI Control/Address register and HSSI Write Data register
  • SAL Hardware asserts BUSY at bit[3] of HSSI Command/Status register.
  • Upon successful completion:
    • SAL Hardware asserts the ACK_TRANS at bit[2], de-asserts BUSY at bit[3], de-asserts ERROR at bit[4] of HSSI Command/Status register.
  • If command does not complete within Timeout threshold (10ms):
    • SAL Hardware exits from command execution
    • SAL Hardware de-asserts BUSY at bit[3] and asserts ERROR at bit[4] of HSSI Command/Status register.

SAL Command Requirements:

  • SAL Hardware is responsible for setting the ACK_TRANS bit, but software must clear this bit.
  • SAL Hardware reads the Command/Status register only when it is in idle state and not executing any command.
  • It is the responsibility of software to avoid writing commands when SAL hardware is executing a command. There is no indication to show the hardware is idle, software must ensure the previous command is completed before writing another command.
  • ERROR bit of Command/Status register is valid only when ACK_TRANS bit is asserted.
  • BUSY bit of Command/Status register is asserted when the SAL hardware is processing a command. The bit is de-asserted upon successful command completion or forceful exit due to timeout.
  • For DR and enable/disable loopback SAL sequences, the whole operation might take more than 10ms and timeout does not apply for these sequences. Instead, a polling method is implemented where a counter is used to poll the DR status and exits with an error when the polling counter expires.

The following diagram illustrates the connectivity between NIOS and the SAL CSR. The SAL command you wrote is qualified with the Read/Write command from the HSSI Command/Status CSR. Each of the SAL commands can be translated into individual PIO input.

Figure 7. Connection Between NIOS and SAL CSR

NIOS constantly samples the PIO input to determine what action is invoked by you. Upon completion of the SAL command, NIOS sends the status to HSSI Command/Status Register through PIO output.