Skip to content

Commit f2cfe84

Browse files
pavanchebbijgunthorpe
authored andcommitted
fwctl/bnxt_fwctl: Add documentation entries
Add bnxt_fwctl to the driver and fwctl documentation pages. Link: https://patch.msgid.link/r/20260314151605.932749-6-pavan.chebbi@broadcom.com Reviewed-by: Andy Gospodarek <gospo@broadcom.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 2783ca0 commit f2cfe84

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
=================
4+
fwctl bnxt driver
5+
=================
6+
7+
:Author: Pavan Chebbi
8+
9+
Overview
10+
========
11+
12+
BNXT driver makes a fwctl service available through an auxiliary_device.
13+
The bnxt_fwctl driver binds to this device and registers itself with the
14+
fwctl subsystem.
15+
16+
The bnxt_fwctl driver is agnostic to the device firmware internals. It
17+
uses the Upper Layer Protocol (ULP) conduit provided by bnxt to send
18+
HardWare Resource Manager (HWRM) commands to firmware.
19+
20+
These commands can query or change firmware driven device configurations
21+
and read/write registers that are useful for debugging.
22+
23+
bnxt_fwctl User API
24+
===================
25+
26+
Each RPC request contains the HWRM input structure in the fwctl_rpc
27+
'in' buffer while 'out' will contain the response.
28+
29+
A typical user application can send a FWCTL_INFO command using ioctl()
30+
to discover bnxt_fwctl's RPC capabilities as shown below:
31+
32+
ioctl(fd, FWCTL_INFO, &fwctl_info_msg);
33+
34+
where fwctl_info_msg (of type struct fwctl_info) describes bnxt_info_msg
35+
(of type struct fwctl_info_bnxt). fwctl_info_msg is set up as follows:
36+
37+
size = sizeof(struct fwctl_info);
38+
flags = 0;
39+
device_data_len = sizeof(bnxt_info_msg);
40+
out_device_data = (__aligned_u64)&bnxt_info_msg;
41+
42+
The uctx_caps of bnxt_info_msg represents the capabilities as described
43+
in fwctl_bnxt_commands of include/uapi/fwctl/bnxt.h
44+
45+
The FW RPC itself, FWCTL_RPC can be sent using ioctl() as:
46+
47+
ioctl(fd, FWCTL_RPC, &fwctl_rpc_msg);
48+
49+
where fwctl_rpc_msg (of type struct fwctl_rpc) carries the HWRM command
50+
in its 'in' buffer. The HWRM input structures are described in
51+
include/linux/bnxt/hsi.h. An example for HWRM_VER_GET is shown below:
52+
53+
struct hwrm_ver_get_output resp;
54+
struct fwctl_rpc fwctl_rpc_msg;
55+
struct hwrm_ver_get_input req;
56+
57+
req.req_type = HWRM_VER_GET;
58+
req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
59+
req.hwrm_intf_min = HWRM_VERSION_MINOR;
60+
req.hwrm_intf_upd = HWRM_VERSION_UPDATE;
61+
req.cmpl_ring = -1;
62+
req.target_id = -1;
63+
64+
fwctl_rpc_msg.size = sizeof(struct fwctl_rpc);
65+
fwctl_rpc_msg.scope = FWCTL_RPC_DEBUG_READ_ONLY;
66+
fwctl_rpc_msg.in_len = sizeof(req);
67+
fwctl_rpc_msg.out_len = sizeof(resp);
68+
fwctl_rpc_msg.in = (__aligned_u64)&req;
69+
fwctl_rpc_msg.out = (__aligned_u64)&resp;
70+
71+
An example python3 program that can exercise this interface can be found in
72+
the following git repository:
73+
74+
https://github.com/Broadcom/fwctl-tools

Documentation/userspace-api/fwctl/fwctl.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ area resulting in clashes will be resolved in favour of a kernel implementation.
148148
fwctl User API
149149
==============
150150

151+
.. kernel-doc:: include/uapi/fwctl/bnxt.h
151152
.. kernel-doc:: include/uapi/fwctl/fwctl.h
152153
.. kernel-doc:: include/uapi/fwctl/mlx5.h
153154
.. kernel-doc:: include/uapi/fwctl/pds.h

Documentation/userspace-api/fwctl/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ to securely construct and execute RPCs inside device firmware.
1010
:maxdepth: 1
1111

1212
fwctl
13+
bnxt_fwctl
1314
fwctl-cxl
1415
pds_fwctl

0 commit comments

Comments
 (0)