$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

This document describes the end-to-end flow for adding new PM API firmware and how it can be used in any Linux driver.

Table of Contents

Prerequisites

Knowledge of Versal ACAP Platform Management Software Architecture. Please refer below sections from Versal ACAP system software developers guide

Adding a new PM API

To add a new API, changes in the below components are required.

  • XilPM server

  • ATF

  • Linux ZynqMP Firmware driver

ZynqMP Firmware Driver is used for both ZynqMP and Versal Platform

Changes in XilPM server

Define new PM API ID

Firs, user need to define new PM API ID.

Implement the PM API function

Once a new PM API ID is defined, implement the API function

Add new PM API as Valid feature

Feature check API is used to determine compatibility between firmware, ATF and Linux. If there is a change in the existing PM API interface such as arguments, version of that API should be updated in the feature check, otherwise the client (i.e. ATF/Linux) would be using different argument so the PM API may not work properly. To identify this version gap, feature check is an important function that takes care of this check. So, it is required to add new PM API as a valid feature and its version.

Changes in ATF

Add PM API ID in ATF

Add the same PM API ID defined in xilpm/server.

Implement the PM API function

Once the PM API ID is defined, implement the API function.

Add new PM API as Valid feature in ATF

  • Add the newly added API as a valid feature and return the appropriate API version in pm_feature_check().

  • The feature check function in ATF provides the version of the PM API defined in ATF. This is to make sure the API in firmware, ATF and Linux are in sync.

    • Example of Marking PM_IOCTL as valid feature in ATF: PM_IOCTL

Changes in Linux ZynqMP Firmware Driver

Add PM API ID in Linux

Add in the same API ID defined in xilpm/server and ATF.

As per Linux guideline from mainline communityy, enum values should be assigned explicitly

Function to be used by another driver to call PM API

Declaration

Declare a function which can be used by another driver to call PM API.

Right now there is also eemi_ops (zynqmp_eemi_ops structure which holds callback to functions which can be used by other driver to call PM API), will be removed so do not use it.

  • Example of Function declaration: ioctl (Please note that here it is used as callback function but in new Linux kernel it will be direct call)

  • Examples for declaring a function which can be called directly by another driver: zynqmp_pm_clock_enable()

Definition

Define a function to send the PM API request to ATF via SMC. Functions are defined in zynqmp.c.

Example of PM API usage by another driver

Example for end-to-end implementation of PM IOCTL API

Adding a new IOCTL in PM IOCTL API?

Many times, it is not required to add a whole new PM API for minimal operations such as providing access to a register from secure register space to the Non-Secure Application or OS, which might not have direct access to such registers. For these trivial tasks, one can use the existing PM IOCTL API and just add a new IOCTL ID to perform that operation.

For more details, please refer XPm_DevIoctl Operations

No change in ATF is required if you are just adding new IOCTL ID

  • No labels