mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-31 04:45:39 +01:00
Driver provides an interface for tools operating on adapters' Non-Volatile Memory using SIOC(G|S)DRVSPEC ioctls. It allows tools to issue Admin Queue commands to the firmware, which may return an error code encoded as a negative integer. The driver passed this negative integer as the return value of the ioctl handler. This was causing issues because the FreeBSD kernel reserves negative error codes in system calls for special purposes such as restarting the handler or detecting incorrect behavior in VFS operations. Simple remapping of negative values to positive integers caused currently available tools to misbehave and could break the NVM update process. Introduce a new API version, which allows new versions of tools to detect the fixed driver. Temporarily keep the old API, but issue a warning that tools need to be updated. Also refactor the code to use centralized cleanup and move the debug message from the firmware earlier to make sure it is not masked by an error from copyout. Signed-off-by: Krzysztof Galazka <[email protected]> Tested by: Mateusz Moga <[email protected]> MFC after: 2 weeks Assisted by: Copilot GPT 5.4 Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D57942