git: e44579e23430 - main - aq(4): naming and exposure

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Sat, 20 Jun 2026 19:10:43 UTC
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=e44579e23430ff2084b03c9b3d486f05e617e04f

commit e44579e23430ff2084b03c9b3d486f05e617e04f
Author:     Nick Price <nick@spun.io>
AuthorDate: 2026-06-20 19:03:37 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-06-20 19:10:16 +0000

    aq(4): naming and exposure
    
    Reviewed by:    adrian
    Differential Revision:  https://reviews.freebsd.org/D57656
---
 sys/dev/aq/aq_fw.c   | 40 ++++++++++++++++++----------------------
 sys/dev/aq/aq_fw.h   |  2 ++
 sys/dev/aq/aq_fw1x.c | 32 ++++++++++++++++----------------
 sys/dev/aq/aq_fw2x.c | 52 ++++++++++++++++++++++++++--------------------------
 sys/dev/aq/aq_main.c |  2 +-
 5 files changed, 63 insertions(+), 65 deletions(-)

diff --git a/sys/dev/aq/aq_fw.c b/sys/dev/aq/aq_fw.c
index 7f9496add875..72751c81b773 100644
--- a/sys/dev/aq/aq_fw.c
+++ b/sys/dev/aq/aq_fw.c
@@ -85,14 +85,10 @@ const uint32_t RBL_STATUS_HOST_BOOT = 0xf1a7;
 const uint32_t SCRATCHPAD_FW_LOADER_STATUS = (0x40 / sizeof(uint32_t));
 
 
-extern const struct aq_firmware_ops aq_fw1x_ops;
-extern const struct aq_firmware_ops aq_fw2x_ops;
-
-
-int mac_soft_reset_(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode);
-int mac_soft_reset_flb_(struct aq_hw* hw);
-int mac_soft_reset_rbl_(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode);
-int wait_init_mac_firmware_(struct aq_hw* hw);
+static int mac_soft_reset(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode);
+static int mac_soft_reset_flb(struct aq_hw* hw);
+static int mac_soft_reset_rbl(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode);
+static int wait_init_mac_firmware(struct aq_hw* hw);
 
 
 int
@@ -124,14 +120,14 @@ aq_fw_reset(struct aq_hw* hw)
 	 * 2) Driver may skip reset sequence and save time.
 	 */
 	if (hw->fast_start_enabled && !ver) {
-		int err = wait_init_mac_firmware_(hw);
+		int err = wait_init_mac_firmware(hw);
 		/* Skip reset as it just completed */
 		if (!err)
 			return (0);
 	}
 
 	enum aq_fw_bootloader_mode mode = boot_mode_unknown;
-	int err = mac_soft_reset_(hw, &mode);
+	int err = mac_soft_reset(hw, &mode);
 	if (err != 0) {
 		device_printf(hw->dev, "MAC reset failed: %d\n", err);
 		return (err);
@@ -141,12 +137,12 @@ aq_fw_reset(struct aq_hw* hw)
 	case boot_mode_flb:
 		aq_log("FLB> F/W successfully loaded from flash.");
 		hw->flash_present = true;
-		return wait_init_mac_firmware_(hw);
+		return wait_init_mac_firmware(hw);
 
 	case boot_mode_rbl_flash:
 		aq_log("RBL> F/W loaded from flash. Host Bootload disabled.");
 		hw->flash_present = true;
-		return wait_init_mac_firmware_(hw);
+		return wait_init_mac_firmware(hw);
 
 	case boot_mode_unknown:
 		device_printf(hw->dev, "F/W bootload error: unknown bootloader type\n");
@@ -196,21 +192,21 @@ aq_fw_ops_init(struct aq_hw* hw)
 }
 
 
-int
-mac_soft_reset_(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode /*= nullptr*/)
+static int
+mac_soft_reset(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode /*= nullptr*/)
 {
 	if (hw->rbl_enabled) {
-		return mac_soft_reset_rbl_(hw, mode);
+		return mac_soft_reset_rbl(hw, mode);
 	} else {
 		if (mode)
 			*mode = boot_mode_flb;
 
-		return mac_soft_reset_flb_(hw);
+		return mac_soft_reset_flb(hw);
 	}
 }
 
-int
-mac_soft_reset_flb_(struct aq_hw* hw)
+static int
+mac_soft_reset_flb(struct aq_hw* hw)
 {
 	int k;
 
@@ -296,8 +292,8 @@ mac_soft_reset_flb_(struct aq_hw* hw)
 	return (0);
 }
 
