Using System Services in PolarFire SoC FPGA

In PolarFire SoC FPGA designs, system services are implemented using the PolarFire SoC MSS via the SCB bus. The mss_system_services driver configures the MSS SCB registers and initiates the system service request to the System Controller. For software implementation, the mss_system_services driver is provided as C source code. Using mss_system_services driver, the user application executes system services by providing the system service command and mailbox address. The system service request function writes service command and any input command data (depending upon the type of service) to the mailbox address. The System Controller executes the system service request and returns output data to the mailbox RAM along with the return status code. For information about mss_system_services driver and example SoftConsole project, see GitHub.

To execute a system service, the SCB registers are configured as follows:

  1. 1.Writes SCB mailbox address with input data.
  2. 2.Writes service descriptor (service command and mailbox offset address) to the SCB control register.
  3. 3.Initiates the system service request by configuring the SCB control register.
  4. 4.Retrives the system service response from SCB mailbox address offset when System Controller processes the data and command.
  5. 5.Reads the Status Register for return status code.

The SCB registers are described in PolarFire SoC Register Map.

The user application configures the system service execution in polling mode or interrupt mode using the MSS_SYS_service_mode() function and executes the system service. To execute device serial number service, the mss_system_services driver provides the following function:

uint16_t
MSS_SYS_get_serial_number
(
    uint8_t * p_serial_number,
    uint16_t mb_offset
)
{
    uint16_t status = MSS_SYS_PARAM_ERR;

    if (MSS_SYS_SERVICE_INTERRUPT_MODE == g_service_mode)
    {
        status = execute_ss_interrupt_mode(
                (uint8_t)MSS_SYS_SERIAL_NUMBER_REQUEST_CMD,
                NULL_BUFFER,
                MSS_SYS_WITHOUT_CMD_DATA,
                p_serial_number,
                (uint16_t)MSS_SYS_SERIAL_NUMBER_RESP_LEN,
                mb_offset,
                MSS_SYS_COMMON_RET_OFFSET);
    }
    else
    {
        status = execute_ss_polling_mode(
                (uint8_t)MSS_SYS_SERIAL_NUMBER_REQUEST_CMD,
                NULL_BUFFER,
                MSS_SYS_WITHOUT_CMD_DATA,
                p_serial_number,
                (uint16_t)MSS_SYS_SERIAL_NUMBER_RESP_LEN,
                mb_offset,
                MSS_SYS_COMMON_RET_OFFSET);
    }

    return status;
}

Similarly, the remaining system service functions are also described in the source code of mss_system_services driver.