Skip to content

Commit c7534ef

Browse files
committed
2 parents 272115d + f2cfe84 commit c7534ef

21 files changed

Lines changed: 697 additions & 176 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

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10620,6 +10620,12 @@ F: drivers/fwctl/
1062010620
F: include/linux/fwctl.h
1062110621
F: include/uapi/fwctl/
1062210622

10623+
FWCTL BNXT DRIVER
10624+
M: Pavan Chebbi <pavan.chebbi@broadcom.com>
10625+
L: linux-kernel@vger.kernel.org
10626+
S: Maintained
10627+
F: drivers/fwctl/bnxt/
10628+
1062310629
FWCTL MLX5 DRIVER
1062410630
M: Saeed Mahameed <saeedm@nvidia.com>
1062510631
R: Itay Avraham <itayavr@nvidia.com>

drivers/fwctl/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ menuconfig FWCTL
99
fit neatly into an existing subsystem.
1010

1111
if FWCTL
12+
config FWCTL_BNXT
13+
tristate "bnxt control fwctl driver"
14+
depends on BNXT
15+
help
16+
BNXT provides interface for the user process to access the debug and
17+
configuration registers of the Broadcom NIC hardware family.
18+
This will allow configuration and debug tools to work out of the box on
19+
mainstream kernel.
20+
21+
If you don't know what to do here, say N.
22+
1223
config FWCTL_MLX5
1324
tristate "mlx5 ConnectX control fwctl driver"
1425
depends on MLX5_CORE

drivers/fwctl/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
obj-$(CONFIG_FWCTL) += fwctl.o
3+
obj-$(CONFIG_FWCTL_BNXT) += bnxt/
34
obj-$(CONFIG_FWCTL_MLX5) += mlx5/
45
obj-$(CONFIG_FWCTL_PDS) += pds/
56

drivers/fwctl/bnxt/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
obj-$(CONFIG_FWCTL_BNXT) += bnxt_fwctl.o
3+
4+
bnxt_fwctl-y += main.o

0 commit comments

Comments
 (0)