-int
-mac_soft_reset_rbl_(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode)
+static int
+mac_soft_reset_rbl(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode)
 {
 	trace(dbg_init, "RBL> MAC reset STARTED!");
 
@@ -349,8 +345,8 @@ mac_soft_reset_rbl_(struct aq_hw* hw, enum aq_fw_bootloader_mode* mode)
 	return (0);
 }
 
-int
-wait_init_mac_firmware_(struct aq_hw* hw)
+static int
+wait_init_mac_firmware(struct aq_hw* hw)
 {
 	for (int i = 0; i < MAC_FW_START_TIMEOUT_MS; ++i) {
 		if ((hw->fw_version.raw = AQ_READ_REG(hw, 0x18)) != 0)
diff --git a/sys/dev/aq/aq_fw.h b/sys/dev/aq/aq_fw.h
index 9195c91d6b5f..be6661db7d57 100644
--- a/sys/dev/aq/aq_fw.h
+++ b/sys/dev/aq/aq_fw.h
@@ -70,6 +70,8 @@ struct aq_firmware_ops
 	int (*led_control)(struct aq_hw* hw, uint32_t mode);
 };
 
+extern const struct aq_firmware_ops aq_fw1x_ops;
+extern const struct aq_firmware_ops aq_fw2x_ops;
 
 int aq_fw_reset(struct aq_hw* hw);
 int aq_fw_ops_init(struct aq_hw* hw);
diff --git a/sys/dev/aq/aq_fw1x.c b/sys/dev/aq/aq_fw1x.c
index 731370e94f3e..72b7f0456ddb 100644
--- a/sys/dev/aq/aq_fw1x.c
+++ b/sys/dev/aq/aq_fw1x.c
@@ -79,18 +79,18 @@ union fw1x_state_reg {
 	};
 };
 
-int fw1x_reset(struct aq_hw* hw);
+static int fw1x_reset(struct aq_hw* hw);
 
-int fw1x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
+static int fw1x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
     enum aq_fw_link_speed speed);
-int fw1x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
+static int fw1x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
     enum aq_fw_link_speed* speed, enum aq_fw_link_fc* fc);
-int fw1x_get_mac_addr(struct aq_hw* hw, uint8_t* mac_addr);
-int fw1x_get_stats(struct aq_hw* hw, struct aq_hw_stats* stats);
+static int fw1x_get_mac_addr(struct aq_hw* hw, uint8_t* mac_addr);
+static int fw1x_get_stats(struct aq_hw* hw, struct aq_hw_stats* stats);
 
 
 static enum fw1x_mode
-mpi_mode_to_fw1x_(enum aq_hw_fw_mpi_state mode)
+mpi_mode_to_fw1x(enum aq_hw_fw_mpi_state mode)
 {
 	switch (mode) {
 	case MPI_DEINIT:
@@ -114,7 +114,7 @@ mpi_mode_to_fw1x_(enum aq_hw_fw_mpi_state mode)
 }
 
 static enum aq_fw1x_rate
-link_speed_mask_to_fw1x_(uint32_t /*aq_fw_link_speed*/ speed)
+link_speed_mask_to_fw1x(uint32_t /*aq_fw_link_speed*/ speed)
 {
 	uint32_t rate = 0;
 	if (speed & aq_fw_10G)
@@ -138,7 +138,7 @@ link_speed_mask_to_fw1x_(uint32_t /*aq_fw_link_speed*/ speed)
 }
 
 static enum aq_fw_link_speed
-fw1x_rate_to_link_speed_(enum aq_fw1x_rate rate)
+fw1x_rate_to_link_speed(enum aq_fw1x_rate rate)
 {
 	switch (rate) {
 	case FW1X_RATE_10G:
@@ -163,7 +163,7 @@ fw1x_rate_to_link_speed_(enum aq_fw1x_rate rate)
 	return (aq_fw_none);
 }
 
-int
+static int
 fw1x_reset(struct aq_hw* hw)
 {
 	uint32_t tid0 = ~0u; /*< Initial value of MBOX transactionId. */
@@ -200,13 +200,13 @@ fw1x_reset(struct aq_hw* hw)
 	return (EBUSY);
 }
 
-int
+static int
 fw1x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
     enum aq_fw_link_speed speed)
 {
 	union fw1x_state_reg state = {0};
-	state.mode = mpi_mode_to_fw1x_(mode);
-	state.speed = link_speed_mask_to_fw1x_(speed);
+	state.mode = mpi_mode_to_fw1x(mode);
+	state.speed = link_speed_mask_to_fw1x(speed);
 
 	trace(dbg_init, "fw1x> set mode %d, rate mask = %#x; raw = %#x",
 	     state.mode, state.speed, state.val);
@@ -216,7 +216,7 @@ fw1x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
 	return (0);
 }
 
-int
+static int
 fw1x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
     enum aq_fw_link_speed* speed, enum aq_fw_link_fc* fc)
 {
@@ -246,7 +246,7 @@ fw1x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
 		*mode = md;
 
 	if (speed)
-		*speed = fw1x_rate_to_link_speed_(state.speed);
+		*speed = fw1x_rate_to_link_speed(state.speed);
 
 	*fc = aq_fw_fc_none;
 
@@ -255,7 +255,7 @@ fw1x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
 }
 
 
-int
+static int
 fw1x_get_mac_addr(struct aq_hw* hw, uint8_t* mac)
 {
 	int err = EFAULT;
@@ -291,7 +291,7 @@ fw1x_get_mac_addr(struct aq_hw* hw, uint8_t* mac)
 	return (0);
 }
 
-int
+static int
 fw1x_get_stats(struct aq_hw* hw, struct aq_hw_stats* stats)
 {
 	int err = 0;
diff --git a/sys/dev/aq/aq_fw2x.c b/sys/dev/aq/aq_fw2x.c
index 339644d0c8e1..bf18f43fd548 100644
--- a/sys/dev/aq/aq_fw2x.c
+++ b/sys/dev/aq/aq_fw2x.c
@@ -193,19 +193,19 @@ struct fw2x_mailbox // struct fwHostInterface
 #define FW2X_LED_DEFAULT  0x0U
 
 // Firmware v2-3.x specific functions.
-int fw2x_reset(struct aq_hw* hw);
+static int fw2x_reset(struct aq_hw* hw);
 
-int fw2x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
+static int fw2x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
     enum aq_fw_link_speed speed);
-int fw2x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
+static int fw2x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
     enum aq_fw_link_speed* speed, enum aq_fw_link_fc* fc);
 
-int fw2x_get_mac_addr(struct aq_hw* hw, uint8_t* mac);
-int fw2x_get_stats(struct aq_hw* hw, struct aq_hw_stats* stats);
+static int fw2x_get_mac_addr(struct aq_hw* hw, uint8_t* mac);
+static int fw2x_get_stats(struct aq_hw* hw, struct aq_hw_stats* stats);
 
 
 static uint64_t
-read64_(struct aq_hw* hw, uint32_t addr)
+read64(struct aq_hw* hw, uint32_t addr)
 {
 	uint64_t lo, hi, hi2;
 
@@ -220,26 +220,26 @@ read64_(struct aq_hw* hw, uint32_t addr)
 }
 
 static uint64_t
-get_mpi_ctrl_(struct aq_hw* hw)
+get_mpi_ctrl(struct aq_hw* hw)
 {
-	return read64_(hw, FW2X_MPI_CONTROL_ADDR);
+	return read64(hw, FW2X_MPI_CONTROL_ADDR);
 }
 
 static uint64_t
-get_mpi_state_(struct aq_hw* hw)
+get_mpi_state(struct aq_hw* hw)
 {
-	return read64_(hw, FW2X_MPI_STATE_ADDR);
+	return read64(hw, FW2X_MPI_STATE_ADDR);
 }
 
 static void
-set_mpi_ctrl_(struct aq_hw* hw, uint64_t value)
+set_mpi_ctrl(struct aq_hw* hw, uint64_t value)
 {
 	AQ_WRITE_REG(hw, FW2X_MPI_CONTROL_ADDR, (uint32_t)value);
 	AQ_WRITE_REG(hw, FW2X_MPI_CONTROL_ADDR + 4, (uint32_t)(value >> 32));
 }
 
 
-int
+static int
 fw2x_reset(struct aq_hw* hw)
 {
 	struct fw2x_capabilities caps = {0};
@@ -263,7 +263,7 @@ fw2x_reset(struct aq_hw* hw)
 
 
 static enum aq_fw2x_rate
-link_speed_mask_to_fw2x_(uint32_t speed)
+link_speed_mask_to_fw2x(uint32_t speed)
 {
 	uint32_t rate = 0;
 
@@ -288,17 +288,17 @@ link_speed_mask_to_fw2x_(uint32_t speed)
 }
 
 
-int
+static int
 fw2x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
     enum aq_fw_link_speed speed)
 {
-	uint64_t mpi_ctrl = get_mpi_ctrl_(hw);
+	uint64_t mpi_ctrl = get_mpi_ctrl(hw);
 
 	AQ_DBG_ENTERA("speed=%d", speed);
 	switch (mode) {
 	case MPI_INIT:
 		mpi_ctrl &= ~FW2X_RATE_MASK;
-		mpi_ctrl |= link_speed_mask_to_fw2x_(speed);
+		mpi_ctrl |= link_speed_mask_to_fw2x(speed);
 		mpi_ctrl &= ~FW2X_CAP_LINK_DROP;
 #if 0 // #todo #flowcontrol #pause #eee
 		if (pHal->pCfg->eee)
@@ -320,22 +320,22 @@ fw2x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state mode,
 		return (EINVAL);
 	}
 
-	set_mpi_ctrl_(hw, mpi_ctrl);
+	set_mpi_ctrl(hw, mpi_ctrl);
 	AQ_DBG_EXIT(0);
 	return (0);
 }
 
-int
+static int
 fw2x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
     enum aq_fw_link_speed* link_speed, enum aq_fw_link_fc* fc)
 {
-	uint64_t mpi_state = get_mpi_state_(hw);
+	uint64_t mpi_state = get_mpi_state(hw);
 	uint32_t rates = mpi_state & FW2X_RATE_MASK;
 
  //   AQ_DBG_ENTER();
 
 	if (mode) {
-		uint64_t mpi_ctrl = get_mpi_ctrl_(hw);
+		uint64_t mpi_ctrl = get_mpi_ctrl(hw);
 		if (mpi_ctrl & FW2X_RATE_MASK)
 		*mode = MPI_INIT;
 		else
@@ -366,7 +366,7 @@ fw2x_get_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state* mode,
 }
 
 
-int
+static int
 fw2x_get_mac_addr(struct aq_hw* hw, uint8_t* mac)
 {
 	int err = EFAULT;
@@ -400,7 +400,7 @@ fw2x_get_mac_addr(struct aq_hw* hw, uint8_t* mac)
 }
 
 static inline void
-fw2x_stats_to_fw_stats_(struct aq_hw_stats* dst,
+fw2x_stats_to_fw_stats(struct aq_hw_stats* dst,
     const struct fw2x_msm_statistics* src)
 {
 	dst->uprc = src->uprc;
@@ -422,7 +422,7 @@ fw2x_stats_to_fw_stats_(struct aq_hw_stats* dst,
 }
 
 
-int
+static int
 fw2x_get_stats(struct aq_hw* hw, struct aq_hw_stats* stats)
 {
 	struct fw2x_msm_statistics fw2x_stats = {0};
@@ -439,15 +439,15 @@ fw2x_get_stats(struct aq_hw* hw, struct aq_hw_stats* stats)
 	    hw->mbox_addr + offsetof(struct fw2x_mailbox, msm),
 	    (uint32_t*)&fw2x_stats, sizeof fw2x_stats/sizeof(uint32_t));
 
-	fw2x_stats_to_fw_stats_(stats, &fw2x_stats);
+	fw2x_stats_to_fw_stats(stats, &fw2x_stats);
 
 	if (err != 0)
 		trace_error(dbg_fw,
 		    "fw2x> download statistics data FAILED, error %d", err);
 
-	mpi_ctrl = get_mpi_ctrl_(hw);
+	mpi_ctrl = get_mpi_ctrl(hw);
 	mpi_ctrl ^= FW2X_CAP_STATISTICS;
-	set_mpi_ctrl_(hw, mpi_ctrl);
+	set_mpi_ctrl(hw, mpi_ctrl);
 
 	return (err);
 }
diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c
index e1b294012b27..d4f687fee8f1 100644
--- a/sys/dev/aq/aq_main.c
+++ b/sys/dev/aq/aq_main.c
@@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$");
 
 MALLOC_DEFINE(M_AQ, "aq", "Aquantia");
 
-char aq_driver_version[] = AQ_VER;
+static const char aq_driver_version[] = AQ_VER;
 
 #define AQUANTIA_VENDOR_ID 0x1D6A