drivers/fwctl/bnxt/main.c
Source file repositories/reference/linux-study-clean/drivers/fwctl/bnxt/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/fwctl/bnxt/main.c- Extension
.c- Size
- 7185 bytes
- Lines
- 282
- Domain
- Driver Families
- Bucket
- drivers/fwctl
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/auxiliary_bus.hlinux/slab.hlinux/pci.hlinux/fwctl.hlinux/bnxt/hsi.hlinux/bnxt/ulp.huapi/fwctl/fwctl.huapi/fwctl/bnxt.h
Detected Declarations
struct bnxtctl_uctxstruct bnxtctl_devfunction bnxtctl_open_uctxfunction bnxtctl_close_uctxfunction bnxtctl_validate_rpcfunction bnxtctl_get_timeoutfunction bnxtctl_probefunction bnxtctl_remove
Annotated Snippet
struct bnxtctl_uctx {
struct fwctl_uctx uctx;
u32 uctx_caps;
};
struct bnxtctl_dev {
struct fwctl_device fwctl;
struct bnxt_aux_priv *aux_priv;
};
DEFINE_FREE(bnxtctl, struct bnxtctl_dev *, if (_T) fwctl_put(&_T->fwctl))
static int bnxtctl_open_uctx(struct fwctl_uctx *uctx)
{
struct bnxtctl_uctx *bnxtctl_uctx =
container_of(uctx, struct bnxtctl_uctx, uctx);
bnxtctl_uctx->uctx_caps = BIT(FWCTL_BNXT_INLINE_COMMANDS) |
BIT(FWCTL_BNXT_QUERY_COMMANDS) |
BIT(FWCTL_BNXT_SEND_COMMANDS);
return 0;
}
static void bnxtctl_close_uctx(struct fwctl_uctx *uctx)
{
}
static void *bnxtctl_info(struct fwctl_uctx *uctx, size_t *length)
{
struct bnxtctl_uctx *bnxtctl_uctx =
container_of(uctx, struct bnxtctl_uctx, uctx);
struct fwctl_info_bnxt *info;
info = kzalloc_obj(*info);
if (!info)
return ERR_PTR(-ENOMEM);
info->uctx_caps = bnxtctl_uctx->uctx_caps;
*length = sizeof(*info);
return info;
}
/* Caller must hold edev->en_dev_lock */
static bool bnxtctl_validate_rpc(struct bnxt_en_dev *edev,
struct bnxt_fw_msg *hwrm_in,
enum fwctl_rpc_scope scope)
{
struct input *req = (struct input *)hwrm_in->msg;
lockdep_assert_held(&edev->en_dev_lock);
if (edev->flags & BNXT_EN_FLAG_ULP_STOPPED)
return false;
switch (le16_to_cpu(req->req_type)) {
case HWRM_FUNC_RESET:
case HWRM_PORT_CLR_STATS:
case HWRM_FW_RESET:
case HWRM_FW_SYNC:
case HWRM_FW_SET_TIME:
case HWRM_DBG_LOG_BUFFER_FLUSH:
case HWRM_DBG_ERASE_NVM:
case HWRM_DBG_CFG:
case HWRM_NVM_DEFRAG:
case HWRM_NVM_FACTORY_DEFAULTS:
case HWRM_NVM_FLUSH:
case HWRM_NVM_VERIFY_UPDATE:
case HWRM_NVM_ERASE_DIR_ENTRY:
case HWRM_NVM_MOD_DIR_ENTRY:
case HWRM_NVM_FIND_DIR_ENTRY:
return scope >= FWCTL_RPC_CONFIGURATION;
case HWRM_VER_GET:
case HWRM_ERROR_RECOVERY_QCFG:
case HWRM_FUNC_QCAPS:
case HWRM_FUNC_QCFG:
case HWRM_FUNC_QSTATS:
case HWRM_PORT_PHY_QCFG:
case HWRM_PORT_MAC_QCFG:
case HWRM_PORT_PHY_QCAPS:
case HWRM_PORT_PHY_I2C_READ:
case HWRM_PORT_PHY_MDIO_READ:
case HWRM_QUEUE_PRI2COS_QCFG:
case HWRM_QUEUE_COS2BW_QCFG:
case HWRM_VNIC_RSS_QCFG:
case HWRM_QUEUE_GLOBAL_QCFG:
case HWRM_QUEUE_ADPTV_QOS_RX_FEATURE_QCFG:
case HWRM_QUEUE_ADPTV_QOS_TX_FEATURE_QCFG:
case HWRM_QUEUE_QCAPS:
case HWRM_QUEUE_ADPTV_QOS_RX_TUNING_QCFG:
Annotation
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/slab.h`, `linux/pci.h`, `linux/fwctl.h`, `linux/bnxt/hsi.h`, `linux/bnxt/ulp.h`, `uapi/fwctl/fwctl.h`, `uapi/fwctl/bnxt.h`.
- Detected declarations: `struct bnxtctl_uctx`, `struct bnxtctl_dev`, `function bnxtctl_open_uctx`, `function bnxtctl_close_uctx`, `function bnxtctl_validate_rpc`, `function bnxtctl_get_timeout`, `function bnxtctl_probe`, `function bnxtctl_remove`.
- Atlas domain: Driver Families / drivers/fwctl.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.