Phil-Engljaehringer opened a new pull request, #21079:
URL: https://github.com/apache/nuttx/pull/21079
arch/arm/src/imx9: scmi: Add BBM GPR get and set.
## Summary
* New feature: the i.MX95 BBNSM (battery-backed non-secure module) has
eight
32-bit general purpose registers (GPRs). They keep their value across
resets of any logical machine (LM), as long as the battery-backed power
domain stays powered.
On the i.MX95 the M7 has no direct access to them; the SM owns the BBNSM
and
exposes the GPRs through the SCMI BBM protocol (0x81).
* This adds two request functions to `arch/arm/src/imx9/imx9_scmi.c`:
* `imx9_scmi_bbmgprset(channel, index, value)` -> `BBM_GPR_SET` (0x3)
* `imx9_scmi_bbmgprget(channel, index, *value)` -> `BBM_GPR_GET` (0x4)
They follow the structure of the existing request functions (A2P lock,
buffer init, a2ptx, a2prx, unlock) and the message layout of the imx-sm
reference client (`components/scmi/scmi_bbm.c`).
* `imx9_scmi.h` gets the SCMI status codes `SCMI_ERR_NOT_SUPPORTED` (-1) ..
`SCMI_ERR_PROTOCOL_ERROR` (-10). The request functions return the SM's
SCMI status unchanged, so callers need these to tell, for example,
`SCMI_ERR_DENIED` apart from other failures. These values overlap with
negated errno values; the header says so. A CRC error on the response
returns `-EIO`, which equals `SCMI_ERR_OUT_OF_RANGE`; the doc blocks of
both functions note this.
* The SM configuration must grant the agent access to the GPR
(`GET` or higher to read, `EXCLUSIVE` or higher to write), otherwise the
SM answers `SCMI_ERR_DENIED`.
* Use case: PX4 on the M7 of the MR-NAVQ95B uses one GPR as a word that
survives M7 and Linux resets and that the SM can read too (for example a
reset lockout while the vehicle is armed). That code lives in the PX4
board
support; there is no in-tree caller in NuttX.
## Impact
* Is new feature added? Is existing feature changed? YES, two new imx9 SCMI
request functions and the SCMI status code defines. No existing function
changes.
* Impact on user (will user need to adapt to change)? NO.
* Impact on build (will build process change)? NO.
* Impact on hardware (will arch(s) / board(s) / driver(s) change)? YES,
only
`arch/arm/src/imx9` (SCMI). Built only with `CONFIG_IMX9_SCMI`.
* Impact on documentation (is update required / provided)? NO, the
functions
are documented in `imx9_scmi.h`.
* Impact on security (any sort of implications)? NO, access to the GPRs is
enforced by the System Manager configuration.
* Impact on compatibility (backward/forward/interoperability)? NO.
## Testing
I confirm that changes are verified on local setup and works as intended:
* Build Host(s): Linux 6.17 x86_64, AMD Ryzen AI 9 HX 370,
arm-none-eabi-gcc 14.2.1 20241119.
* Target(s): ARM Cortex-M7, i.MX95 (MR-NAVQ95B).
Runtime tested on hardware (MR-NAVQ95B, SM configuration granting the M7
agent access to GPR7) with a NuttX 12.12 based tree containing the
identical change: a value written with `imx9_scmi_bbmgprset()` is read back
with `imx9_scmi_bbmgprget()`. On current master the commit was build tested
(`mr-navq95b:rpmsg` and `mr-navq95b:nsh`, no warnings).
`./tools/checkpatch.sh -f` on both files and
`./tools/checkpatch.sh -c -u -m -g HEAD~1..HEAD` pass.
AI assistance: the port to master, the commit message and this description
were prepared with Claude Code (claude-opus-5-5), see the `Assisted-by`
tag.
I reviewed the change, tested it on hardware as described above, and signed
it off.
## PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing
[Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md) and
[Documentation](https://nuttx.apache.org/docs/latest/contributing/index.html)
(git commit title and message, coding standard, etc).
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]