Page MenuHomeFreeBSD

if_bnxt: consolidate readl_fbsd/writel_fbsd and fix BAR mapping
AcceptedPublic

Authored by sumit.saxena_broadcom.com on Wed, Aug 19, 6:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 6, 10:35 AM
Unknown Object (File)
Sun, Sep 6, 5:56 AM
Unknown Object (File)
Sat, Sep 5, 11:44 PM
Unknown Object (File)
Sat, Sep 5, 10:59 AM
Unknown Object (File)
Fri, Sep 4, 3:33 AM
Unknown Object (File)
Thu, Sep 3, 8:00 PM
Unknown Object (File)
Wed, Sep 2, 10:21 PM
Unknown Object (File)
Wed, Sep 2, 11:08 AM
Subscribers
None

Details

Summary

There are multiple duplicates of readl_fbsd and writel_fbsd spread
accross bnxt_en and bnxt_re drivers. Move a single definition into bnxt.h as static
inline, shared by bnxt_en and bnxt_re, using the correctly sized
bus_space_read_4()/bus_space_write_4() accessors, and drop the other
two copies along with their declarations.

Also, Fix the BAR selection while at it: bar_idx 0 addresses BAR0 (the
HWRM bar) and bar_idx 2 addresses BAR2 (the doorbell bar), matching
every call site (e.g. BNXT_FW_HEALTH_REG_TYPE_BAR0/BAR1 in
if_bnxt.c) and bnxt_pci_mapping()'s own bnxt_map_bar() calls, but
both old copies and bnxt.h's own inline had the two bars swapped.

Add BNXT_HWRM_BAR_IDX/BNXT_DOORBELL_BAR_IDX macros for the two valid
bar_idx values and use them at every readl_fbsd()/writel_fbsd() call
site plus bnxt_pci_mapping(), instead of bare 0/2 literals. Any other
bar_idx is a programming error, so readl_fbsd()/writel_fbsd() panic
on it rather than silently guessing a BAR.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped