aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi_support/acpi_ibm.c7
-rw-r--r--sys/dev/acpica/Osd/OsdSchedule.c6
-rw-r--r--sys/dev/acpica/acpi.c247
-rw-r--r--sys/dev/acpica/acpi_spmc.c638
-rw-r--r--sys/dev/acpica/acpivar.h15
-rw-r--r--sys/dev/ahci/ahci_pci.c3
-rw-r--r--sys/dev/aic7xxx/ahc_pci.c2
-rw-r--r--sys/dev/asmc/asmc.c179
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_reset.c2
-rw-r--r--sys/dev/atkbdc/psm.c15
-rw-r--r--sys/dev/bnxt/bnxt_en/bnxt.h8
-rw-r--r--sys/dev/bnxt/bnxt_en/bnxt_hwrm.c13
-rw-r--r--sys/dev/bnxt/bnxt_en/bnxt_txrx.c22
-rw-r--r--sys/dev/bnxt/bnxt_en/bnxt_ulp.c6
-rw-r--r--sys/dev/bnxt/bnxt_en/bnxt_ulp.h8
-rw-r--r--sys/dev/bnxt/bnxt_en/if_bnxt.c27
-rw-r--r--sys/dev/bnxt/bnxt_re/bnxt_re-abi.h12
-rw-r--r--sys/dev/bnxt/bnxt_re/bnxt_re.h12
-rw-r--r--sys/dev/bnxt/bnxt_re/ib_verbs.c240
-rw-r--r--sys/dev/bnxt/bnxt_re/ib_verbs.h25
-rw-r--r--sys/dev/bnxt/bnxt_re/main.c79
-rw-r--r--sys/dev/bnxt/bnxt_re/qplib_fp.c115
-rw-r--r--sys/dev/bnxt/bnxt_re/qplib_fp.h13
-rw-r--r--sys/dev/bnxt/bnxt_re/qplib_res.c3
-rw-r--r--sys/dev/bnxt/bnxt_re/qplib_res.h19
-rw-r--r--sys/dev/bnxt/bnxt_re/qplib_sp.c48
-rw-r--r--sys/dev/bnxt/bnxt_re/qplib_sp.h9
-rw-r--r--sys/dev/clk/allwinner/ccu_h616.c493
-rw-r--r--sys/dev/cxgbe/t4_main.c41
-rw-r--r--sys/dev/cxgbe/t4_netmap.c4
-rw-r--r--sys/dev/cxgbe/t4_sge.c15
-rw-r--r--sys/dev/dpaa/bman_fdt.c39
-rw-r--r--sys/dev/dpaa/qman_fdt.c40
-rw-r--r--sys/dev/dpaa2/dpaa2_ni.c42
-rw-r--r--sys/dev/dwc/if_dwc.c16
-rw-r--r--sys/dev/e1000/em_txrx.c2
-rw-r--r--sys/dev/e1000/if_em.c2
-rw-r--r--sys/dev/e1000/igb_txrx.c2
-rw-r--r--sys/dev/evdev/input-event-codes.h485
-rw-r--r--sys/dev/hpt27xx/hpt27xx_osm_bsd.c10
-rw-r--r--sys/dev/hptmv/entry.c3
-rw-r--r--sys/dev/hptnr/hptnr_osm_bsd.c10
-rw-r--r--sys/dev/hptrr/hptrr_osm_bsd.c10
-rw-r--r--sys/dev/hwpmc/hwpmc_amd.c182
-rw-r--r--sys/dev/hwpmc/hwpmc_amd.h61
-rw-r--r--sys/dev/hwpmc/hwpmc_arm64.c7
-rw-r--r--sys/dev/hwpmc/hwpmc_intel.c5
-rw-r--r--sys/dev/ice/if_ice_iflib.c25
-rw-r--r--sys/dev/ichiic/ig4_pci.c8
-rw-r--r--sys/dev/iicbus/controller/twsi/a10_twsi.c1
-rw-r--r--sys/dev/mfi/mfi.c5
-rw-r--r--sys/dev/mlx4/mlx4_core/mlx4_main.c2
-rw-r--r--sys/dev/mpr/mpr_sas_lsi.c1
-rw-r--r--sys/dev/mps/mps_sas_lsi.c1
-rw-r--r--sys/dev/nvme/nvme_qpair.c2
-rw-r--r--sys/dev/pci/pci_iov.c31
-rw-r--r--sys/dev/qlnx/qlnxe/ecore_cxt.c2
-rw-r--r--sys/dev/qlnx/qlnxe/ecore_l2.c41
-rw-r--r--sys/dev/qlnx/qlnxe/ecore_l2_api.h9
-rw-r--r--sys/dev/qlnx/qlnxe/ecore_vf.c11
-rw-r--r--sys/dev/qlnx/qlnxe/qlnx_def.h7
-rw-r--r--sys/dev/qlnx/qlnxe/qlnx_os.c335
-rw-r--r--sys/dev/random/armv8rng.c4
-rw-r--r--sys/dev/rge/if_rge.c20
-rw-r--r--sys/dev/rge/if_rge_hw.c135
-rw-r--r--sys/dev/rge/if_rge_microcode.h636
-rw-r--r--sys/dev/rge/if_rgereg.h6
-rw-r--r--sys/dev/rge/if_rgevar.h3
-rw-r--r--sys/dev/sdhci/sdhci_fdt_rockchip.c8
-rw-r--r--sys/dev/smartpqi/smartpqi_cam.c2
-rw-r--r--sys/dev/smartpqi/smartpqi_controllers.h8
-rw-r--r--sys/dev/smartpqi/smartpqi_defines.h11
-rw-r--r--sys/dev/smartpqi/smartpqi_event.c4
-rw-r--r--sys/dev/smartpqi/smartpqi_features.c2
-rw-r--r--sys/dev/smartpqi/smartpqi_helper.c4
-rw-r--r--sys/dev/smartpqi/smartpqi_helper.h2
-rw-r--r--sys/dev/smartpqi/smartpqi_includes.h2
-rw-r--r--sys/dev/smartpqi/smartpqi_ioctl.c199
-rw-r--r--sys/dev/smartpqi/smartpqi_ioctl.h9
-rw-r--r--sys/dev/smartpqi/smartpqi_main.c2
-rw-r--r--sys/dev/smartpqi/smartpqi_mem.c2
-rw-r--r--sys/dev/smartpqi/smartpqi_prototypes.h1
-rw-r--r--sys/dev/smartpqi/smartpqi_queue.c4
-rw-r--r--sys/dev/smartpqi/smartpqi_request.c2
-rw-r--r--sys/dev/smartpqi/smartpqi_tag.c2
-rw-r--r--sys/dev/spibus/spigen.c4
-rw-r--r--sys/dev/sym/sym_hipd.c312
-rw-r--r--sys/dev/syscons/syscons.c4
-rw-r--r--sys/dev/thunderbolt/tb_pcib.c4
-rw-r--r--sys/dev/tpm/tpm20.c65
-rw-r--r--sys/dev/tpm/tpm20.h1
-rw-r--r--sys/dev/tpm/tpm_crb.c213
-rw-r--r--sys/dev/tpm/tpm_tis_core.c1
-rw-r--r--sys/dev/uart/uart_tty.c3
-rw-r--r--sys/dev/ufshci/ufshci_dev.c55
-rw-r--r--sys/dev/ufshci/ufshci_private.h3
-rw-r--r--sys/dev/ufshci/ufshci_sim.c2
-rw-r--r--sys/dev/usb/net/if_ure.c57
-rw-r--r--sys/dev/usb/usb.h2
-rw-r--r--sys/dev/virtio/gpu/virtio_gpu.c51
-rw-r--r--sys/dev/virtio/network/if_vtnet.c12
-rw-r--r--sys/dev/virtio/p9fs/virtio_p9fs.c10
-rw-r--r--sys/dev/vmm/vmm_dev.c23
-rw-r--r--sys/dev/vt/vt_core.c10
-rw-r--r--sys/dev/wg/if_wg.c4
105 files changed, 4107 insertions, 1520 deletions
diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c
index f895d48bb6d0..1221384e7d8a 100644
--- a/sys/dev/acpi_support/acpi_ibm.c
+++ b/sys/dev/acpi_support/acpi_ibm.c
@@ -1447,8 +1447,13 @@ acpi_ibm_eventhandler(struct acpi_ibm_softc *sc, int arg)
ACPI_SERIAL_BEGIN(ibm);
switch (arg) {
+ /*
+ * XXX "Suspend-to-RAM" here is as opposed to suspend-to-disk, but it is
+ * fine if our suspend sleep state transition request puts us in s2idle
+ * instead of suspend-to-RAM.
+ */
case IBM_EVENT_SUSPEND_TO_RAM:
- power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
break;
case IBM_EVENT_BLUETOOTH:
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index 0c5eadb87687..f0464709e8ad 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -35,7 +35,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
-#include <sys/cpuset.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/malloc.h>
@@ -110,13 +109,10 @@ static void
acpi_taskq_init(void *arg)
{
int i;
- /* XXX Currently assuming BSP is CPU0. */
- cpuset_t just_bsp = CPUSET_T_INITIALIZER(0x1);
acpi_taskq = taskqueue_create_fast("acpi_task", M_NOWAIT,
&taskqueue_thread_enqueue, &acpi_taskq);
- taskqueue_start_threads_cpuset(&acpi_taskq, acpi_max_threads, PWAIT,
- &just_bsp, "acpi_task");
+ taskqueue_start_threads(&acpi_taskq, acpi_max_threads, PWAIT, "acpi_task");
if (acpi_task_count > 0) {
if (bootverbose)
printf("AcpiOsExecute: enqueue %d pending tasks\n",
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 518cbce19e33..59ae4624f407 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -193,6 +193,7 @@ static void acpi_system_eventhandler_sleep(void *arg,
enum power_stype stype);
static void acpi_system_eventhandler_wakeup(void *arg,
enum power_stype stype);
+static int acpi_s4bios_sysctl(SYSCTL_HANDLER_ARGS);
static enum power_stype acpi_sstate_to_stype(int sstate);
static int acpi_sname_to_sstate(const char *sname);
static const char *acpi_sstate_to_sname(int sstate);
@@ -293,6 +294,17 @@ static char acpi_remove_interface[256];
TUNABLE_STR("hw.acpi.remove_interface", acpi_remove_interface,
sizeof(acpi_remove_interface));
+/*
+ * Automatically apply the Darwin OSI on Apple Mac hardware to obtain
+ * access to full ACPI hardware support on supported platforms.
+ *
+ * This flag automatically overrides any values set by
+ * `hw.acpi.acpi_install_interface` and unset by
+ * `hw.acpi.acpi_remove_interface`.
+ */
+static int acpi_apple_darwin_osi = 1;
+TUNABLE_INT("hw.acpi.apple_darwin_osi", &acpi_apple_darwin_osi);
+
/* Allow users to dump Debug objects without ACPI debugger. */
static int acpi_debug_objects;
TUNABLE_INT("debug.acpi.enable_debug_objects", &acpi_debug_objects);
@@ -490,7 +502,6 @@ acpi_attach(device_t dev)
ACPI_STATUS status;
int error, state;
UINT32 flags;
- UINT8 TypeA, TypeB;
char *env;
enum power_stype stype;
@@ -588,61 +599,6 @@ acpi_attach(device_t dev)
goto out;
}
- /*
- * Setup our sysctl tree.
- *
- * XXX: This doesn't check to make sure that none of these fail.
- */
- sysctl_ctx_init(&sc->acpi_sysctl_ctx);
- sc->acpi_sysctl_tree = SYSCTL_ADD_NODE(&sc->acpi_sysctl_ctx,
- SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO, device_get_name(dev),
- CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "");
- SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "supported_sleep_state",
- CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
- 0, 0, acpi_supported_sleep_state_sysctl, "A",
- "List supported ACPI sleep states.");
- SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "power_button_state",
- CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
- &sc->acpi_power_button_stype, 0, acpi_stype_sysctl, "A",
- "Power button ACPI sleep state.");
- SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "sleep_button_state",
- CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
- &sc->acpi_sleep_button_stype, 0, acpi_stype_sysctl, "A",
- "Sleep button ACPI sleep state.");
- SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "lid_switch_state",
- CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
- &sc->acpi_lid_switch_stype, 0, acpi_stype_sysctl, "A",
- "Lid ACPI sleep state. Set to s2idle or s2mem if you want to suspend "
- "your laptop when you close the lid.");
- SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "suspend_state", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
- NULL, 0, acpi_suspend_state_sysctl, "A",
- "Current ACPI suspend state. This sysctl is deprecated; you probably "
- "want to use kern.power.suspend instead.");
- SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "standby_state",
- CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
- &sc->acpi_standby_sx, 0, acpi_sleep_state_sysctl, "A",
- "ACPI Sx state to use when going standby (usually S1 or S2).");
- SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0,
- "sleep delay in seconds");
- SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "s4bios", CTLFLAG_RW, &sc->acpi_s4bios, 0,
- "Use S4BIOS when hibernating.");
- SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "verbose", CTLFLAG_RW, &sc->acpi_verbose, 0, "verbose mode");
- SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "disable_on_reboot", CTLFLAG_RW,
- &sc->acpi_do_disable, 0, "Disable ACPI when rebooting/halting system");
- SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "handle_reboot", CTLFLAG_RW,
- &sc->acpi_handle_reboot, 0, "Use ACPI Reset Register to reboot");
-
#if defined(__amd64__) || defined(__i386__)
/*
* Enable workaround for incorrect ISA IRQ polarity by default on
@@ -650,10 +606,6 @@ acpi_attach(device_t dev)
*/
if (cpu_vendor_id == CPU_VENDOR_INTEL)
acpi_override_isa_irq_polarity = 1;
- SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "override_isa_irq_polarity", CTLFLAG_RDTUN,
- &acpi_override_isa_irq_polarity, 0,
- "Force active-hi polarity for edge-triggered ISA IRQs");
#endif
/*
@@ -673,11 +625,12 @@ acpi_attach(device_t dev)
if (AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER)
sc->acpi_handle_reboot = 1;
-#if !ACPI_REDUCED_HARDWARE
- /* Only enable S4BIOS by default if the FACS says it is available. */
+ /*
+ * Mark whether S4BIOS is available according to the FACS, and if it is,
+ * enable it by default.
+ */
if (AcpiGbl_FACS != NULL && AcpiGbl_FACS->Flags & ACPI_FACS_S4_BIOS_PRESENT)
- sc->acpi_s4bios = 1;
-#endif
+ sc->acpi_s4bios = sc->acpi_s4bios_supported = true;
/*
* Probe all supported ACPI sleep states. Awake (S0) is always supported,
@@ -688,13 +641,14 @@ acpi_attach(device_t dev)
#if defined(__i386__) || defined(__amd64__)
acpi_supported_stypes[POWER_STYPE_SUSPEND_TO_IDLE] = true;
#endif
- for (state = ACPI_STATE_S1; state <= ACPI_STATE_S5; state++)
- if (ACPI_SUCCESS(AcpiEvaluateObject(ACPI_ROOT_OBJECT,
- __DECONST(char *, AcpiGbl_SleepStateNames[state]), NULL, NULL)) &&
- ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) {
+ for (state = ACPI_STATE_S1; state <= ACPI_STATE_S5; state++) {
+ UINT8 TypeA, TypeB;
+
+ if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) {
acpi_supported_sstates[state] = true;
acpi_supported_stypes[acpi_sstate_to_stype(state)] = true;
}
+ }
/*
* Dispatch the default sleep type to devices. The lid switch is set
@@ -761,6 +715,71 @@ acpi_attach(device_t dev)
if ((error = acpi_machdep_init(dev)))
goto out;
+ /*
+ * Setup our sysctl tree.
+ *
+ * XXX: This doesn't check to make sure that none of these fail.
+ */
+ sysctl_ctx_init(&sc->acpi_sysctl_ctx);
+ sc->acpi_sysctl_tree = SYSCTL_ADD_NODE(&sc->acpi_sysctl_ctx,
+ SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO, device_get_name(dev),
+ CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "supported_sleep_state",
+ CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
+ 0, 0, acpi_supported_sleep_state_sysctl, "A",
+ "List supported ACPI sleep states.");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "power_button_state",
+ CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &sc->acpi_power_button_stype, 0, acpi_stype_sysctl, "A",
+ "Power button ACPI sleep state.");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "sleep_button_state",
+ CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &sc->acpi_sleep_button_stype, 0, acpi_stype_sysctl, "A",
+ "Sleep button ACPI sleep state.");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "lid_switch_state",
+ CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &sc->acpi_lid_switch_stype, 0, acpi_stype_sysctl, "A",
+ "Lid ACPI sleep state. Set to s2idle or s2mem if you want to suspend "
+ "your laptop when you close the lid.");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "suspend_state", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ NULL, 0, acpi_suspend_state_sysctl, "A",
+ "Current ACPI suspend state. This sysctl is deprecated; you probably "
+ "want to use kern.power.suspend instead.");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "standby_state",
+ CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &sc->acpi_standby_sx, 0, acpi_sleep_state_sysctl, "A",
+ "ACPI Sx state to use when going standby (usually S1 or S2).");
+ SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0,
+ "sleep delay in seconds");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "s4bios", CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ sc, 0, acpi_s4bios_sysctl, "CU",
+ "On hibernate, have the firmware save/restore the machine state (S4BIOS).");
+ SYSCTL_ADD_BOOL(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "s4bios_supported", CTLFLAG_RD, &sc->acpi_s4bios_supported, 0,
+ "Whether firmware supports saving/restoring the machine state (S4BIOS).");
+ SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "verbose", CTLFLAG_RW, &sc->acpi_verbose, 0, "verbose mode");
+ SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "disable_on_reboot", CTLFLAG_RW,
+ &sc->acpi_do_disable, 0, "Disable ACPI when rebooting/halting system");
+ SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "handle_reboot", CTLFLAG_RW,
+ &sc->acpi_handle_reboot, 0, "Use ACPI Reset Register to reboot");
+#if defined(__amd64__) || defined(__i386__)
+ SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "override_isa_irq_polarity", CTLFLAG_RDTUN,
+ &acpi_override_isa_irq_polarity, 0,
+ "Force active-hi polarity for edge-triggered ISA IRQs");
+#endif
+
/* Register ACPI again to pass the correct argument of pm_func. */
power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc,
acpi_supported_stypes);
@@ -3636,6 +3655,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
device_printf(sc->acpi_dev, "device_suspend failed\n");
goto backout;
}
+ EVENTHANDLER_INVOKE(acpi_post_dev_suspend, stype);
slp_state |= ACPI_SS_DEV_SUSPEND;
if (stype != POWER_STYPE_SUSPEND_TO_IDLE) {
@@ -3645,8 +3665,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
AcpiFormatException(status));
goto backout;
}
+ slp_state |= ACPI_SS_SLP_PREP;
}
- slp_state |= ACPI_SS_SLP_PREP;
if (sc->acpi_sleep_delay > 0)
DELAY(sc->acpi_sleep_delay * 1000000);
@@ -3672,26 +3692,24 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
case POWER_STYPE_UNKNOWN:
__unreachable();
}
+ resumeclock();
/*
* Back out state according to how far along we got in the suspend
* process. This handles both the error and success cases.
*/
backout:
- if ((slp_state & ACPI_SS_SLP_PREP) != 0) {
- resumeclock();
- slp_state &= ~ACPI_SS_SLP_PREP;
- }
if ((slp_state & ACPI_SS_GPE_SET) != 0) {
acpi_wake_prep_walk(sc, stype);
sc->acpi_stype = POWER_STYPE_AWAKE;
slp_state &= ~ACPI_SS_GPE_SET;
}
if ((slp_state & ACPI_SS_DEV_SUSPEND) != 0) {
+ EVENTHANDLER_INVOKE(acpi_pre_dev_resume, stype);
DEVICE_RESUME(root_bus);
slp_state &= ~ACPI_SS_DEV_SUSPEND;
}
- if (stype != POWER_STYPE_SUSPEND_TO_IDLE && (slp_state & ACPI_SS_SLP_PREP) != 0) {
+ if ((slp_state & ACPI_SS_SLP_PREP) != 0) {
AcpiLeaveSleepState(acpi_sstate);
slp_state &= ~ACPI_SS_SLP_PREP;
}
@@ -4052,7 +4070,7 @@ acpi_system_eventhandler_sleep(void *arg, enum power_stype stype)
ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, stype);
/* Check if button action is disabled or unknown. */
- if (stype == ACPI_STATE_UNKNOWN)
+ if (stype == POWER_STYPE_UNKNOWN)
return;
/*
@@ -4424,6 +4442,25 @@ acpiioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *t
}
static int
+acpi_s4bios_sysctl(SYSCTL_HANDLER_ARGS)
+{
+ struct acpi_softc *const sc = arg1;
+ bool val;
+ int error;
+
+ val = sc->acpi_s4bios;
+ error = sysctl_handle_bool(oidp, &val, 0, req);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+
+ if (val && !sc->acpi_s4bios_supported)
+ return (EOPNOTSUPP);
+ sc->acpi_s4bios = val;
+
+ return (0);
+}
+
+static int
acpi_sname_to_sstate(const char *sname)
{
int sstate;
@@ -4621,6 +4658,7 @@ static struct debugtag dbg_layer[] = {
{"ACPI_FAN", ACPI_FAN},
{"ACPI_POWERRES", ACPI_POWERRES},
{"ACPI_PROCESSOR", ACPI_PROCESSOR},
+ {"ACPI_SPMC", ACPI_SPMC},
{"ACPI_THERMAL", ACPI_THERMAL},
{"ACPI_TIMER", ACPI_TIMER},
{"ACPI_ALL_DRIVERS", ACPI_ALL_DRIVERS},
@@ -4905,6 +4943,65 @@ acpi_reset_interfaces(device_t dev)
}
acpi_free_interfaces(&list);
}
+
+ /*
+ * Apple Mac hardware quirk: install Darwin OSI.
+ *
+ * On Apple hardware, install the Darwin OSI and remove the Windows OSI
+ * to match Linux behavior.
+ *
+ * This is required for dual-GPU MacBook Pro systems
+ * (Intel iGPU + AMD/NVIDIA dGPU) where the iGPU is hidden when the
+ * firmware doesn't see Darwin OSI, but it also unlocks additional ACPI
+ * support on non-MacBook Pro Apple platforms.
+ *
+ * Apple's ACPI firmware checks _OSI("Darwin") and sets OSYS=10000
+ * for macOS. Many device methods use OSDW() which checks OSYS==10000
+ * for macOS-specific behavior including GPU visibility and power
+ * management.
+ *
+ * Linux enables Darwin OSI by default on Apple hardware and disables
+ * all Windows OSI strings (drivers/acpi/osi.c). Users can override
+ * this behavior with acpi_osi=!Darwin to get Windows-like behavior,
+ * in general, but this logic makes that process unnecessary.
+ *
+ * Detect Apple via SMBIOS and enable Darwin while disabling Windows
+ * vendor strings. This makes both GPUs visible on dual-GPU MacBook Pro
+ * systems (Intel iGPU + AMD dGPU) and unlocks full platform
+ * ACPI support.
+ */
+ if (acpi_apple_darwin_osi) {
+ char *vendor = kern_getenv("smbios.system.maker");
+ if (vendor != NULL) {
+ if (strcmp(vendor, "Apple Inc.") == 0 ||
+ strcmp(vendor, "Apple Computer, Inc.") == 0) {
+ /* Disable all other OSI vendor strings. */
+ status = AcpiUpdateInterfaces(
+ ACPI_DISABLE_ALL_VENDOR_STRINGS);
+ if (ACPI_SUCCESS(status)) {
+ /* Install Darwin OSI */
+ status = AcpiInstallInterface("Darwin");
+ }
+ if (bootverbose) {
+ if (ACPI_SUCCESS(status)) {
+ device_printf(dev,
+ "disabled non-Darwin OSI & "
+ "installed Darwin OSI\n");
+ } else {
+ device_printf(dev,
+ "could not install "
+ "Darwin OSI: %s\n",
+ AcpiFormatException(status));
+ }
+ }
+ } else if (bootverbose) {
+ device_printf(dev,
+ "Not installing Darwin OSI on unsupported platform: %s\n",
+ vendor);
+ }
+ freeenv(vendor);
+ }
+ }
}
static int
diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
new file mode 100644
index 000000000000..e8ed14fdcb1b
--- /dev/null
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -0,0 +1,638 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2024-2025 The FreeBSD Foundation
+ *
+ * This software was developed by Aymeric Wibo <obiwac@freebsd.org>
+ * under sponsorship from the FreeBSD Foundation.
+ */
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/eventhandler.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/uuid.h>
+
+#include <machine/_inttypes.h>
+
+#include <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/accommon.h>
+
+#include <dev/acpica/acpivar.h>
+
+/* Hooks for the ACPI CA debugging infrastructure */
+#define _COMPONENT ACPI_SPMC
+ACPI_MODULE_NAME("SPMC")
+
+static SYSCTL_NODE(_debug_acpi, OID_AUTO, spmc, CTLFLAG_RD | CTLFLAG_MPSAFE,
+ NULL, "SPMC debugging");
+
+static char *spmc_ids[] = {
+ "PNP0D80",
+ NULL
+};
+
+enum intel_dsm_index {
+ DSM_ENUM_FUNCTIONS = 0,
+ DSM_GET_DEVICE_CONSTRAINTS = 1,
+ DSM_GET_CRASH_DUMP_DEVICE = 2,
+ DSM_DISPLAY_OFF_NOTIF = 3,
+ DSM_DISPLAY_ON_NOTIF = 4,
+ DSM_ENTRY_NOTIF = 5,
+ DSM_EXIT_NOTIF = 6,
+ /* Only for Microsoft DSM set. */
+ DSM_MODERN_ENTRY_NOTIF = 7,
+ DSM_MODERN_EXIT_NOTIF = 8,
+};
+
+enum amd_dsm_index {
+ AMD_DSM_ENUM_FUNCTIONS = 0,
+ AMD_DSM_GET_DEVICE_CONSTRAINTS = 1,
+ AMD_DSM_ENTRY_NOTIF = 2,
+ AMD_DSM_EXIT_NOTIF = 3,
+ AMD_DSM_DISPLAY_OFF_NOTIF = 4,
+ AMD_DSM_DISPLAY_ON_NOTIF = 5,
+};
+
+enum dsm_set_flags {
+ DSM_SET_INTEL = 1 << 0,
+ DSM_SET_MS = 1 << 1,
+ DSM_SET_AMD = 1 << 2,
+};
+
+struct dsm_set {
+ enum dsm_set_flags flag;
+ const char *name;
+ int revision;
+ struct uuid uuid;
+ uint64_t dsms_expected;
+};
+
+static struct dsm_set intel_dsm_set = {
+ .flag = DSM_SET_INTEL,
+ .name = "Intel",
+ /*
+ * XXX Linux uses 1 for the revision on Intel DSMs, but doesn't explain
+ * why. The commit that introduces this links to a document mentioning
+ * revision 0, so default this to 0.
+ *
+ * The debug.acpi.spmc.intel_dsm_revision sysctl may be used to configure
+ * this just in case.
+ */
+ .revision = 0,
+ .uuid = { /* c4eb40a0-6cd2-11e2-bcfd-0800200c9a66 */
+ 0xc4eb40a0, 0x6cd2, 0x11e2, 0xbc, 0xfd,
+ {0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66},
+ },
+ .dsms_expected = DSM_GET_DEVICE_CONSTRAINTS | DSM_DISPLAY_OFF_NOTIF |
+ DSM_DISPLAY_ON_NOTIF | DSM_ENTRY_NOTIF | DSM_EXIT_NOTIF,
+};
+
+SYSCTL_INT(_debug_acpi_spmc, OID_AUTO, intel_dsm_revision, CTLFLAG_RW,
+ &intel_dsm_set.revision, 0,
+ "Revision to use when evaluating Intel SPMC DSMs");
+
+static struct dsm_set ms_dsm_set = {
+ .flag = DSM_SET_MS,
+ .name = "Microsoft",
+ .revision = 0,
+ .uuid = { /* 11e00d56-ce64-47ce-837b-1f898f9aa461 */
+ 0x11e00d56, 0xce64, 0x47ce, 0x83, 0x7b,
+ {0x1f, 0x89, 0x8f, 0x9a, 0xa4, 0x61},
+ },
+ .dsms_expected = DSM_DISPLAY_OFF_NOTIF | DSM_DISPLAY_ON_NOTIF |
+ DSM_ENTRY_NOTIF | DSM_EXIT_NOTIF | DSM_MODERN_ENTRY_NOTIF |
+ DSM_MODERN_EXIT_NOTIF,
+};
+
+static struct dsm_set amd_dsm_set = {
+ .flag = DSM_SET_AMD,
+ .name = "AMD",
+ /*
+ * XXX Linux uses 0 for the revision on AMD DSMs, but at least on the
+ * Framework 13 AMD 7040 series, the enum functions DSM only returns a
+ * function mask that covers all the DSMs we need to call when called
+ * with revision 2.
+ *
+ * The debug.acpi.spmc.amd_dsm_revision sysctl may be used to configure
+ * this just in case.
+ */
+ .revision = 2,
+ .uuid = { /* e3f32452-febc-43ce-9039-932122d37721 */
+ 0xe3f32452, 0xfebc, 0x43ce, 0x90, 0x39,
+ {0x93, 0x21, 0x22, 0xd3, 0x77, 0x21},
+ },
+ .dsms_expected = AMD_DSM_GET_DEVICE_CONSTRAINTS | AMD_DSM_ENTRY_NOTIF |
+ AMD_DSM_EXIT_NOTIF | AMD_DSM_DISPLAY_OFF_NOTIF |
+ AMD_DSM_DISPLAY_ON_NOTIF,
+};
+
+SYSCTL_INT(_debug_acpi_spmc, OID_AUTO, amd_dsm_revision, CTLFLAG_RW,
+ &amd_dsm_set.revision, 0, "Revision to use when evaluating AMD SPMC DSMs");
+
+union dsm_index {
+ int i;
+ enum intel_dsm_index regular;
+ enum amd_dsm_index amd;
+};
+
+struct acpi_spmc_constraint {
+ bool enabled;
+ char *name;
+ int min_d_state;
+ ACPI_HANDLE handle;
+
+ /* Unused, spec only. */
+ uint64_t lpi_uid;
+ uint64_t min_dev_specific_state;
+
+ /* Unused, AMD only. */
+ uint64_t function_states;
+};
+
+struct acpi_spmc_softc {
+ device_t dev;
+ ACPI_HANDLE handle;
+ ACPI_OBJECT *obj;
+ enum dsm_set_flags dsm_sets;
+
+ struct eventhandler_entry *eh_suspend;
+ struct eventhandler_entry *eh_resume;
+
+ bool constraints_populated;
+ size_t constraint_count;
+ struct acpi_spmc_constraint *constraints;
+};
+
+static void acpi_spmc_check_dsm_set(struct acpi_spmc_softc *sc,
+ ACPI_HANDLE handle, struct dsm_set *dsm_set);
+static int acpi_spmc_get_constraints(device_t dev);
+static void acpi_spmc_free_constraints(struct acpi_spmc_softc *sc);
+
+static void acpi_spmc_suspend(device_t dev, enum power_stype stype);
+static void acpi_spmc_resume(device_t dev, enum power_stype stype);
+
+static int
+acpi_spmc_probe(device_t dev)
+{
+ char *name;
+ ACPI_HANDLE handle;
+ struct acpi_spmc_softc *sc;
+
+ /* Check that this is an enabled device. */
+ if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("spmc"))
+ return (ENXIO);
+
+ if (ACPI_ID_PROBE(device_get_parent(dev), dev, spmc_ids, &name) > 0)
+ return (ENXIO);
+
+ handle = acpi_get_handle(dev);
+ if (handle == NULL)
+ return (ENXIO);
+
+ sc = device_get_softc(dev);
+
+ /* Check which sets of DSM's are supported. */
+ sc->dsm_sets = 0;
+
+ acpi_spmc_check_dsm_set(sc, handle, &intel_dsm_set);
+ acpi_spmc_check_dsm_set(sc, handle, &ms_dsm_set);
+ acpi_spmc_check_dsm_set(sc, handle, &amd_dsm_set);
+
+ if (sc->dsm_sets == 0)
+ return (ENXIO);
+
+ device_set_descf(dev, "Low Power S0 Idle (DSM sets 0x%x)",
+ sc->dsm_sets);
+
+ return (0);
+}
+
+static int
+acpi_spmc_attach(device_t dev)
+{
+ struct acpi_spmc_softc *sc = device_get_softc(dev);
+
+ sc->dev = dev;
+
+ sc->handle = acpi_get_handle(dev);
+ if (sc->handle == NULL)
+ return (ENXIO);
+
+ sc->constraints_populated = false;
+ sc->constraint_count = 0;
+ sc->constraints = NULL;
+
+ /* Get device constraints. We can only call this once so do this now. */
+ acpi_spmc_get_constraints(dev);
+
+ sc->eh_suspend = EVENTHANDLER_REGISTER(acpi_post_dev_suspend,
+ acpi_spmc_suspend, dev, 0);
+ sc->eh_resume = EVENTHANDLER_REGISTER(acpi_pre_dev_resume,
+ acpi_spmc_resume, dev, 0);
+
+ return (0);
+}
+
+static int
+acpi_spmc_detach(device_t dev)
+{
+ struct acpi_spmc_softc *sc = device_get_softc(dev);
+
+ EVENTHANDLER_DEREGISTER(acpi_post_dev_suspend, sc->eh_suspend);
+ EVENTHANDLER_DEREGISTER(acpi_pre_dev_resume, sc->eh_resume);
+
+ acpi_spmc_free_constraints(device_get_softc(dev));
+ return (0);
+}
+
+static void
+acpi_spmc_check_dsm_set(struct acpi_spmc_softc *sc, ACPI_HANDLE handle,
+ struct dsm_set *dsm_set)
+{
+ const uint64_t dsms_supported = acpi_DSMQuery(handle,
+ (uint8_t *)&dsm_set->uuid, dsm_set->revision);
+
+ /*
+ * Check if DSM set supported at all. We do this by checking the
+ * existence of "enum functions".
+ */
+ if ((dsms_supported & 1) == 0)
+ return;
+ if ((dsms_supported & dsm_set->dsms_expected)
+ != dsm_set->dsms_expected) {
+ device_printf(sc->dev, "DSM set %s does not support expected "
+ "DSMs (%#" PRIx64 " vs %#" PRIx64 "). "
+ "Some methods may fail.\n",
+ dsm_set->name, dsms_supported, dsm_set->dsms_expected);
+ }
+ sc->dsm_sets |= dsm_set->flag;
+}
+
+static void
+acpi_spmc_free_constraints(struct acpi_spmc_softc *sc)
+{
+ if (sc->constraints == NULL)
+ return;
+
+ for (size_t i = 0; i < sc->constraint_count; i++) {
+ if (sc->constraints[i].name != NULL)
+ free(sc->constraints[i].name, M_TEMP);
+ }
+
+ free(sc->constraints, M_TEMP);
+ sc->constraints = NULL;
+}
+
+static int
+acpi_spmc_get_constraints_spec(struct acpi_spmc_softc *sc, ACPI_OBJECT *object)
+{
+ struct acpi_spmc_constraint *constraint;
+ int revision;
+ ACPI_OBJECT *constraint_obj;
+ ACPI_OBJECT *name_obj;
+ ACPI_OBJECT *detail;
+ ACPI_OBJECT *constraint_package;
+
+ KASSERT(sc->constraints_populated == false,
+ ("constraints already populated"));
+
+ sc->constraint_count = object->Package.Count;
+ sc->constraints = malloc(sc->constraint_count * sizeof *sc->constraints,
+ M_TEMP, M_WAITOK | M_ZERO);
+
+ /*
+ * The value of sc->constraint_count can change during the loop, so
+ * iterate until object->Package.Count so we actually go over all
+ * elements in the package.
+ */
+ for (size_t i = 0; i < object->Package.Count; i++) {
+ constraint_obj = &object->Package.Elements[i];
+ constraint = &sc->constraints[i];
+
+ constraint->enabled =
+ constraint_obj->Package.Elements[1].Integer.Value;
+
+ name_obj = &constraint_obj->Package.Elements[0];
+ constraint->name = strdup(name_obj->String.Pointer, M_TEMP);
+ if (constraint->name == NULL) {
+ acpi_spmc_free_constraints(sc);
+ return (ENOMEM);
+ }
+
+ /*
+ * The first element in the device constraint detail package is
+ * the revision, and should always be zero.
+ */
+ revision = constraint_obj->Package.Elements[0].Integer.Value;
+ if (revision != 0) {
+ device_printf(sc->dev, "Unknown revision %d for "
+ "device constraint detail package\n", revision);
+ sc->constraint_count--;
+ continue;
+ }
+
+ detail = &constraint_obj->Package.Elements[2];
+ constraint_package = &detail->Package.Elements[1];
+
+ constraint->lpi_uid =
+ constraint_package->Package.Elements[0].Integer.Value;
+ constraint->min_d_state =
+ constraint_package->Package.Elements[1].Integer.Value;
+ constraint->min_dev_specific_state =
+ constraint_package->Package.Elements[2].Integer.Value;
+ }
+
+ sc->constraints_populated = true;
+ return (0);
+}
+
+static int
+acpi_spmc_get_constraints_amd(struct acpi_spmc_softc *sc, ACPI_OBJECT *object)
+{
+ size_t constraint_count;
+ ACPI_OBJECT *constraint_obj;
+ ACPI_OBJECT *constraints;
+ struct acpi_spmc_constraint *constraint;
+ ACPI_OBJECT *name_obj;
+
+ KASSERT(sc->constraints_populated == false,
+ ("constraints already populated"));
+
+ /*
+ * First element in the package is unknown.
+ * Second element is the number of device constraints.
+ * Third element is the list of device constraints itself.
+ */
+ constraint_count = object->Package.Elements[1].Integer.Value;
+ constraints = &object->Package.Elements[2];
+
+ if (constraints->Package.Count != constraint_count) {
+ device_printf(sc->dev, "constraint count mismatch (%d to %zu)\n",
+ constraints->Package.Count, constraint_count);
+ return (ENXIO);
+ }
+
+ sc->constraint_count = constraint_count;
+ sc->constraints = malloc(constraint_count * sizeof *sc->constraints,
+ M_TEMP, M_WAITOK | M_ZERO);
+
+ for (size_t i = 0; i < constraint_count; i++) {
+ /* Parse the constraint package. */
+ constraint_obj = &constraints->Package.Elements[i];
+ if (constraint_obj->Package.Count != 4) {
+ device_printf(sc->dev, "constraint %zu has %d elements\n",
+ i, constraint_obj->Package.Count);
+ acpi_spmc_free_constraints(sc);
+ return (ENXIO);
+ }
+
+ constraint = &sc->constraints[i];
+ constraint->enabled =
+ constraint_obj->Package.Elements[0].Integer.Value;
+
+ name_obj = &constraint_obj->Package.Elements[1];
+ constraint->name = strdup(name_obj->String.Pointer, M_TEMP);
+ if (constraint->name == NULL) {
+ acpi_spmc_free_constraints(sc);
+ return (ENOMEM);
+ }
+
+ constraint->function_states =
+ constraint_obj->Package.Elements[2].Integer.Value;
+ constraint->min_d_state =
+ constraint_obj->Package.Elements[3].Integer.Value;
+ }
+
+ sc->constraints_populated = true;
+ return (0);
+}
+
+static int
+acpi_spmc_get_constraints(device_t dev)
+{
+ struct acpi_spmc_softc *sc;
+ union dsm_index dsm_index;
+ struct dsm_set *dsm_set;
+ ACPI_STATUS status;
+ ACPI_BUFFER result;
+ ACPI_OBJECT *object;
+ bool is_amd;
+ int rv;
+ struct acpi_spmc_constraint *constraint;
+
+ sc = device_get_softc(dev);
+ if (sc->constraints_populated)
+ return (0);
+
+ /* The Microsoft DSM set doesn't have this DSM. */
+ is_amd = (sc->dsm_sets & DSM_SET_AMD) != 0;
+ if (is_amd) {
+ dsm_set = &amd_dsm_set;
+ dsm_index.amd = AMD_DSM_GET_DEVICE_CONSTRAINTS;
+ } else {
+ dsm_set = &intel_dsm_set;
+ dsm_index.regular = DSM_GET_DEVICE_CONSTRAINTS;
+ }
+
+ /* XXX It seems like this DSM fails if called more than once. */
+ status = acpi_EvaluateDSMTyped(sc->handle, (uint8_t *)&dsm_set->uuid,
+ dsm_set->revision, dsm_index.i, NULL, &result,
+ ACPI_TYPE_PACKAGE);
+ if (ACPI_FAILURE(status)) {
+ device_printf(dev, "%s failed to call %s DSM %d (rev %d)\n",
+ __func__, dsm_set->name, dsm_index.i, dsm_set->revision);
+ return (ENXIO);
+ }
+
+ object = (ACPI_OBJECT *)result.Pointer;
+ if (is_amd)
+ rv = acpi_spmc_get_constraints_amd(sc, object);
+ else
+ rv = acpi_spmc_get_constraints_spec(sc, object);
+ AcpiOsFree(object);
+ if (rv != 0)
+ return (rv);
+
+ /* Get handles for each constraint device. */
+ for (size_t i = 0; i < sc->constraint_count; i++) {
+ constraint = &sc->constraints[i];
+
+ status = acpi_GetHandleInScope(sc->handle,
+ __DECONST(char *, constraint->name), &constraint->handle);
+ if (ACPI_FAILURE(status)) {
+ device_printf(dev, "failed to get handle for %s\n",
+ constraint->name);
+ constraint->handle = NULL;
+ }
+ }
+ return (0);
+}
+
+static void
+acpi_spmc_check_constraints(struct acpi_spmc_softc *sc)
+{
+ bool violation = false;
+
+ KASSERT(sc->constraints_populated, ("constraints not populated"));
+ for (size_t i = 0; i < sc->constraint_count; i++) {
+ struct acpi_spmc_constraint *constraint = &sc->constraints[i];
+
+ if (!constraint->enabled)
+ continue;
+ if (constraint->handle == NULL)
+ continue;
+
+ ACPI_STATUS status = acpi_GetHandleInScope(sc->handle,
+ __DECONST(char *, constraint->name), &constraint->handle);
+ if (ACPI_FAILURE(status)) {
+ device_printf(sc->dev, "failed to get handle for %s\n",
+ constraint->name);
+ constraint->handle = NULL;
+ }
+ if (constraint->handle == NULL)
+ continue;
+
+#ifdef notyet
+ int d_state;
+ if (ACPI_FAILURE(acpi_pwr_get_state(constraint->handle, &d_state)))
+ continue;
+ if (d_state < constraint->min_d_state) {
+ device_printf(sc->dev, "constraint for device %s"
+ " violated (minimum D-state required was %s, actual"
+ " D-state is %s), might fail to enter LPI state\n",
+ constraint->name,
+ acpi_d_state_to_str(constraint->min_d_state),
+ acpi_d_state_to_str(d_state));
+ violation = true;
+ }
+#endif
+ }
+ if (!violation)
+ device_printf(sc->dev,
+ "all device power constraints respected!\n");
+}
+
+static void
+acpi_spmc_run_dsm(device_t dev, struct dsm_set *dsm_set, int index)
+{
+ struct acpi_spmc_softc *sc;
+ ACPI_STATUS status;
+ ACPI_BUFFER result;
+
+ sc = device_get_softc(dev);
+
+ status = acpi_EvaluateDSMTyped(sc->handle, (uint8_t *)&dsm_set->uuid,
+ dsm_set->revision, index, NULL, &result, ACPI_TYPE_ANY);
+
+ if (ACPI_FAILURE(status)) {
+ device_printf(dev, "%s failed to call %s DSM %d (rev %d)\n",
+ __func__, dsm_set->name, index, dsm_set->revision);
+ return;
+ }
+
+ AcpiOsFree(result.Pointer);
+}
+
+/*
+ * Try running the DSMs from all the DSM sets we have, as them failing costs us
+ * nothing, and it seems like on AMD platforms, both the AMD entry and Microsoft
+ * "modern" DSM's are required for it to enter modern standby.
+ *
+ * This is what Linux does too.
+ */
+static void
+acpi_spmc_display_off_notif(device_t dev)
+{
+ struct acpi_spmc_softc *sc = device_get_softc(dev);
+
+ if ((sc->dsm_sets & DSM_SET_INTEL) != 0)
+ acpi_spmc_run_dsm(dev, &intel_dsm_set, DSM_DISPLAY_OFF_NOTIF);
+ if ((sc->dsm_sets & DSM_SET_MS) != 0)
+ acpi_spmc_run_dsm(dev, &ms_dsm_set, DSM_DISPLAY_OFF_NOTIF);
+ if ((sc->dsm_sets & DSM_SET_AMD) != 0)
+ acpi_spmc_run_dsm(dev, &amd_dsm_set, AMD_DSM_DISPLAY_OFF_NOTIF);
+}
+
+static void
+acpi_spmc_display_on_notif(device_t dev)
+{
+ struct acpi_spmc_softc *sc = device_get_softc(dev);
+
+ if ((sc->dsm_sets & DSM_SET_INTEL) != 0)
+ acpi_spmc_run_dsm(dev, &intel_dsm_set, DSM_DISPLAY_ON_NOTIF);
+ if ((sc->dsm_sets & DSM_SET_MS) != 0)
+ acpi_spmc_run_dsm(dev, &ms_dsm_set, DSM_DISPLAY_ON_NOTIF);
+ if ((sc->dsm_sets & DSM_SET_AMD) != 0)
+ acpi_spmc_run_dsm(dev, &amd_dsm_set, AMD_DSM_DISPLAY_ON_NOTIF);
+}
+
+static void
+acpi_spmc_entry_notif(device_t dev)
+{
+ struct acpi_spmc_softc *sc = device_get_softc(dev);
+
+ acpi_spmc_check_constraints(sc);
+
+ if ((sc->dsm_sets & DSM_SET_AMD) != 0)
+ acpi_spmc_run_dsm(dev, &amd_dsm_set, AMD_DSM_ENTRY_NOTIF);
+ if ((sc->dsm_sets & DSM_SET_MS) != 0) {
+ acpi_spmc_run_dsm(dev, &ms_dsm_set, DSM_MODERN_ENTRY_NOTIF);
+ acpi_spmc_run_dsm(dev, &ms_dsm_set, DSM_ENTRY_NOTIF);
+ }
+ if ((sc->dsm_sets & DSM_SET_INTEL) != 0)
+ acpi_spmc_run_dsm(dev, &intel_dsm_set, DSM_ENTRY_NOTIF);
+}
+
+static void
+acpi_spmc_exit_notif(device_t dev)
+{
+ struct acpi_spmc_softc *sc = device_get_softc(dev);
+
+ if ((sc->dsm_sets & DSM_SET_INTEL) != 0)
+ acpi_spmc_run_dsm(dev, &intel_dsm_set, DSM_EXIT_NOTIF);
+ if ((sc->dsm_sets & DSM_SET_AMD) != 0)
+ acpi_spmc_run_dsm(dev, &amd_dsm_set, AMD_DSM_EXIT_NOTIF);
+ if ((sc->dsm_sets & DSM_SET_MS) != 0) {
+ acpi_spmc_run_dsm(dev, &ms_dsm_set, DSM_EXIT_NOTIF);
+ acpi_spmc_run_dsm(dev, &ms_dsm_set, DSM_MODERN_EXIT_NOTIF);
+ }
+}
+
+static void
+acpi_spmc_suspend(device_t dev, enum power_stype stype)
+{
+ if (stype != POWER_STYPE_SUSPEND_TO_IDLE)
+ return;
+
+ acpi_spmc_display_off_notif(dev);
+ acpi_spmc_entry_notif(dev);
+}
+
+static void
+acpi_spmc_resume(device_t dev, enum power_stype stype)
+{
+ if (stype != POWER_STYPE_SUSPEND_TO_IDLE)
+ return;
+
+ acpi_spmc_exit_notif(dev);
+ acpi_spmc_display_on_notif(dev);
+}
+
+static device_method_t acpi_spmc_methods[] = {
+ DEVMETHOD(device_probe, acpi_spmc_probe),
+ DEVMETHOD(device_attach, acpi_spmc_attach),
+ DEVMETHOD(device_detach, acpi_spmc_detach),
+ DEVMETHOD_END
+};
+
+static driver_t acpi_spmc_driver = {
+ "acpi_spmc",
+ acpi_spmc_methods,
+ sizeof(struct acpi_spmc_softc),
+};
+
+DRIVER_MODULE_ORDERED(acpi_spmc, acpi, acpi_spmc_driver, NULL, NULL, SI_ORDER_ANY);
+MODULE_DEPEND(acpi_spmc, acpi, 1, 1, 1);
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 6db55b10570d..d585fc8f2e23 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -64,7 +64,8 @@ struct acpi_softc {
enum power_stype acpi_lid_switch_stype;
int acpi_standby_sx;
- int acpi_s4bios;
+ bool acpi_s4bios;
+ bool acpi_s4bios_supported;
int acpi_sleep_delay;
int acpi_do_disable;
@@ -191,6 +192,7 @@ extern struct mtx acpi_mutex;
#define ACPI_THERMAL 0x01000000
#define ACPI_TIMER 0x02000000
#define ACPI_OEM 0x04000000
+#define ACPI_SPMC 0x08000000
/*
* Constants for different interrupt models used with acpi_SetIntrModel().
@@ -481,12 +483,14 @@ UINT32 acpi_event_sleep_button_wake(void *context);
#define ACPI_EVENT_PRI_DEFAULT 10000
#define ACPI_EVENT_PRI_LAST 20000
-typedef void (*acpi_event_handler_t)(void *, int);
+typedef void (*acpi_event_handler_t)(void *, enum power_stype);
EVENTHANDLER_DECLARE(acpi_sleep_event, acpi_event_handler_t);
EVENTHANDLER_DECLARE(acpi_wakeup_event, acpi_event_handler_t);
EVENTHANDLER_DECLARE(acpi_acad_event, acpi_event_handler_t);
EVENTHANDLER_DECLARE(acpi_video_event, acpi_event_handler_t);
+EVENTHANDLER_DECLARE(acpi_post_dev_suspend, acpi_event_handler_t);
+EVENTHANDLER_DECLARE(acpi_pre_dev_resume, acpi_event_handler_t);
/* Device power control. */
ACPI_STATUS acpi_pwr_wake_enable(ACPI_HANDLE consumer, int enable);
@@ -527,6 +531,13 @@ acpi_d_state_to_str(int state)
return (strs[state]);
}
+static __inline bool
+acpi_should_do_s4bios(struct acpi_softc *sc)
+{
+ MPASS(!sc->acpi_s4bios || sc->acpi_s4bios_supported);
+ return (sc->acpi_s4bios);
+}
+
char *acpi_name(ACPI_HANDLE handle);
int acpi_avoid(ACPI_HANDLE handle);
int acpi_disabled(char *subsys);
diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c
index 2b4cb37275a6..ed1b734f70be 100644
--- a/sys/dev/ahci/ahci_pci.c
+++ b/sys/dev/ahci/ahci_pci.c
@@ -523,7 +523,8 @@ ahci_pci_attach(device_t dev)
* here, or the user has to change the mode in the BIOS
* from RST to AHCI.
*/
- if (pci_get_vendor(dev) == 0x8086) {
+ if (pci_get_vendor(dev) == 0x8086 &&
+ rman_get_size(ctlr->r_mem) >= 512 * 1024) {
uint32_t vscap;
vscap = ATA_INL(ctlr->r_mem, AHCI_VSCAP);
diff --git a/sys/dev/aic7xxx/ahc_pci.c b/sys/dev/aic7xxx/ahc_pci.c
index 8109a6714814..7f8fbe140237 100644
--- a/sys/dev/aic7xxx/ahc_pci.c
+++ b/sys/dev/aic7xxx/ahc_pci.c
@@ -105,7 +105,7 @@ ahc_pci_attach(device_t dev)
error = aic_dma_tag_create(ahc, /*parent*/bus_get_dma_tag(dev),
/*alignment*/1, /*boundary*/0,
(ahc->flags & AHC_39BIT_ADDRESSING)
- ? 0x7FFFFFFFFFLL
+ ? (bus_addr_t)0x7FFFFFFFFFLL
: BUS_SPACE_MAXADDR_32BIT,
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
index 5b2a901328d3..b6b98b1c8953 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -110,8 +110,8 @@ static int asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS);
static int asmc_mbp_sysctl_light_left_10byte(SYSCTL_HANDLER_ARGS);
struct asmc_model {
- const char *smc_model; /* smbios.system.product env var. */
- const char *smc_desc; /* driver description */
+ const char *smc_model; /* smbios.system.product env var. */
+ const char *smc_desc; /* driver description */
/* Helper functions */
int (*smc_sms_x)(SYSCTL_HANDLER_ARGS);
@@ -137,7 +137,7 @@ static const struct asmc_model *asmc_match(device_t dev);
#define ASMC_SMS_FUNCS asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \
asmc_mb_sysctl_sms_z
-#define ASMC_SMS_FUNCS_DISABLED NULL,NULL,NULL
+#define ASMC_SMS_FUNCS_DISABLED NULL, NULL, NULL
#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \
asmc_mb_sysctl_fanminspeed, \
@@ -163,19 +163,19 @@ static const struct asmc_model *asmc_match(device_t dev);
static const struct asmc_model asmc_models[] = {
{
"MacBook1,1", "Apple SMC MacBook Core Duo",
- ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+ ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS
},
{
"MacBook2,1", "Apple SMC MacBook Core 2 Duo",
- ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+ ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS
},
{
"MacBook3,1", "Apple SMC MacBook Core 2 Duo",
- ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+ ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MB31_TEMPS, ASMC_MB31_TEMPNAMES, ASMC_MB31_TEMPDESCS
},
@@ -297,9 +297,9 @@ static const struct asmc_model asmc_models[] = {
/* The Mac Mini has no SMS */
{
"Macmini1,1", "Apple SMC Mac Mini",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM_TEMPS, ASMC_MM_TEMPNAMES, ASMC_MM_TEMPDESCS
},
@@ -315,9 +315,9 @@ static const struct asmc_model asmc_models[] = {
/* The Mac Mini 3,1 has no SMS */
{
"Macmini3,1", "Apple SMC Mac Mini 3,1",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM31_TEMPS, ASMC_MM31_TEMPNAMES, ASMC_MM31_TEMPDESCS
},
@@ -334,18 +334,18 @@ static const struct asmc_model asmc_models[] = {
/* - same sensors as Mac Mini 5,2 */
{
"Macmini5,1", "Apple SMC Mac Mini 5,1",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS2,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS
},
/* The Mac Mini 5,2 has no SMS */
{
"Macmini5,2", "Apple SMC Mac Mini 5,2",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS2,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS
},
@@ -353,63 +353,63 @@ static const struct asmc_model asmc_models[] = {
/* - same sensors as Mac Mini 5,2 */
{
"Macmini5,3", "Apple SMC Mac Mini 5,3",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS2,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS
},
/* The Mac Mini 6,1 has no SMS */
{
"Macmini6,1", "Apple SMC Mac Mini 6,1",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS2,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM61_TEMPS, ASMC_MM61_TEMPNAMES, ASMC_MM61_TEMPDESCS
},
/* The Mac Mini 6,2 has no SMS */
{
"Macmini6,2", "Apple SMC Mac Mini 6,2",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS2,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM62_TEMPS, ASMC_MM62_TEMPNAMES, ASMC_MM62_TEMPDESCS
},
/* The Mac Mini 7,1 has no SMS */
{
"Macmini7,1", "Apple SMC Mac Mini 7,1",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS2,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MM71_TEMPS, ASMC_MM71_TEMPNAMES, ASMC_MM71_TEMPDESCS
},
/* Idem for the Mac Pro "Quad Core" (original) */
{
"MacPro1,1", "Apple SMC Mac Pro (Quad Core)",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MP1_TEMPS, ASMC_MP1_TEMPNAMES, ASMC_MP1_TEMPDESCS
},
/* Idem for the Mac Pro (8-core) */
{
"MacPro2", "Apple SMC Mac Pro (8-core)",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MP2_TEMPS, ASMC_MP2_TEMPNAMES, ASMC_MP2_TEMPDESCS
},
/* Idem for the MacPro 2010*/
{
"MacPro5,1", "Apple SMC MacPro (2010)",
- NULL, NULL, NULL,
+ ASMC_SMS_FUNCS_DISABLED,
ASMC_FAN_FUNCS,
- NULL, NULL, NULL,
+ ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MP5_TEMPS, ASMC_MP5_TEMPNAMES, ASMC_MP5_TEMPDESCS
},
@@ -424,20 +424,20 @@ static const struct asmc_model asmc_models[] = {
{
"MacBookAir1,1", "Apple SMC MacBook Air",
- ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+ ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MBA_TEMPS, ASMC_MBA_TEMPNAMES, ASMC_MBA_TEMPDESCS
},
{
"MacBookAir3,1", "Apple SMC MacBook Air Core 2 Duo (Late 2010)",
- ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+ ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS_DISABLED,
ASMC_MBA3_TEMPS, ASMC_MBA3_TEMPNAMES, ASMC_MBA3_TEMPDESCS
},
{
"MacBookAir4,1", "Apple SMC Macbook Air 11-inch (Mid 2011)",
ASMC_SMS_FUNCS_DISABLED,
- ASMC_FAN_FUNCS2,
+ ASMC_FAN_FUNCS2,
ASMC_LIGHT_FUNCS,
ASMC_MBA4_TEMPS, ASMC_MBA4_TEMPNAMES, ASMC_MBA4_TEMPDESCS
},
@@ -445,7 +445,7 @@ static const struct asmc_model asmc_models[] = {
{
"MacBookAir4,2", "Apple SMC Macbook Air 13-inch (Mid 2011)",
ASMC_SMS_FUNCS_DISABLED,
- ASMC_FAN_FUNCS2,
+ ASMC_FAN_FUNCS2,
ASMC_LIGHT_FUNCS,
ASMC_MBA4_TEMPS, ASMC_MBA4_TEMPNAMES, ASMC_MBA4_TEMPDESCS
},
@@ -599,7 +599,7 @@ asmc_attach(device_t dev)
return (ENOMEM);
}
- sysctlctx = device_get_sysctl_ctx(dev);
+ sysctlctx = device_get_sysctl_ctx(dev);
sysctlnode = device_get_sysctl_tree(dev);
model = asmc_match(dev);
@@ -774,8 +774,8 @@ asmc_attach(device_t dev)
* Allocate an IRQ for the SMS.
*/
sc->sc_rid_irq = 0;
- sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
- &sc->sc_rid_irq, RF_ACTIVE);
+ sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_rid_irq,
+ RF_ACTIVE);
if (sc->sc_irq == NULL) {
device_printf(dev, "unable to allocate IRQ resource\n");
ret = ENXIO;
@@ -830,15 +830,18 @@ asmc_detach(device_t dev)
static int
asmc_resume(device_t dev)
{
- uint8_t buf[2];
- buf[0] = light_control;
- buf[1] = 0x00;
- asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
- return (0);
+ uint8_t buf[2];
+
+ buf[0] = light_control;
+ buf[1] = 0x00;
+ asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
+
+ return (0);
}
#ifdef ASMC_DEBUG
-void asmc_dumpall(device_t dev)
+void
+asmc_dumpall(device_t dev)
{
struct asmc_softc *sc = device_get_softc(dev);
int i;
@@ -943,7 +946,8 @@ nosms:
if (asmc_key_read(dev, ASMC_NKEYS, buf, 4) == 0) {
sc->sc_nkeys = be32dec(buf);
if (bootverbose)
- device_printf(dev, "number of keys: %d\n", sc->sc_nkeys);
+ device_printf(dev, "number of keys: %d\n",
+ sc->sc_nkeys);
} else {
sc->sc_nkeys = 0;
}
@@ -1007,11 +1011,12 @@ asmc_wait(device_t dev, uint8_t val)
* the acknowledgement fails.
*/
static int
-asmc_command(device_t dev, uint8_t command) {
+asmc_command(device_t dev, uint8_t command)
+{
int i;
struct asmc_softc *sc = device_get_softc(dev);
- for (i=0; i < 10; i++) {
+ for (i = 0; i < 10; i++) {
ASMC_CMDPORT_WRITE(sc, command);
if (asmc_wait_ack(dev, 0x0c, 100) == 0) {
return (0);
@@ -1054,9 +1059,10 @@ begin:
error = 0;
out:
if (error) {
- if (++try < 10) goto begin;
- device_printf(dev,"%s for key %s failed %d times, giving up\n",
- __func__, key, try);
+ if (++try < 10)
+ goto begin;
+ device_printf(dev, "%s for key %s failed %d times, giving up\n",
+ __func__, key, try);
}
mtx_unlock_spin(&sc->sc_mtx);
@@ -1122,12 +1128,12 @@ begin:
error = 0;
out:
if (error) {
- if (++try < 10) goto begin;
- device_printf(dev,"%s for key %s failed %d times, giving up\n",
- __func__, key, try);
+ if (++try < 10)
+ goto begin;
+ device_printf(dev, "%s for key %s failed %d times, giving up\n",
+ __func__, key, try);
mtx_unlock_spin(&sc->sc_mtx);
- }
- else {
+ } else {
char buf[1024];
char buf2[8];
mtx_unlock_spin(&sc->sc_mtx);
@@ -1190,15 +1196,15 @@ begin:
error = 0;
out:
if (error) {
- if (++try < 10) goto begin;
- device_printf(dev,"%s for key %s failed %d times, giving up\n",
- __func__, key, try);
+ if (++try < 10)
+ goto begin;
+ device_printf(dev, "%s for key %s failed %d times, giving up\n",
+ __func__, key, try);
}
mtx_unlock_spin(&sc->sc_mtx);
return (error);
-
}
/*
@@ -1230,16 +1236,17 @@ asmc_fan_getvalue(device_t dev, const char *key, int fan)
return (speed);
}
-static char*
-asmc_fan_getstring(device_t dev, const char *key, int fan, uint8_t *buf, uint8_t buflen)
+static char *
+asmc_fan_getstring(device_t dev, const char *key, int fan, uint8_t *buf,
+ uint8_t buflen)
{
char fankey[5];
- char* desc;
+ char *desc;
snprintf(fankey, sizeof(fankey), key, fan);
if (asmc_key_read(dev, fankey, buf, buflen) != 0)
return (NULL);
- desc = buf+4;
+ desc = buf + 4;
return (desc);
}
@@ -1252,7 +1259,7 @@ asmc_fan_setvalue(device_t dev, const char *key, int fan, int speed)
speed *= 4;
- buf[0] = speed>>8;
+ buf[0] = speed >> 8;
buf[1] = speed;
snprintf(fankey, sizeof(fankey), key, fan);
@@ -1265,7 +1272,7 @@ asmc_fan_setvalue(device_t dev, const char *key, int fan, int speed)
static int
asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int fan = arg2;
int error;
int32_t v;
@@ -1280,10 +1287,10 @@ static int
asmc_mb_sysctl_fanid(SYSCTL_HANDLER_ARGS)
{
uint8_t buf[16];
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int fan = arg2;
int error = true;
- char* desc;
+ char *desc;
desc = asmc_fan_getstring(dev, ASMC_KEY_FANID, fan, buf, sizeof(buf));
@@ -1296,7 +1303,7 @@ asmc_mb_sysctl_fanid(SYSCTL_HANDLER_ARGS)
static int
asmc_mb_sysctl_fansafespeed(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int fan = arg2;
int error;
int32_t v;
@@ -1310,7 +1317,7 @@ asmc_mb_sysctl_fansafespeed(SYSCTL_HANDLER_ARGS)
static int
asmc_mb_sysctl_fanminspeed(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int fan = arg2;
int error;
int32_t v;
@@ -1329,7 +1336,7 @@ asmc_mb_sysctl_fanminspeed(SYSCTL_HANDLER_ARGS)
static int
asmc_mb_sysctl_fanmaxspeed(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int fan = arg2;
int error;
int32_t v;
@@ -1348,7 +1355,7 @@ asmc_mb_sysctl_fanmaxspeed(SYSCTL_HANDLER_ARGS)
static int
asmc_mb_sysctl_fantargetspeed(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int fan = arg2;
int error;
int32_t v;
@@ -1367,7 +1374,7 @@ asmc_mb_sysctl_fantargetspeed(SYSCTL_HANDLER_ARGS)
static int
asmc_mb_sysctl_fanmanual(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int fan = arg2;
int error;
int32_t v;
@@ -1391,7 +1398,8 @@ asmc_mb_sysctl_fanmanual(SYSCTL_HANDLER_ARGS)
if (v != 0 && v != 1)
return (EINVAL);
/* Read-modify-write of FS! bitmask */
- error = asmc_key_read(dev, ASMC_KEY_FANMANUAL, buf, sizeof(buf));
+ error = asmc_key_read(dev, ASMC_KEY_FANMANUAL, buf,
+ sizeof(buf));
if (error == 0) {
val = (buf[0] << 8) | buf[1];
@@ -1404,7 +1412,8 @@ asmc_mb_sysctl_fanmanual(SYSCTL_HANDLER_ARGS)
/* Write back */
buf[0] = val >> 8;
buf[1] = val & 0xff;
- error = asmc_key_write(dev, ASMC_KEY_FANMANUAL, buf, sizeof(buf));
+ error = asmc_key_write(dev, ASMC_KEY_FANMANUAL, buf,
+ sizeof(buf));
}
}
@@ -1431,7 +1440,7 @@ asmc_temp_getvalue(device_t dev, const char *key)
static int
asmc_temp_sysctl(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
struct asmc_softc *sc = device_get_softc(dev);
int error, val;
@@ -1455,11 +1464,11 @@ asmc_sms_read(device_t dev, const char *key, int16_t *val)
case 'X':
case 'Y':
case 'Z':
- error = asmc_key_read(dev, key, buf, sizeof buf);
+ error = asmc_key_read(dev, key, buf, sizeof buf);
break;
default:
device_printf(dev, "%s called with invalid argument %s\n",
- __func__, key);
+ __func__, key);
error = 1;
goto out;
}
@@ -1482,7 +1491,7 @@ static int
asmc_sms_intrfast(void *arg)
{
uint8_t type;
- device_t dev = (device_t) arg;
+ device_t dev = (device_t)arg;
struct asmc_softc *sc = device_get_softc(dev);
if (!sc->sc_sms_intr_works)
return (FILTER_HANDLED);
@@ -1555,13 +1564,13 @@ asmc_sms_task(void *arg, int pending)
static int
asmc_mb_sysctl_sms_x(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int error;
int16_t val;
int32_t v;
asmc_sms_read(dev, ASMC_KEY_SMS_X, &val);
- v = (int32_t) val;
+ v = (int32_t)val;
error = sysctl_handle_int(oidp, &v, 0, req);
return (error);
@@ -1570,13 +1579,13 @@ asmc_mb_sysctl_sms_x(SYSCTL_HANDLER_ARGS)
static int
asmc_mb_sysctl_sms_y(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int error;
int16_t val;
int32_t v;
asmc_sms_read(dev, ASMC_KEY_SMS_Y, &val);
- v = (int32_t) val;
+ v = (int32_t)val;
error = sysctl_handle_int(oidp, &v, 0, req);
return (error);
@@ -1585,13 +1594,13 @@ asmc_mb_sysctl_sms_y(SYSCTL_HANDLER_ARGS)
static int
asmc_mb_sysctl_sms_z(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
int error;
int16_t val;
int32_t v;
asmc_sms_read(dev, ASMC_KEY_SMS_Z, &val);
- v = (int32_t) val;
+ v = (int32_t)val;
error = sysctl_handle_int(oidp, &v, 0, req);
return (error);
@@ -1600,7 +1609,7 @@ asmc_mb_sysctl_sms_z(SYSCTL_HANDLER_ARGS)
static int
asmc_mbp_sysctl_light_left(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
uint8_t buf[6];
int error;
int32_t v;
@@ -1615,7 +1624,7 @@ asmc_mbp_sysctl_light_left(SYSCTL_HANDLER_ARGS)
static int
asmc_mbp_sysctl_light_right(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
uint8_t buf[6];
int error;
int32_t v;
@@ -1630,7 +1639,7 @@ asmc_mbp_sysctl_light_right(SYSCTL_HANDLER_ARGS)
static int
asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
uint8_t buf[2];
int error;
int v;
@@ -1652,7 +1661,7 @@ asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS)
static int
asmc_mbp_sysctl_light_left_10byte(SYSCTL_HANDLER_ARGS)
{
- device_t dev = (device_t) arg1;
+ device_t dev = (device_t)arg1;
uint8_t buf[10];
int error;
uint32_t v;
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
index fa5293777f02..c5a86ef78edb 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
@@ -1800,7 +1800,7 @@ ar5211GetInterpolatedValue(uint16_t target,
/*
* Look for value being within 0.1 of the search values
* however, NDIS can't do float calculations, so multiply everything
- * up by EEP_SCALE so can do integer arithmatic
+ * up by EEP_SCALE so can do integer arithmetic
*
* INPUT value -value to search for
* INPUT pList -ptr to the list to search
diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c
index d36396df0fa0..95acf43a3bc6 100644
--- a/sys/dev/atkbdc/psm.c
+++ b/sys/dev/atkbdc/psm.c
@@ -352,6 +352,8 @@ typedef struct elantechhw {
int dptracey;
int issemimt;
int isclickpad;
+ int hassmbusnotify;
+ int has3buttons;
int hascrc;
int hastrackpoint;
int haspressure;
@@ -417,7 +419,7 @@ enum {
((pb)->ipacket[0] & 0x0c) == 0x0c && ((pb)->ipacket[3] & 0xce) == 0x0c)
#define ELANTECH_PKT_IS_V4(pb, hascrc) ((hascrc) ? \
((pb)->ipacket[3] & 0x08) == 0x00 : \
- ((pb)->ipacket[0] & 0x0c) == 0x04 && ((pb)->ipacket[3] & 0x1c) == 0x10)
+ ((pb)->ipacket[0] & 0x08) == 0x00 && ((pb)->ipacket[3] & 0x1c) == 0x10)
typedef struct elantechaction {
finger_t fingers[ELANTECH_MAX_FINGERS];
@@ -1930,8 +1932,11 @@ psm_register_elantech(device_t dev)
evdev_support_key(evdev_a, BTN_TOUCH);
evdev_support_nfingers(evdev_a, ELANTECH_MAX_FINGERS);
evdev_support_key(evdev_a, BTN_LEFT);
- if (!sc->elanhw.isclickpad)
+ if (!sc->elanhw.isclickpad) {
evdev_support_key(evdev_a, BTN_RIGHT);
+ if (sc->elanhw.has3buttons)
+ evdev_support_key(evdev_a, BTN_MIDDLE);
+ }
psm_support_abs_bulk(evdev_a, elantech_absinfo);
error = evdev_register_mtx(evdev_a, &Giant);
@@ -4755,6 +4760,9 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms,
touchpad_button =
((pb->ipacket[0] & 0x01) ? MOUSE_BUTTON1DOWN : 0) |
((pb->ipacket[0] & 0x02) ? MOUSE_BUTTON3DOWN : 0);
+ if (sc->elanhw.has3buttons)
+ touchpad_button |=
+ ((pb->ipacket[0] & 0x04) ? MOUSE_BUTTON2DOWN : 0);
}
#ifdef EVDEV_SUPPORT
@@ -7347,6 +7355,9 @@ enable_elantech(struct psm_softc *sc, enum probearg arg)
elanhw.hwversion = hwversion;
elanhw.issemimt = hwversion == 2;
elanhw.isclickpad = (resp[1] & 0x10) != 0;
+ elanhw.hassmbusnotify =
+ icversion == 0x0f && (resp[1] & 0x20) != 0 && resp[2] != 0;
+ elanhw.has3buttons = elanhw.hassmbusnotify;
elanhw.hascrc = (resp[1] & 0x40) != 0;
elanhw.haspressure = elanhw.fwversion >= 0x020800;
diff --git a/sys/dev/bnxt/bnxt_en/bnxt.h b/sys/dev/bnxt/bnxt_en/bnxt.h
index 0ba7b5723b91..64482a656e9d 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt.h
@@ -455,6 +455,7 @@ struct bnxt_link_info {
uint16_t req_link_speed;
uint8_t module_status;
struct hwrm_port_phy_qcfg_output phy_qcfg_resp;
+ uint8_t active_lanes;
};
enum bnxt_phy_type {
@@ -1167,6 +1168,7 @@ struct bnxt_softc {
struct iflib_dma_info def_nq_ring_mem;
struct task def_cp_task;
int db_size;
+ int db_offset;
int legacy_db_size;
struct bnxt_doorbell_ops db_ops;
@@ -1249,6 +1251,10 @@ struct bnxt_softc {
#define BNXT_FW_CAP_CFA_NTUPLE_RX_EXT_IP_PROTO BIT_ULL(47)
#define BNXT_FW_CAP_ENABLE_RDMA_SRIOV BIT_ULL(48)
#define BNXT_FW_CAP_RSS_TCAM BIT_ULL(49)
+
+ #define BNXT_FW_CAP_SW_MAX_RESOURCE_LIMITS BIT_ULL(61)
+ #define BNXT_SW_RES_LMT(bp) ((bp)->fw_cap & BNXT_FW_CAP_SW_MAX_RESOURCE_LIMITS)
+
uint32_t lpi_tmr_lo;
uint32_t lpi_tmr_hi;
/* copied from flags and flags2 in hwrm_port_phy_qcaps_output */
@@ -1264,6 +1270,7 @@ struct bnxt_softc {
#define BNXT_PHY_FL_NO_PAUSE (HWRM_PORT_PHY_QCAPS_OUTPUT_FLAGS2_PAUSE_UNSUPPORTED << 8)
#define BNXT_PHY_FL_NO_PFC (HWRM_PORT_PHY_QCAPS_OUTPUT_FLAGS2_PFC_UNSUPPORTED << 8)
#define BNXT_PHY_FL_BANK_SEL (HWRM_PORT_PHY_QCAPS_OUTPUT_FLAGS2_BANK_ADDR_SUPPORTED << 8)
+#define BNXT_PHY_FL_SPEEDS2 (HWRM_PORT_PHY_QCAPS_OUTPUT_FLAGS2_SPEEDS2_SUPPORTED << 8)
struct bnxt_aux_dev *aux_dev;
struct net_device *net_dev;
struct mtx en_ops_lock;
@@ -1333,6 +1340,7 @@ struct bnxt_softc {
unsigned long fw_reset_timestamp;
struct bnxt_fw_health *fw_health;
+ char board_partno[64];
};
struct bnxt_filter_info {
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
index 9e7f4614d9f9..2a79b418fe62 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
@@ -1218,6 +1218,9 @@ bnxt_hwrm_func_qcaps(struct bnxt_softc *softc)
flags_ext & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_DBR_PACING_SUPPORTED)
softc->fw_cap |= BNXT_FW_CAP_DBR_PACING_SUPPORTED;
+ if (flags_ext2 & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_SW_MAX_RESOURCE_LIMITS_SUPPORTED)
+ softc->fw_cap |= BNXT_FW_CAP_SW_MAX_RESOURCE_LIMITS;
+
if (flags_ext2 & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_GENERIC_STATS_SUPPORTED)
softc->fw_cap |= BNXT_FW_CAP_GENERIC_STATS;
func->fw_fid = le16toh(resp->fid);
@@ -1309,6 +1312,7 @@ bnxt_hwrm_func_qcfg(struct bnxt_softc *softc)
goto end;
softc->legacy_db_size = le16_to_cpu(resp->legacy_l2_db_size_kb) * 1024;
+ softc->db_offset = le16toh(resp->legacy_l2_db_size_kb) * 1024;
if (BNXT_CHIP_P5(softc)) {
if (BNXT_PF(softc))
@@ -1316,6 +1320,7 @@ bnxt_hwrm_func_qcfg(struct bnxt_softc *softc)
else
min_db_offset = DB_VF_OFFSET_P5;
softc->legacy_db_size = min_db_offset;
+ softc->db_offset = min_db_offset;
}
softc->db_size = roundup2(le16_to_cpu(resp->l2_doorbell_bar_size_kb) *
@@ -2912,10 +2917,14 @@ bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc)
}
link_info->duplex_setting = resp->duplex_cfg;
- if (link_info->phy_link_status == HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK)
+ if (link_info->phy_link_status == HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) {
link_info->link_speed = le16toh(resp->link_speed);
- else
+ if (softc->phy_flags & BNXT_PHY_FL_SPEEDS2)
+ link_info->active_lanes = resp->active_lanes;
+ } else {
link_info->link_speed = 0;
+ link_info->active_lanes = 0;
+ }
link_info->force_link_speed = le16toh(resp->force_link_speed);
link_info->auto_link_speeds = le16toh(resp->auto_link_speed);
link_info->support_speeds = le16toh(resp->support_speeds);
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_txrx.c b/sys/dev/bnxt/bnxt_en/bnxt_txrx.c
index 2e10de6f0174..3e867454de8a 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_txrx.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_txrx.c
@@ -154,12 +154,22 @@ bnxt_isc_txd_encap(void *sc, if_pkt_info_t pi)
lflags |= TX_BD_LONG_LFLAGS_LSO |
TX_BD_LONG_LFLAGS_T_IPID;
}
- else if(pi->ipi_csum_flags & CSUM_OFFLOAD) {
- lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM |
- TX_BD_LONG_LFLAGS_IP_CHKSUM;
- }
- else if(pi->ipi_csum_flags & CSUM_IP) {
- lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
+ else {
+ if (pi->ipi_csum_flags & CSUM_IP) {
+ lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
+ }
+ switch (pi->ipi_ipproto) {
+ case IPPROTO_TCP:
+ if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) {
+ lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+ }
+ break;
+ case IPPROTO_UDP:
+ if (pi->ipi_csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP)) {
+ lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+ }
+ break;
+ }
}
tbdh->lflags = htole16(lflags);
}
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_ulp.c b/sys/dev/bnxt/bnxt_en/bnxt_ulp.c
index 3c1f62cb4da3..c6d862a36a9a 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_ulp.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_ulp.c
@@ -125,7 +125,7 @@ static void bnxt_fill_msix_vecs(struct bnxt_softc *bp, struct bnxt_msix_entry *e
ent[i].vector = bp->irq_tbl[idx + i].vector;
ent[i].ring_idx = idx + i;
if (BNXT_CHIP_P5_PLUS(bp))
- ent[i].db_offset = DB_PF_OFFSET_P5;
+ ent[i].db_offset = bp->db_offset;
else
ent[i].db_offset = (idx + i) * 0x80;
@@ -449,6 +449,7 @@ static inline void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt_soft
edev->pdev = bp->pdev;
edev->softc = bp;
edev->l2_db_size = bp->db_size;
+ edev->l2_db_offset = bp->db_offset;
mtx_init(&bp->en_ops_lock, "Ethernet ops lock", NULL, MTX_DEF);
if (bp->flags & BNXT_FLAG_ROCEV1_CAP)
@@ -457,9 +458,12 @@ static inline void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt_soft
edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP;
if (bp->is_asym_q)
edev->flags |= BNXT_EN_FLAG_ASYM_Q;
+ if (BNXT_SW_RES_LMT(bp))
+ edev->flags |= BNXT_EN_FLAG_SW_RES_LMT;
edev->hwrm_bar = bp->hwrm_bar;
edev->port_partition_type = bp->port_partition_type;
edev->ulp_version = BNXT_ULP_VERSION;
+ memcpy(edev->board_part_number, bp->board_partno, BNXT_VPD_PN_FLD_LEN - 1);
}
int bnxt_rdma_aux_device_del(struct bnxt_softc *softc)
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_ulp.h b/sys/dev/bnxt/bnxt_en/bnxt_ulp.h
index 0108293046d7..53bb51b07135 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_ulp.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt_ulp.h
@@ -90,10 +90,15 @@ struct bnxt_en_dev {
#define BNXT_EN_FLAG_ULP_STOPPED 0x8
#define BNXT_EN_FLAG_ASYM_Q 0x10
#define BNXT_EN_FLAG_MULTI_HOST 0x20
+ #define BNXT_EN_FLAG_SW_RES_LMT 0x400
#define BNXT_EN_ASYM_Q(edev) ((edev)->flags & BNXT_EN_FLAG_ASYM_Q)
#define BNXT_EN_MH(edev) ((edev)->flags & BNXT_EN_FLAG_MULTI_HOST)
+#define BNXT_EN_SW_RES_LMT(edev) ((edev)->flags & BNXT_EN_FLAG_SW_RES_LMT)
const struct bnxt_en_ops *en_ops;
struct bnxt_ulp ulp_tbl[BNXT_MAX_ULP];
+ int l2_db_offset; /* Doorbell BAR offset
+ * of non-cacheable.
+ */
int l2_db_size; /* Doorbell BAR size in
* bytes mapped by L2
* driver.
@@ -121,6 +126,9 @@ struct bnxt_en_dev {
struct bnxt_dbr *en_dbr;
struct bnxt_bar_info hwrm_bar;
u32 espeed;
+ uint8_t lanes;
+ #define BNXT_VPD_PN_FLD_LEN 32
+ char board_part_number[BNXT_VPD_PN_FLD_LEN];
};
struct bnxt_en_ops {
diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c
index fa37d04e0884..dea6fd68181e 100644
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -1198,8 +1198,13 @@ static int bnxt_alloc_ctx_mem(struct bnxt_softc *softc)
max_srqs = ctxm->max_entries;
if (softc->flags & BNXT_FLAG_ROCE_CAP) {
pg_lvl = 2;
- extra_qps = min_t(u32, 65536, max_qps - l2_qps - qp1_qps);
- extra_srqs = min_t(u32, 8192, max_srqs - srqs);
+ if (BNXT_SW_RES_LMT(softc)) {
+ extra_qps = max_qps - l2_qps - qp1_qps;
+ extra_srqs = max_srqs - srqs;
+ } else {
+ extra_qps = min_t(uint32_t, 65536, max_qps - l2_qps - qp1_qps);
+ extra_srqs = min_t(uint32_t, 8192, max_srqs - srqs);
+ }
}
ctxm = &ctx->ctx_arr[BNXT_CTX_QP];
@@ -2669,6 +2674,13 @@ bnxt_attach_pre(if_ctx_t ctx)
softc->state_bv = bit_alloc(BNXT_STATE_MAX, M_DEVBUF,
M_WAITOK|M_ZERO);
+ if (BNXT_PF(softc)) {
+ const char *part_num;
+
+ if (pci_get_vpd_readonly(softc->dev, "PN", &part_num) == 0)
+ snprintf(softc->board_partno, sizeof(softc->board_partno), "%s", part_num);
+ }
+
return (rc);
failed:
@@ -3280,11 +3292,10 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
- if (link_info->link_up)
- ifmr->ifm_status |= IFM_ACTIVE;
- else
- ifmr->ifm_status &= ~IFM_ACTIVE;
+ if (!link_info->link_up)
+ return;
+ ifmr->ifm_status |= IFM_ACTIVE;
if (link_info->duplex == HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_CFG_FULL)
ifmr->ifm_active |= IFM_FDX;
else
@@ -4790,9 +4801,11 @@ bnxt_report_link(struct bnxt_softc *softc)
const char *duplex = NULL, *flow_ctrl = NULL;
const char *signal_mode = "";
- if(softc->edev)
+ if(softc->edev) {
softc->edev->espeed =
bnxt_fw_to_ethtool_speed(link_info->link_speed);
+ softc->edev->lanes = link_info->active_lanes;
+ }
if (link_info->link_up == link_info->last_link_up) {
if (!link_info->link_up)
diff --git a/sys/dev/bnxt/bnxt_re/bnxt_re-abi.h b/sys/dev/bnxt/bnxt_re/bnxt_re-abi.h
index 8f48609e7f6f..c7ca19f29046 100644
--- a/sys/dev/bnxt/bnxt_re/bnxt_re-abi.h
+++ b/sys/dev/bnxt/bnxt_re/bnxt_re-abi.h
@@ -34,7 +34,7 @@
#include <asm/types.h>
#include <linux/types.h>
-#define BNXT_RE_ABI_VERSION 6
+#define BNXT_RE_ABI_VERSION 7
enum {
BNXT_RE_COMP_MASK_UCNTX_WC_DPI_ENABLED = 0x01,
@@ -43,12 +43,14 @@ enum {
BNXT_RE_COMP_MASK_UCNTX_MQP_EX_SUPPORTED = 0x08,
BNXT_RE_COMP_MASK_UCNTX_DBR_PACING_ENABLED = 0x10,
BNXT_RE_COMP_MASK_UCNTX_DBR_RECOVERY_ENABLED = 0x20,
- BNXT_RE_COMP_MASK_UCNTX_HW_RETX_ENABLED = 0x40
+ BNXT_RE_COMP_MASK_UCNTX_HW_RETX_ENABLED = 0x40,
+ BNXT_RE_COMP_MASK_UCNTX_CMASK_HAVE_MODE = 0x80,
};
enum {
BNXT_RE_COMP_MASK_REQ_UCNTX_POW2_SUPPORT = 0x01,
- BNXT_RE_COMP_MASK_REQ_UCNTX_RSVD_WQE = 0x02
+ BNXT_RE_COMP_MASK_REQ_UCNTX_RSVD_WQE = 0x02,
+ BNXT_RE_COMP_MASK_REQ_UCNTX_VAR_WQE_SUPPORT = 0x03
};
struct bnxt_re_uctx_req {
@@ -66,7 +68,7 @@ struct bnxt_re_uctx_resp {
__u32 max_cqd;
__u32 chip_id0;
__u32 chip_id1;
- __u32 modes;
+ __u32 mode;
__aligned_u64 comp_mask;
} __attribute__((packed));
@@ -134,6 +136,8 @@ struct bnxt_re_qp_req {
__u64 qpsva;
__u64 qprva;
__u64 qp_handle;
+ __u64 comp_mask;
+ __u32 sq_slots;
} __attribute__((packed));
struct bnxt_re_qp_resp {
diff --git a/sys/dev/bnxt/bnxt_re/bnxt_re.h b/sys/dev/bnxt/bnxt_re/bnxt_re.h
index fe7a27f4e216..0afc8566c020 100644
--- a/sys/dev/bnxt/bnxt_re/bnxt_re.h
+++ b/sys/dev/bnxt/bnxt_re/bnxt_re.h
@@ -535,6 +535,7 @@ struct bnxt_re_dev {
bool is_virtfn;
u32 num_vfs;
u32 espeed;
+ u8 lanes;
/*
* For storing the speed of slave interfaces.
* Same as espeed when bond is not configured
@@ -716,7 +717,7 @@ void bnxt_re_remove_device(struct bnxt_re_dev *rdev, u8 removal_type,
void bnxt_re_destroy_lag(struct bnxt_re_dev **rdev);
int bnxt_re_add_device(struct bnxt_re_dev **rdev,
struct ifnet *netdev,
- u8 qp_mode, u8 op_type, u8 wqe_mode, u32 num_msix_requested,
+ u8 qp_mode, u8 op_type, u32 num_msix_requested,
struct auxiliary_device *aux_dev);
void bnxt_re_create_base_interface(bool primary);
int bnxt_re_schedule_work(struct bnxt_re_dev *rdev, unsigned long event,
@@ -1069,6 +1070,15 @@ static inline void bnxt_re_set_def_do_pacing(struct bnxt_re_dev *rdev)
rdev->qplib_res.pacing_data->do_pacing = rdev->dbr_def_do_pacing;
}
+static inline bool bnxt_re_is_var_size_supported(struct bnxt_re_dev *rdev,
+ struct bnxt_re_ucontext *uctx)
+{
+ if (uctx)
+ return uctx->cmask & BNXT_RE_UCNTX_CAP_VAR_WQE_ENABLED;
+ else
+ return rdev->chip_ctx->modes.wqe_mode;
+}
+
static inline void bnxt_re_set_pacing_dev_state(struct bnxt_re_dev *rdev)
{
rdev->qplib_res.pacing_data->dev_err_state =
diff --git a/sys/dev/bnxt/bnxt_re/ib_verbs.c b/sys/dev/bnxt/bnxt_re/ib_verbs.c
index 0383a16757aa..32899abab9ff 100644
--- a/sys/dev/bnxt/bnxt_re/ib_verbs.c
+++ b/sys/dev/bnxt/bnxt_re/ib_verbs.c
@@ -241,46 +241,99 @@ int bnxt_re_modify_device(struct ib_device *ibdev,
return 0;
}
-static void __to_ib_speed_width(u32 espeed, u8 *speed, u8 *width)
+static void __to_ib_speed_width(u32 espeed, u8 lanes, u8 *speed, u8 *width)
{
- switch (espeed) {
- case SPEED_1000:
- *speed = IB_SPEED_SDR;
+ if (!lanes) {
+ switch (espeed) {
+ case SPEED_1000:
+ *speed = IB_SPEED_SDR;
+ *width = IB_WIDTH_1X;
+ break;
+ case SPEED_10000:
+ *speed = IB_SPEED_QDR;
+ *width = IB_WIDTH_1X;
+ break;
+ case SPEED_20000:
+ *speed = IB_SPEED_DDR;
+ *width = IB_WIDTH_4X;
+ break;
+ case SPEED_25000:
+ *speed = IB_SPEED_EDR;
+ *width = IB_WIDTH_1X;
+ break;
+ case SPEED_40000:
+ *speed = IB_SPEED_QDR;
+ *width = IB_WIDTH_4X;
+ break;
+ case SPEED_50000:
+ *speed = IB_SPEED_EDR;
+ *width = IB_WIDTH_2X;
+ break;
+ case SPEED_100000:
+ *speed = IB_SPEED_EDR;
+ *width = IB_WIDTH_4X;
+ break;
+ case SPEED_200000:
+ *speed = IB_SPEED_HDR;
+ *width = IB_WIDTH_4X;
+ break;
+ case SPEED_400000:
+ *speed = IB_SPEED_NDR;
+ *width = IB_WIDTH_4X;
+ break;
+ default:
+ *speed = IB_SPEED_SDR;
+ *width = IB_WIDTH_1X;
+ break;
+ }
+ return;
+ }
+
+ switch (lanes) {
+ case 1:
*width = IB_WIDTH_1X;
break;
- case SPEED_10000:
- *speed = IB_SPEED_QDR;
- *width = IB_WIDTH_1X;
+ case 2:
+ *width = IB_WIDTH_2X;
break;
- case SPEED_20000:
- *speed = IB_SPEED_DDR;
+ case 4:
*width = IB_WIDTH_4X;
break;
- case SPEED_25000:
- *speed = IB_SPEED_EDR;
+ case 8:
+ *width = IB_WIDTH_8X;
+ break;
+ case 12:
+ *width = IB_WIDTH_12X;
+ break;
+ default:
*width = IB_WIDTH_1X;
+ }
+
+ switch (espeed / lanes) {
+ case SPEED_2500:
+ *speed = IB_SPEED_SDR;
break;
- case SPEED_40000:
- *speed = IB_SPEED_QDR;
- *width = IB_WIDTH_4X;
+ case SPEED_5000:
+ *speed = IB_SPEED_DDR;
break;
- case SPEED_50000:
- *speed = IB_SPEED_EDR;
- *width = IB_WIDTH_2X;
+ case SPEED_10000:
+ *speed = IB_SPEED_FDR10;
break;
- case SPEED_100000:
+ case SPEED_14000:
+ *speed = IB_SPEED_FDR;
+ break;
+ case SPEED_25000:
*speed = IB_SPEED_EDR;
- *width = IB_WIDTH_4X;
break;
- case SPEED_200000:
+ case SPEED_50000:
*speed = IB_SPEED_HDR;
- *width = IB_WIDTH_4X;
+ break;
+ case SPEED_100000:
+ *speed = IB_SPEED_NDR;
break;
default:
*speed = IB_SPEED_SDR;
- *width = IB_WIDTH_1X;
- break;
- }
+ }
}
/* Port */
@@ -318,9 +371,10 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
port_attr->subnet_timeout = 0;
port_attr->init_type_reply = 0;
rdev->espeed = rdev->en_dev->espeed;
+ rdev->lanes = rdev->en_dev->lanes;
if (test_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags))
- __to_ib_speed_width(rdev->espeed, &active_speed,
+ __to_ib_speed_width(rdev->espeed, rdev->lanes, &active_speed,
&active_width);
port_attr->active_speed = active_speed;
@@ -1613,15 +1667,18 @@ static int bnxt_re_setup_swqe_size(struct bnxt_re_qp *qp,
align = sizeof(struct sq_send_hdr);
ilsize = ALIGN(init_attr->cap.max_inline_data, align);
- sq->wqe_size = bnxt_re_get_swqe_size(ilsize, sq->max_sge);
- if (sq->wqe_size > _get_swqe_sz(dev_attr->max_qp_sges))
- return -EINVAL;
- /* For Cu/Wh and gen p5 backward compatibility mode
- * wqe size is fixed to 128 bytes
+ /* For gen p4 and gen p5 fixed wqe compatibility mode
+ * wqe size is fixed to 128 bytes - ie 6 SGEs
*/
- if (sq->wqe_size < _get_swqe_sz(dev_attr->max_qp_sges) &&
- qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC)
- sq->wqe_size = _get_swqe_sz(dev_attr->max_qp_sges);
+ if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC) {
+ sq->wqe_size = _get_swqe_sz(BNXT_STATIC_MAX_SGE);
+ sq->max_sge = BNXT_STATIC_MAX_SGE;
+ } else {
+ sq->wqe_size = bnxt_re_get_swqe_size(ilsize, sq->max_sge);
+ if (sq->wqe_size > _get_swqe_sz(dev_attr->max_qp_sges))
+ return -EINVAL;
+ }
+
if (init_attr->cap.max_inline_data) {
qplqp->max_inline_data = sq->wqe_size -
@@ -1666,23 +1723,28 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev,
return rc;
bytes = (qplib_qp->sq.max_wqe * qplib_qp->sq.wqe_size);
+ bytes = PAGE_ALIGN(bytes);
/* Consider mapping PSN search memory only for RC QPs. */
if (qplib_qp->type == CMDQ_CREATE_QP_TYPE_RC) {
psn_sz = _is_chip_gen_p5_p7(rdev->chip_ctx) ?
sizeof(struct sq_psn_search_ext) :
sizeof(struct sq_psn_search);
- if (rdev->dev_attr && BNXT_RE_HW_RETX(rdev->dev_attr->dev_cap_flags))
+ if (rdev->dev_attr && _is_host_msn_table(rdev->dev_attr->dev_cap_ext_flags2))
psn_sz = sizeof(struct sq_msn_search);
- psn_nume = (qplib_qp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC) ?
- qplib_qp->sq.max_wqe :
- ((qplib_qp->sq.max_wqe * qplib_qp->sq.wqe_size) /
- sizeof(struct bnxt_qplib_sge));
- if (BNXT_RE_HW_RETX(rdev->dev_attr->dev_cap_flags))
+ if (cntx && bnxt_re_is_var_size_supported(rdev, cntx)) {
+ psn_nume = ureq.sq_slots;
+ } else {
+ psn_nume = (qplib_qp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC) ?
+ qplib_qp->sq.max_wqe :
+ ((qplib_qp->sq.max_wqe * qplib_qp->sq.wqe_size) /
+ sizeof(struct bnxt_qplib_sge));
+ }
+ if (rdev->dev_attr && _is_host_msn_table(rdev->dev_attr->dev_cap_ext_flags2))
psn_nume = roundup_pow_of_two(psn_nume);
bytes += (psn_nume * psn_sz);
+ bytes = PAGE_ALIGN(bytes);
}
- bytes = PAGE_ALIGN(bytes);
umem = ib_umem_get_compat(rdev, context, udata, ureq.qpsva, bytes,
IB_ACCESS_LOCAL_WRITE, 1);
if (IS_ERR(umem)) {
@@ -1857,6 +1919,7 @@ static struct bnxt_re_qp *bnxt_re_create_shadow_qp(struct bnxt_re_pd *pd,
/* Shadow QP SQ depth should be same as QP1 RQ depth */
qp->qplib_qp.sq.wqe_size = bnxt_re_get_swqe_size(0, 6);
qp->qplib_qp.sq.max_wqe = qp1_qp->rq.max_wqe;
+ qp->qplib_qp.sq.max_sw_wqe = qp1_qp->rq.max_wqe;
qp->qplib_qp.sq.max_sge = 2;
/* Q full delta can be 1 since it is internal QP */
qp->qplib_qp.sq.q_full_delta = 1;
@@ -1868,6 +1931,7 @@ static struct bnxt_re_qp *bnxt_re_create_shadow_qp(struct bnxt_re_pd *pd,
qp->qplib_qp.rq.wqe_size = _max_rwqe_sz(6); /* 128 Byte wqe size */
qp->qplib_qp.rq.max_wqe = qp1_qp->rq.max_wqe;
+ qp->qplib_qp.rq.max_sw_wqe = qp1_qp->rq.max_wqe;
qp->qplib_qp.rq.max_sge = qp1_qp->rq.max_sge;
qp->qplib_qp.rq.sginfo.pgsize = PAGE_SIZE;
qp->qplib_qp.rq.sginfo.pgshft = PAGE_SHIFT;
@@ -1940,6 +2004,7 @@ static int bnxt_re_init_rq_attr(struct bnxt_re_qp *qp,
entries = init_attr->cap.max_recv_wr + 1;
entries = bnxt_re_init_depth(entries, cntx);
rq->max_wqe = min_t(u32, entries, dev_attr->max_qp_wqes + 1);
+ rq->max_sw_wqe = rq->max_wqe;
rq->q_full_delta = 0;
rq->sginfo.pgsize = PAGE_SIZE;
rq->sginfo.pgshft = PAGE_SHIFT;
@@ -1964,10 +2029,11 @@ static void bnxt_re_adjust_gsi_rq_attr(struct bnxt_re_qp *qp)
static int bnxt_re_init_sq_attr(struct bnxt_re_qp *qp,
struct ib_qp_init_attr *init_attr,
- void *cntx)
+ void *cntx, struct ib_udata *udata)
{
struct bnxt_qplib_dev_attr *dev_attr;
struct bnxt_qplib_qp *qplqp;
+ struct bnxt_re_qp_req ureq;
struct bnxt_re_dev *rdev;
struct bnxt_qplib_q *sq;
int diff = 0;
@@ -1979,35 +2045,53 @@ static int bnxt_re_init_sq_attr(struct bnxt_re_qp *qp,
sq = &qplqp->sq;
dev_attr = rdev->dev_attr;
- sq->max_sge = init_attr->cap.max_send_sge;
- if (sq->max_sge > dev_attr->max_qp_sges) {
- sq->max_sge = dev_attr->max_qp_sges;
- init_attr->cap.max_send_sge = sq->max_sge;
+ if (udata) {
+ rc = ib_copy_from_udata(&ureq, udata,
+ min(udata->inlen, sizeof(ureq)));
+ if (rc)
+ return -EINVAL;
}
- rc = bnxt_re_setup_swqe_size(qp, init_attr);
- if (rc)
- return rc;
- /*
- * Change the SQ depth if user has requested minimum using
- * configfs. Only supported for kernel consumers. Setting
- * min_tx_depth to 4096 to handle iser SQ full condition
- * in most of the newer OS distros
- */
+
+ sq->max_sge = init_attr->cap.max_send_sge;
entries = init_attr->cap.max_send_wr;
- if (!cntx && rdev->min_tx_depth && init_attr->qp_type != IB_QPT_GSI) {
+ if (cntx && udata && qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE) {
+ sq->max_wqe = ureq.sq_slots;
+ sq->max_sw_wqe = ureq.sq_slots;
+ sq->wqe_size = sizeof(struct sq_sge);
+ } else {
+ if (sq->max_sge > dev_attr->max_qp_sges) {
+ sq->max_sge = dev_attr->max_qp_sges;
+ init_attr->cap.max_send_sge = sq->max_sge;
+ }
+ rc = bnxt_re_setup_swqe_size(qp, init_attr);
+ if (rc)
+ return rc;
/*
- * If users specify any value greater than 1 use min_tx_depth
- * provided by user for comparison. Else, compare it with the
- * BNXT_RE_MIN_KERNEL_QP_TX_DEPTH and adjust it accordingly.
+ * Change the SQ depth if user has requested minimum using
+ * configfs. Only supported for kernel consumers. Setting
+ * min_tx_depth to 4096 to handle iser SQ full condition
+ * in most of the newer OS distros
*/
- if (rdev->min_tx_depth > 1 && entries < rdev->min_tx_depth)
- entries = rdev->min_tx_depth;
- else if (entries < BNXT_RE_MIN_KERNEL_QP_TX_DEPTH)
- entries = BNXT_RE_MIN_KERNEL_QP_TX_DEPTH;
- }
- diff = bnxt_re_get_diff(cntx, rdev->chip_ctx);
- entries = bnxt_re_init_depth(entries + diff + 1, cntx);
- sq->max_wqe = min_t(u32, entries, dev_attr->max_qp_wqes + diff + 1);
+
+ if (!cntx && rdev->min_tx_depth && init_attr->qp_type != IB_QPT_GSI) {
+ /*
+ * If users specify any value greater than 1 use min_tx_depth
+ * provided by user for comparison. Else, compare it with the
+ * BNXT_RE_MIN_KERNEL_QP_TX_DEPTH and adjust it accordingly.
+ */
+ if (rdev->min_tx_depth > 1 && entries < rdev->min_tx_depth)
+ entries = rdev->min_tx_depth;
+ else if (entries < BNXT_RE_MIN_KERNEL_QP_TX_DEPTH)
+ entries = BNXT_RE_MIN_KERNEL_QP_TX_DEPTH;
+ }
+ diff = bnxt_re_get_diff(cntx, rdev->chip_ctx);
+ entries = bnxt_re_init_depth(entries + diff + 1, cntx);
+ sq->max_wqe = min_t(u32, entries, dev_attr->max_qp_wqes + diff + 1);
+ if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE)
+ sq->max_sw_wqe = bnxt_qplib_get_depth(sq, qplqp->wqe_mode, true);
+ else
+ sq->max_sw_wqe = sq->max_wqe;
+ }
sq->q_full_delta = diff + 1;
/*
* Reserving one slot for Phantom WQE. Application can
@@ -2073,11 +2157,6 @@ out:
return qptype;
}
-static int bnxt_re_init_qp_wqe_mode(struct bnxt_re_dev *rdev)
-{
- return rdev->chip_ctx->modes.wqe_mode;
-}
-
static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
struct ib_qp_init_attr *init_attr,
struct ib_udata *udata)
@@ -2111,7 +2190,7 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
goto out;
}
qplqp->type = (u8)qptype;
- qplqp->wqe_mode = bnxt_re_init_qp_wqe_mode(rdev);
+ qplqp->wqe_mode = bnxt_re_is_var_size_supported(rdev, cntx);
ether_addr_copy(qplqp->smac, rdev->dev_addr);
if (init_attr->qp_type == IB_QPT_RC) {
@@ -2158,7 +2237,7 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
bnxt_re_adjust_gsi_rq_attr(qp);
/* Setup SQ */
- rc = bnxt_re_init_sq_attr(qp, init_attr, cntx);
+ rc = bnxt_re_init_sq_attr(qp, init_attr, cntx, udata);
if (rc)
goto out;
if (init_attr->qp_type == IB_QPT_GSI)
@@ -2794,6 +2873,7 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
if (entries > dev_attr->max_qp_wqes)
entries = dev_attr->max_qp_wqes;
qp->qplib_qp.rq.max_wqe = entries;
+ qp->qplib_qp.rq.max_sw_wqe = qp->qplib_qp.rq.max_wqe;
qp->qplib_qp.rq.q_full_delta = qp->qplib_qp.rq.max_wqe -
qp_attr->cap.max_recv_wr;
qp->qplib_qp.rq.max_sge = qp_attr->cap.max_recv_sge;
@@ -5294,11 +5374,9 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *uctx_in,
}
genp5 = _is_chip_gen_p5_p7(cctx);
- if (BNXT_RE_ABI_VERSION > 5) {
- resp.modes = genp5 ? cctx->modes.wqe_mode : 0;
- if (rdev->dev_attr && BNXT_RE_HW_RETX(rdev->dev_attr->dev_cap_flags))
- resp.comp_mask = BNXT_RE_COMP_MASK_UCNTX_HW_RETX_ENABLED;
- }
+ resp.mode = genp5 ? cctx->modes.wqe_mode : 0;
+ if (rdev->dev_attr && _is_host_msn_table(rdev->dev_attr->dev_cap_ext_flags2))
+ resp.comp_mask = BNXT_RE_COMP_MASK_UCNTX_HW_RETX_ENABLED;
resp.pg_size = PAGE_SIZE;
resp.cqe_sz = sizeof(struct cq_base);
@@ -5331,6 +5409,12 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *uctx_in,
if (bnxt_re_init_rsvd_wqe_flag(&ureq, &resp, genp5))
dev_warn(rdev_to_dev(rdev),
"Rsvd wqe in use! Try the updated library.\n");
+ if (ureq.comp_mask & BNXT_RE_COMP_MASK_REQ_UCNTX_VAR_WQE_SUPPORT) {
+ resp.comp_mask |= BNXT_RE_COMP_MASK_UCNTX_CMASK_HAVE_MODE;
+ resp.mode = rdev->chip_ctx->modes.wqe_mode;
+ if (resp.mode == BNXT_QPLIB_WQE_MODE_VARIABLE)
+ resp.comp_mask |= BNXT_RE_UCNTX_CAP_VAR_WQE_ENABLED;
+ }
} else {
dev_warn(rdev_to_dev(rdev),
"Enabled roundup logic. Update the library!\n");
diff --git a/sys/dev/bnxt/bnxt_re/ib_verbs.h b/sys/dev/bnxt/bnxt_re/ib_verbs.h
index cb9f7974e92d..66d15dd2b767 100644
--- a/sys/dev/bnxt/bnxt_re/ib_verbs.h
+++ b/sys/dev/bnxt/bnxt_re/ib_verbs.h
@@ -49,10 +49,22 @@ struct bnxt_re_dev;
#define SPEED_1000 1000
#endif
+#ifndef SPEED_2500
+#define SPEED_2500 2500
+#endif
+
+#ifndef SPEED_5000
+#define SPEED_5000 5000
+#endif
+
#ifndef SPEED_10000
#define SPEED_10000 10000
#endif
+#ifndef SPEED_14000
+#define SPEED_14000 14000
+#endif
+
#ifndef SPEED_20000
#define SPEED_20000 20000
#endif
@@ -77,10 +89,18 @@ struct bnxt_re_dev;
#define SPEED_200000 200000
#endif
+#ifndef SPEED_400000
+#define SPEED_400000 400000
+#endif
+
#ifndef IB_SPEED_HDR
#define IB_SPEED_HDR 64
#endif
+#ifndef IB_SPEED_NDR
+#define IB_SPEED_NDR 128
+#endif
+
#define RDMA_NETWORK_IPV4 1
#define RDMA_NETWORK_IPV6 2
@@ -488,6 +508,11 @@ static inline int bnxt_re_init_pow2_flag(struct bnxt_re_uctx_req *req,
return 0;
}
+enum {
+ BNXT_RE_UCNTX_CAP_POW2_DISABLED = 0x1ULL,
+ BNXT_RE_UCNTX_CAP_VAR_WQE_ENABLED = 0x2ULL,
+};
+
static inline u32 bnxt_re_init_depth(u32 ent, struct bnxt_re_ucontext *uctx)
{
return uctx ? (uctx->cmask & BNXT_RE_COMP_MASK_UCNTX_POW2_DISABLED) ?
diff --git a/sys/dev/bnxt/bnxt_re/main.c b/sys/dev/bnxt/bnxt_re/main.c
index 3d26d21f3fc7..01c2710bc3ea 100644
--- a/sys/dev/bnxt/bnxt_re/main.c
+++ b/sys/dev/bnxt/bnxt_re/main.c
@@ -1101,7 +1101,6 @@ static int bnxt_re_handle_start(struct auxiliary_device *adev)
rc = bnxt_re_add_device(&rdev, real_dev,
en_info->gsi_mode,
BNXT_RE_POST_RECOVERY_INIT,
- en_info->wqe_mode,
en_info->num_msix_requested, adev);
if (rc) {
/* Add device failed. Unregister the device.
@@ -1411,12 +1410,14 @@ static void bnxt_re_set_db_offset(struct bnxt_re_dev *rdev)
dev_info(rdev_to_dev(rdev),
"Couldn't get DB bar size, Low latency framework is disabled\n");
/* set register offsets for both UC and WC */
- if (_is_chip_p7(cctx))
- res->dpi_tbl.ucreg.offset = offset;
- else
+ if (_is_chip_p7(cctx)) {
+ res->dpi_tbl.ucreg.offset = en_dev->l2_db_offset;
+ res->dpi_tbl.wcreg.offset = en_dev->l2_db_size;
+ } else {
res->dpi_tbl.ucreg.offset = res->is_vf ? BNXT_QPLIB_DBR_VF_DB_OFFSET :
BNXT_QPLIB_DBR_PF_DB_OFFSET;
- res->dpi_tbl.wcreg.offset = res->dpi_tbl.ucreg.offset;
+ res->dpi_tbl.wcreg.offset = res->dpi_tbl.ucreg.offset;
+ }
/* If WC mapping is disabled by L2 driver then en_dev->l2_db_size
* is equal to the DB-Bar actual size. This indicates that L2
@@ -1433,15 +1434,15 @@ static void bnxt_re_set_db_offset(struct bnxt_re_dev *rdev)
return;
}
-static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev, u8 mode)
+static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev)
{
struct bnxt_qplib_chip_ctx *cctx;
struct bnxt_en_dev *en_dev;
en_dev = rdev->en_dev;
cctx = rdev->chip_ctx;
- cctx->modes.wqe_mode = _is_chip_gen_p5_p7(rdev->chip_ctx) ?
- mode : BNXT_QPLIB_WQE_MODE_STATIC;
+ cctx->modes.wqe_mode = _is_chip_p7(rdev->chip_ctx) ?
+ BNXT_QPLIB_WQE_MODE_VARIABLE : BNXT_QPLIB_WQE_MODE_STATIC;
cctx->modes.te_bypass = false;
if (bnxt_re_hwrm_qcaps(rdev))
dev_err(rdev_to_dev(rdev),
@@ -1490,7 +1491,7 @@ static void bnxt_re_destroy_chip_ctx(struct bnxt_re_dev *rdev)
kfree(chip_ctx);
}
-static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
+static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev)
{
struct bnxt_qplib_chip_ctx *chip_ctx;
struct bnxt_en_dev *en_dev;
@@ -1525,7 +1526,7 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
rc = -ENOMEM;
goto fail;
}
- bnxt_re_set_drv_mode(rdev, wqe_mode);
+ bnxt_re_set_drv_mode(rdev);
bnxt_re_set_db_offset(rdev);
rc = bnxt_qplib_map_db_bar(&rdev->qplib_res);
@@ -2029,11 +2030,30 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr,
return scnprintf(buf, PAGE_SIZE, "%s\n", rdev->ibdev.node_desc);
}
+static ssize_t show_board_id(struct device *device, struct device_attribute *attr,
+ char *buf)
+{
+ struct bnxt_re_dev *rdev = to_bnxt_re_dev(device, ibdev.dev);
+ char buffer[BNXT_VPD_PN_FLD_LEN] = {};
+
+ if (!rdev->is_virtfn)
+ memcpy(buffer, rdev->en_dev->board_part_number,
+ BNXT_VPD_PN_FLD_LEN - 1);
+ else
+ scnprintf(buffer, BNXT_VPD_PN_FLD_LEN,
+ "0x%x-VF", rdev->en_dev->pdev->device);
+
+ return scnprintf(buf, PAGE_SIZE, "%s\n", buffer);
+}
+
static DEVICE_ATTR(hw_rev, 0444, show_rev, NULL);
static DEVICE_ATTR(hca_type, 0444, show_hca, NULL);
+static DEVICE_ATTR(board_id, 0444, show_board_id, NULL);
+
static struct device_attribute *bnxt_re_attributes[] = {
&dev_attr_hw_rev,
- &dev_attr_hca_type
+ &dev_attr_hca_type,
+ &dev_attr_board_id
};
int ib_register_device_compat(struct bnxt_re_dev *rdev)
@@ -3530,7 +3550,7 @@ static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev, u8 op_type)
}
}
-static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type, u8 wqe_mode)
+static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)
{
struct bnxt_re_ring_attr rattr = {};
struct bnxt_qplib_creq_ctx *creq;
@@ -3545,7 +3565,7 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type, u8 wqe_mode)
}
set_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags);
- rc = bnxt_re_setup_chip_ctx(rdev, wqe_mode);
+ rc = bnxt_re_setup_chip_ctx(rdev);
if (rc) {
dev_err(rdev_to_dev(rdev), "Failed to get chip context rc 0x%x", rc);
bnxt_re_unregister_netdev(rdev);
@@ -3592,19 +3612,24 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type, u8 wqe_mode)
goto release_rtnl;
}
+ set_bit(BNXT_RE_FLAG_NET_RING_ALLOC, &rdev->flags);
+
if (!rdev->chip_ctx)
goto release_rtnl;
- /* Program the NQ ID for DBQ notification */
- if (rdev->chip_ctx->modes.dbr_pacing_v0 ||
- bnxt_qplib_dbr_pacing_en(rdev->chip_ctx) ||
- bnxt_qplib_dbr_pacing_ext_en(rdev->chip_ctx)) {
- rc = bnxt_re_initialize_dbr_pacing(rdev);
- if (!rc)
- rdev->dbr_pacing = true;
- else
- rdev->dbr_pacing = false;
- dev_dbg(rdev_to_dev(rdev), "%s: initialize db pacing ret %d\n",
- __func__, rc);
+
+ if (!(_is_chip_p7(rdev->chip_ctx))) {
+ /* Program the NQ ID for DBQ notification */
+ if (rdev->chip_ctx->modes.dbr_pacing_v0 ||
+ bnxt_qplib_dbr_pacing_en(rdev->chip_ctx) ||
+ bnxt_qplib_dbr_pacing_ext_en(rdev->chip_ctx)) {
+ rc = bnxt_re_initialize_dbr_pacing(rdev);
+ if (!rc)
+ rdev->dbr_pacing = true;
+ else
+ rdev->dbr_pacing = false;
+ dev_dbg(rdev_to_dev(rdev), "%s: initialize db pacing ret %d\n",
+ __func__, rc);
+ }
}
vec = rdev->nqr.msix_entries[BNXT_RE_AEQ_IDX].vector;
@@ -3811,6 +3836,7 @@ static int bnxt_re_dev_reg(struct bnxt_re_dev **rdev, struct ifnet *netdev,
void bnxt_re_get_link_speed(struct bnxt_re_dev *rdev)
{
rdev->espeed = rdev->en_dev->espeed;
+ rdev->lanes = rdev->en_dev->lanes;
return;
}
@@ -3852,7 +3878,7 @@ void bnxt_re_remove_device(struct bnxt_re_dev *rdev, u8 op_type,
int bnxt_re_add_device(struct bnxt_re_dev **rdev,
struct ifnet *netdev,
- u8 qp_mode, u8 op_type, u8 wqe_mode,
+ u8 qp_mode, u8 op_type,
u32 num_msix_requested,
struct auxiliary_device *aux_dev)
{
@@ -3925,7 +3951,7 @@ int bnxt_re_add_device(struct bnxt_re_dev **rdev,
rtnl_lock();
en_info->rdev = *rdev;
rtnl_unlock();
- rc = bnxt_re_dev_init(*rdev, op_type, wqe_mode);
+ rc = bnxt_re_dev_init(*rdev, op_type);
if (rc) {
ref_error:
bnxt_re_dev_unreg(*rdev);
@@ -4374,7 +4400,6 @@ static int bnxt_re_probe(struct auxiliary_device *adev,
rc = bnxt_re_add_device(&rdev, en_dev->net,
BNXT_RE_GSI_MODE_ALL,
BNXT_RE_COMPLETE_INIT,
- BNXT_QPLIB_WQE_MODE_STATIC,
BNXT_RE_MSIX_FROM_MOD_PARAM, adev);
if (rc) {
mutex_unlock(&bnxt_re_mutex);
diff --git a/sys/dev/bnxt/bnxt_re/qplib_fp.c b/sys/dev/bnxt/bnxt_re/qplib_fp.c
index 3f1b02406f7f..19708302198b 100644
--- a/sys/dev/bnxt/bnxt_re/qplib_fp.c
+++ b/sys/dev/bnxt/bnxt_re/qplib_fp.c
@@ -388,10 +388,14 @@ static void bnxt_qplib_service_nq(unsigned long data)
struct bnxt_qplib_srq *srq;
struct nq_srq_event *nqsrqe =
(struct nq_srq_event *)nqe;
+ u8 toggle;
q_handle = le32_to_cpu(nqsrqe->srq_handle_low);
q_handle |= (u64)le32_to_cpu(nqsrqe->srq_handle_high) << 32;
srq = (struct bnxt_qplib_srq *)q_handle;
+ toggle = (le16_to_cpu(nqe->info10_type) & NQ_CN_TOGGLE_MASK)
+ >> NQ_CN_TOGGLE_SFT;
+ srq->dbinfo.toggle = toggle;
bnxt_qplib_armen_db(&srq->dbinfo,
DBC_DBC_TYPE_SRQ_ARMENA);
if (!nq->srqn_handler(nq,
@@ -838,15 +842,15 @@ static int bnxt_qplib_alloc_init_swq(struct bnxt_qplib_q *que)
int rc = 0;
int indx;
- que->swq = kcalloc(que->max_wqe, sizeof(*que->swq), GFP_KERNEL);
+ que->swq = kcalloc(que->max_sw_wqe, sizeof(*que->swq), GFP_KERNEL);
if (!que->swq) {
rc = -ENOMEM;
goto out;
}
que->swq_start = 0;
- que->swq_last = que->max_wqe - 1;
- for (indx = 0; indx < que->max_wqe; indx++)
+ que->swq_last = que->max_sw_wqe - 1;
+ for (indx = 0; indx < que->max_sw_wqe; indx++)
que->swq[indx].next_idx = indx + 1;
que->swq[que->swq_last].next_idx = 0; /* Make it circular */
que->swq_last = 0;
@@ -875,19 +879,23 @@ static u32 bnxt_qplib_get_stride(void)
return sizeof(struct sq_sge);
}
-static u32 bnxt_qplib_get_depth(struct bnxt_qplib_q *que)
+u32 bnxt_qplib_get_depth(struct bnxt_qplib_q *que, u8 wqe_mode, bool is_sq)
{
- u8 stride;
+ u32 slots;
- stride = bnxt_qplib_get_stride();
- return (que->wqe_size * que->max_wqe) / stride;
+ /* Queue depth is the number of slots. */
+ slots = (que->wqe_size * que->max_wqe) / sizeof(struct sq_sge);
+ /* For variable WQE mode, need to align the slots to 256 */
+ if (wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE && is_sq)
+ slots = ALIGN(slots, BNXT_VAR_MAX_SLOT_ALIGN);
+ return slots;
}
static u32 _set_sq_size(struct bnxt_qplib_q *que, u8 wqe_mode)
{
/* For Variable mode supply number of 16B slots */
return (wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC) ?
- que->max_wqe : bnxt_qplib_get_depth(que);
+ que->max_wqe : bnxt_qplib_get_depth(que, wqe_mode, true);
}
static u32 _set_sq_max_slot(u8 wqe_mode)
@@ -925,7 +933,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
hwq_attr.res = res;
hwq_attr.sginfo = &sq->sginfo;
hwq_attr.stride = bnxt_qplib_get_stride();
- hwq_attr.depth = bnxt_qplib_get_depth(sq);
+ hwq_attr.depth = bnxt_qplib_get_depth(sq, qp->wqe_mode, false);
hwq_attr.type = HWQ_TYPE_QUEUE;
rc = bnxt_qplib_alloc_init_hwq(&sq->hwq, &hwq_attr);
if (rc)
@@ -949,7 +957,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
hwq_attr.res = res;
hwq_attr.sginfo = &rq->sginfo;
hwq_attr.stride = bnxt_qplib_get_stride();
- hwq_attr.depth = bnxt_qplib_get_depth(rq);
+ hwq_attr.depth = bnxt_qplib_get_depth(rq, qp->wqe_mode, false);
hwq_attr.type = HWQ_TYPE_QUEUE;
rc = bnxt_qplib_alloc_init_hwq(&rq->hwq, &hwq_attr);
if (rc)
@@ -1075,8 +1083,11 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
u32 sqsz;
qp->cctx = res->cctx;
- if (res->dattr)
+ if (res->dattr) {
qp->dev_cap_flags = res->dattr->dev_cap_flags;
+ qp->is_host_msn_tbl = _is_host_msn_table(res->dattr->dev_cap_ext_flags2);
+ }
+
/* General */
req.type = qp->type;
req.dpi = cpu_to_le32(qp->dpi->dpi);
@@ -1087,7 +1098,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
psn_sz = _is_chip_gen_p5_p7(qp->cctx) ?
sizeof(struct sq_psn_search_ext) :
sizeof(struct sq_psn_search);
- if (BNXT_RE_HW_RETX(qp->dev_cap_flags)) {
+ if (qp->is_host_msn_tbl) {
psn_sz = sizeof(struct sq_msn_search);
qp->msn = 0;
}
@@ -1098,12 +1109,12 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
hwq_attr.res = res;
hwq_attr.sginfo = &sq->sginfo;
hwq_attr.stride = bnxt_qplib_get_stride();
- hwq_attr.depth = bnxt_qplib_get_depth(sq);
+ hwq_attr.depth = bnxt_qplib_get_depth(sq, qp->wqe_mode, true);
hwq_attr.aux_stride = psn_sz;
hwq_attr.aux_depth = (psn_sz) ?
_set_sq_size(sq, qp->wqe_mode) : 0;
/* Update msn tbl size */
- if (BNXT_RE_HW_RETX(qp->dev_cap_flags) && psn_sz) {
+ if (qp->is_host_msn_tbl && psn_sz) {
if (qp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC)
hwq_attr.aux_depth = roundup_pow_of_two(_set_sq_size(sq, qp->wqe_mode));
else
@@ -1131,8 +1142,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
req.sq_pg_size_sq_lvl = pg_sz_lvl;
req.sq_fwo_sq_sge = cpu_to_le16(((0 << CMDQ_CREATE_QP_SQ_FWO_SFT) &
CMDQ_CREATE_QP_SQ_FWO_MASK) |
- ((BNXT_RE_HW_RETX(qp->dev_cap_flags)) ?
- BNXT_MSN_TBLE_SGE : sq->max_sge &
+ (sq->max_sge &
CMDQ_CREATE_QP_SQ_SGE_MASK));
req.scq_cid = cpu_to_le32(qp->scq->id);
@@ -1141,7 +1151,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
hwq_attr.res = res;
hwq_attr.sginfo = &rq->sginfo;
hwq_attr.stride = bnxt_qplib_get_stride();
- hwq_attr.depth = bnxt_qplib_get_depth(rq);
+ hwq_attr.depth = bnxt_qplib_get_depth(rq, qp->wqe_mode, false);
hwq_attr.aux_stride = 0;
hwq_attr.aux_depth = 0;
hwq_attr.type = HWQ_TYPE_QUEUE;
@@ -1764,7 +1774,7 @@ static void bnxt_qplib_fill_psn_search(struct bnxt_qplib_qp *qp,
return;
/* Handle MSN differently on cap flags */
- if (BNXT_RE_HW_RETX(qp->dev_cap_flags)) {
+ if (qp->is_host_msn_tbl) {
bnxt_qplib_fill_msn_search(qp, wqe, swq);
return;
}
@@ -1897,7 +1907,7 @@ static u16 _translate_q_full_delta(struct bnxt_qplib_q *que, u16 wqe_bytes)
}
static void bnxt_qplib_pull_psn_buff(struct bnxt_qplib_qp *qp, struct bnxt_qplib_q *sq,
- struct bnxt_qplib_swq *swq, bool hw_retx)
+ struct bnxt_qplib_swq *swq, bool is_host_msn_tbl)
{
struct bnxt_qplib_hwq *sq_hwq;
u32 pg_num, pg_indx;
@@ -1909,8 +1919,11 @@ static void bnxt_qplib_pull_psn_buff(struct bnxt_qplib_qp *qp, struct bnxt_qplib
return;
tail = swq->slot_idx / sq->dbinfo.max_slot;
- if (hw_retx)
+ if (is_host_msn_tbl) {
+ /* For HW retx use qp msn index */
+ tail = qp->msn;
tail %= qp->msn_tbl_sz;
+ }
pg_num = (tail + sq_hwq->pad_pgofft) / (PAGE_SIZE / sq_hwq->pad_stride);
pg_indx = (tail + sq_hwq->pad_pgofft) % (PAGE_SIZE / sq_hwq->pad_stride);
buff = (void *)(sq_hwq->pad_pg[pg_num] + pg_indx * sq_hwq->pad_stride);
@@ -1935,6 +1948,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
struct bnxt_qplib_swq *swq;
bool sch_handler = false;
u16 slots_needed;
+ bool msn_update;
void *base_hdr;
void *ext_hdr;
__le32 temp32;
@@ -1976,7 +1990,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
sw_prod = sq_hwq->prod;
swq = bnxt_qplib_get_swqe(sq, &wqe_idx);
swq->slot_idx = sw_prod;
- bnxt_qplib_pull_psn_buff(qp, sq, swq, BNXT_RE_HW_RETX(qp->dev_cap_flags));
+ bnxt_qplib_pull_psn_buff(qp, sq, swq, qp->is_host_msn_tbl);
swq->wr_id = wqe->wr_id;
swq->type = wqe->type;
@@ -2010,6 +2024,9 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
wqe->num_sge, &sw_prod);
if (data_len < 0)
goto queue_err;
+ /* Make sure we update MSN table only for wired wqes */
+ msn_update = true;
+
/* Specifics */
switch (wqe->type) {
case BNXT_QPLIB_SWQE_TYPE_SEND:
@@ -2064,6 +2081,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
ext_sqe->avid = cpu_to_le32(wqe->send.avid &
SQ_SEND_AVID_MASK);
sq->psn = (sq->psn + 1) & BTH_PSN_MASK;
+ msn_update = false;
} else {
sqe->length = cpu_to_le32(data_len);
if (qp->mtu)
@@ -2157,6 +2175,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
"\tflags = 0x%x\n"
"\tinv_l_key = 0x%x\n",
sqe->wqe_type, sqe->flags, sqe->inv_l_key);
+ msn_update = false;
break;
}
case BNXT_QPLIB_SWQE_TYPE_FAST_REG_MR:
@@ -2207,6 +2226,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
sqe->zero_based_page_size_log, sqe->l_key,
*(u32 *)sqe->length, sqe->numlevels_pbl_page_size_log,
ext_sqe->pblptr, ext_sqe->va);
+ msn_update = false;
break;
}
case BNXT_QPLIB_SWQE_TYPE_BIND_MW:
@@ -2236,6 +2256,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
sqe->wqe_type, sqe->flags, sqe->access_cntl,
sqe->mw_type_zero_based, sqe->parent_l_key,
sqe->l_key, sqe->va, ext_sqe->length_lo);
+ msn_update = false;
break;
}
default:
@@ -2243,8 +2264,10 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
rc = -EINVAL;
goto done;
}
- swq->next_psn = sq->psn & BTH_PSN_MASK;
- bnxt_qplib_fill_psn_search(qp, wqe, swq);
+ if (!qp->is_host_msn_tbl || msn_update) {
+ swq->next_psn = sq->psn & BTH_PSN_MASK;
+ bnxt_qplib_fill_psn_search(qp, wqe, swq);
+ }
queue_err:
bnxt_qplib_swq_mod_start(sq, wqe_idx);
@@ -2859,6 +2882,32 @@ out:
return rc;
}
+static int bnxt_qplib_get_cqe_sq_cons(struct bnxt_qplib_q *sq, u32 cqe_slot)
+{
+ struct bnxt_qplib_hwq *sq_hwq;
+ struct bnxt_qplib_swq *swq;
+ int cqe_sq_cons = -1;
+ u32 start, last;
+
+ sq_hwq = &sq->hwq;
+
+ start = sq->swq_start;
+ last = sq->swq_last;
+
+ while (last != start) {
+ swq = &sq->swq[last];
+ if (swq->slot_idx == cqe_slot) {
+ cqe_sq_cons = swq->next_idx;
+ dev_err(&sq_hwq->pdev->dev, "%s: Found cons wqe = %d slot = %d\n",
+ __func__, cqe_sq_cons, cqe_slot);
+ break;
+ }
+
+ last = swq->next_idx;
+ }
+ return cqe_sq_cons;
+}
+
static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq,
struct cq_req *hwcqe,
struct bnxt_qplib_cqe **pcqe, int *budget,
@@ -2867,8 +2916,9 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq,
struct bnxt_qplib_qp *qp;
struct bnxt_qplib_q *sq;
struct bnxt_qplib_cqe *cqe;
- u32 cqe_sq_cons;
+ u32 cqe_sq_cons, slot_num;
struct bnxt_qplib_swq *swq;
+ int cqe_cons;
int rc = 0;
qp = (struct bnxt_qplib_qp *)le64_to_cpu(hwcqe->qp_handle);
@@ -2880,13 +2930,26 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq,
}
sq = &qp->sq;
- cqe_sq_cons = le16_to_cpu(hwcqe->sq_cons_idx) % sq->max_wqe;
+ cqe_sq_cons = le16_to_cpu(hwcqe->sq_cons_idx) % sq->max_sw_wqe;
if (qp->sq.flushed) {
dev_dbg(&cq->hwq.pdev->dev,
"%s: QPLIB: QP in Flush QP = %p\n", __func__, qp);
goto done;
}
+ if (__is_err_cqe_for_var_wqe(qp, hwcqe->status)) {
+ slot_num = le16_to_cpu(hwcqe->sq_cons_idx);
+ cqe_cons = bnxt_qplib_get_cqe_sq_cons(sq, slot_num);
+ if (cqe_cons < 0) {
+ dev_dbg(&cq->hwq.pdev->dev, "%s: Wrong SQ cons cqe_slot_indx = %d\n",
+ __func__, slot_num);
+ goto done;
+ }
+ cqe_sq_cons = cqe_cons;
+ dev_dbg(&cq->hwq.pdev->dev, "%s: cqe_sq_cons = %d swq_last = %d swq_start = %d\n",
+ __func__, cqe_sq_cons, sq->swq_last, sq->swq_start);
+ }
+
/* Require to walk the sq's swq to fabricate CQEs for all previously
* signaled SWQEs due to CQE aggregation from the current sq cons
* to the cqe_sq_cons
@@ -3329,7 +3392,7 @@ static int bnxt_qplib_cq_process_terminal(struct bnxt_qplib_cq *cq,
if (cqe_cons == 0xFFFF)
goto do_rq;
- cqe_cons %= sq->max_wqe;
+ cqe_cons %= sq->max_sw_wqe;
if (qp->sq.flushed) {
dev_dbg(&cq->hwq.pdev->dev,
"%s: QPLIB: QP in Flush QP = %p\n", __func__, qp);
diff --git a/sys/dev/bnxt/bnxt_re/qplib_fp.h b/sys/dev/bnxt/bnxt_re/qplib_fp.h
index 527c377f0aa5..542a26782c62 100644
--- a/sys/dev/bnxt/bnxt_re/qplib_fp.h
+++ b/sys/dev/bnxt/bnxt_re/qplib_fp.h
@@ -300,6 +300,7 @@ struct bnxt_qplib_q {
struct bnxt_qplib_sg_info sginfo;
struct bnxt_qplib_hwq hwq;
u32 max_wqe;
+ u32 max_sw_wqe;
u16 max_sge;
u16 wqe_size;
u16 q_full_delta;
@@ -390,6 +391,7 @@ struct bnxt_qplib_qp {
u32 msn_tbl_sz;
/* get devflags in PI code */
u16 dev_cap_flags;
+ bool is_host_msn_tbl;
};
@@ -634,5 +636,16 @@ static inline uint64_t bnxt_re_update_msn_tbl(uint32_t st_idx, uint32_t npsn, ui
SQ_MSN_SEARCH_START_PSN_MASK));
}
+static inline bool __is_var_wqe(struct bnxt_qplib_qp *qp)
+{
+ return (qp->wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE);
+}
+
+static inline bool __is_err_cqe_for_var_wqe(struct bnxt_qplib_qp *qp, u8 status)
+{
+ return (status != CQ_REQ_STATUS_OK) && __is_var_wqe(qp);
+}
+
void bnxt_re_schedule_dbq_event(struct bnxt_qplib_res *res);
+u32 bnxt_qplib_get_depth(struct bnxt_qplib_q *que, u8 wqe_mode, bool is_sq);
#endif
diff --git a/sys/dev/bnxt/bnxt_re/qplib_res.c b/sys/dev/bnxt/bnxt_re/qplib_res.c
index f527af031176..9051f4c9f2b7 100644
--- a/sys/dev/bnxt/bnxt_re/qplib_res.c
+++ b/sys/dev/bnxt/bnxt_re/qplib_res.c
@@ -1139,7 +1139,8 @@ int bnxt_qplib_map_db_bar(struct bnxt_qplib_res *res)
ucreg->bar_id = RCFW_DBR_PCI_BAR_REGION;
ucreg->bar_base = pci_resource_start(res->pdev, ucreg->bar_id);
- ucreg->offset = 65536;
+ if (_is_chip_gen_p5(res->cctx))
+ ucreg->offset = 65536;
ucreg->len = ucreg->offset + PAGE_SIZE;
diff --git a/sys/dev/bnxt/bnxt_re/qplib_res.h b/sys/dev/bnxt/bnxt_re/qplib_res.h
index 6468207a49aa..59a8a43ecef6 100644
--- a/sys/dev/bnxt/bnxt_re/qplib_res.h
+++ b/sys/dev/bnxt/bnxt_re/qplib_res.h
@@ -616,6 +616,12 @@ static inline bool _is_hw_retx_supported(u16 dev_cap_flags)
/* Disable HW_RETX */
#define BNXT_RE_HW_RETX(a) _is_hw_retx_supported((a))
+static inline bool _is_host_msn_table(u16 dev_cap_ext_flags2)
+{
+ return (dev_cap_ext_flags2 & CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_MASK) ==
+ CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_HOST_MSN_TABLE;
+}
+
static inline bool _is_cqe_v2_supported(u16 dev_cap_flags)
{
return dev_cap_flags &
@@ -650,7 +656,7 @@ static inline void bnxt_qplib_ring_db32(struct bnxt_qplib_db_info *info,
#define BNXT_QPLIB_INIT_DBHDR(xid, type, indx, toggle) \
(((u64)(((xid) & DBC_DBC_XID_MASK) | DBC_DBC_PATH_ROCE | \
(type) | BNXT_QPLIB_DBR_VALID) << 32) | (indx) | \
- ((toggle) << (BNXT_QPLIB_DBR_TOGGLE_SHIFT)))
+ (((u32)(toggle)) << (BNXT_QPLIB_DBR_TOGGLE_SHIFT)))
static inline void bnxt_qplib_write_db(struct bnxt_qplib_db_info *info,
u64 key, void __iomem *db,
@@ -724,7 +730,7 @@ static inline void bnxt_qplib_armen_db(struct bnxt_qplib_db_info *info,
u64 key = 0;
u8 toggle = 0;
- if (type == DBC_DBC_TYPE_CQ_ARMENA)
+ if (type == DBC_DBC_TYPE_CQ_ARMENA || type == DBC_DBC_TYPE_SRQ_ARMENA)
toggle = info->toggle;
/* Index always at 0 */
key = BNXT_QPLIB_INIT_DBHDR(info->xid, type, 0, toggle);
@@ -746,7 +752,7 @@ static inline void bnxt_qplib_srq_arm_db(struct bnxt_qplib_db_info *info)
u64 key = 0;
/* Index always at 0 */
- key = BNXT_QPLIB_INIT_DBHDR(info->xid, DBC_DBC_TYPE_SRQ_ARM, 0, 0);
+ key = BNXT_QPLIB_INIT_DBHDR(info->xid, DBC_DBC_TYPE_SRQ_ARM, 0, info->toggle);
bnxt_qplib_write_db(info, key, info->priv_db, &info->shadow_key);
}
@@ -837,4 +843,11 @@ static inline void bnxt_qplib_max_res_supported(struct bnxt_qplib_chip_ctx *cctx
break;
}
}
+
+static inline u32 bnxt_re_cap_fw_res(u32 fw_val, u32 drv_cap, bool sw_max_en)
+{
+ if (sw_max_en)
+ return fw_val;
+ return min_t(u32, fw_val, drv_cap);
+}
#endif
diff --git a/sys/dev/bnxt/bnxt_re/qplib_sp.c b/sys/dev/bnxt/bnxt_re/qplib_sp.c
index c414718a816f..f876573ce69f 100644
--- a/sys/dev/bnxt/bnxt_re/qplib_sp.c
+++ b/sys/dev/bnxt/bnxt_re/qplib_sp.c
@@ -40,6 +40,7 @@
#include "qplib_res.h"
#include "qplib_rcfw.h"
#include "qplib_sp.h"
+#include "bnxt_ulp.h"
const struct bnxt_qplib_gid bnxt_qplib_gid_zero = {{ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 }};
@@ -79,6 +80,7 @@ static void bnxt_qplib_query_version(struct bnxt_qplib_rcfw *rcfw, char *fw_ver)
int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw)
{
+ struct bnxt_qplib_max_res dev_res = {};
struct creq_query_func_resp resp = {};
struct bnxt_qplib_cmdqmsg msg = {};
struct creq_query_func_resp_sb *sb;
@@ -86,10 +88,10 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw)
struct bnxt_qplib_dev_attr *attr;
struct bnxt_qplib_chip_ctx *cctx;
struct cmdq_query_func req = {};
+ bool sw_max_en;
u8 *tqm_alloc;
int i, rc = 0;
u32 temp;
- u8 chip_gen = BNXT_RE_DEFAULT;
cctx = rcfw->res->cctx;
attr = rcfw->res->dattr;
@@ -110,10 +112,11 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw)
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
if (rc)
goto bail;
+ bnxt_qplib_max_res_supported(cctx, rcfw->res, &dev_res, false);
+ sw_max_en = BNXT_EN_SW_RES_LMT(rcfw->res->en_dev);
/* Extract the context from the side buffer */
- chip_gen = _get_chip_gen_p5_type(cctx);
- attr->max_qp = le32_to_cpu(sb->max_qp);
- attr->max_qp = min_t(u32, attr->max_qp, BNXT_RE_MAX_QP_SUPPORTED(chip_gen));
+ attr->max_qp = bnxt_re_cap_fw_res(le32_to_cpu(sb->max_qp),
+ dev_res.max_qp, sw_max_en);
/* max_qp value reported by FW does not include the QP1 */
attr->max_qp += 1;
attr->max_qp_rd_atom =
@@ -126,11 +129,6 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw)
* one extra entry while creating the qp
*/
attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr) - 1;
- /* Adjust for max_qp_wqes for variable wqe */
- if (cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE) {
- attr->max_qp_wqes = (BNXT_MAX_SQ_SIZE) /
- (BNXT_MAX_VAR_WQE_SIZE / BNXT_SGE_SIZE) - 1;
- }
if (!_is_chip_gen_p5_p7(cctx)) {
/*
* 128 WQEs needs to be reserved for the HW (8916). Prevent
@@ -138,33 +136,36 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw)
*/
attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS;
}
- attr->max_qp_sges = sb->max_sge;
- if (_is_chip_gen_p5_p7(cctx) &&
- cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE)
- attr->max_qp_sges = sb->max_sge_var_wqe;
- attr->max_cq = le32_to_cpu(sb->max_cq);
- attr->max_cq = min_t(u32, attr->max_cq, BNXT_RE_MAX_CQ_SUPPORTED(chip_gen));
+
+ /* Adjust for max_qp_wqes for variable wqe */
+ if (cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE)
+ attr->max_qp_wqes = BNXT_VAR_MAX_WQE - 1;
+
+ attr->max_qp_sges = cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE ?
+ min_t(u32, sb->max_sge_var_wqe, BNXT_VAR_MAX_SGE) : sb->max_sge;
+ attr->max_cq = bnxt_re_cap_fw_res(le32_to_cpu(sb->max_cq),
+ dev_res.max_cq, sw_max_en);
attr->max_cq_wqes = le32_to_cpu(sb->max_cqe);
attr->max_cq_wqes = min_t(u32, BNXT_QPLIB_MAX_CQ_WQES, attr->max_cq_wqes);
attr->max_cq_sges = attr->max_qp_sges;
- attr->max_mr = le32_to_cpu(sb->max_mr);
- attr->max_mr = min_t(u32, attr->max_mr, BNXT_RE_MAX_MRW_SUPPORTED(chip_gen));
- attr->max_mw = le32_to_cpu(sb->max_mw);
- attr->max_mw = min_t(u32, attr->max_mw, BNXT_RE_MAX_MRW_SUPPORTED(chip_gen));
+ attr->max_mr = bnxt_re_cap_fw_res(le32_to_cpu(sb->max_mr),
+ dev_res.max_mr, sw_max_en);
+ attr->max_mw = bnxt_re_cap_fw_res(le32_to_cpu(sb->max_mw),
+ dev_res.max_mr, sw_max_en);
attr->max_mr_size = le64_to_cpu(sb->max_mr_size);
attr->max_pd = BNXT_QPLIB_MAX_PD;
attr->max_raw_ethy_qp = le32_to_cpu(sb->max_raw_eth_qp);
- attr->max_ah = le32_to_cpu(sb->max_ah);
- attr->max_ah = min_t(u32, attr->max_ah, BNXT_RE_MAX_AH_SUPPORTED(chip_gen));
+ attr->max_ah = bnxt_re_cap_fw_res(le32_to_cpu(sb->max_ah),
+ dev_res.max_ah, sw_max_en);
attr->max_fmr = le32_to_cpu(sb->max_fmr);
attr->max_map_per_fmr = sb->max_map_per_fmr;
- attr->max_srq = le16_to_cpu(sb->max_srq);
- attr->max_srq = min_t(u32, attr->max_srq, BNXT_RE_MAX_SRQ_SUPPORTED(chip_gen));
+ attr->max_srq = bnxt_re_cap_fw_res(le16_to_cpu(sb->max_srq),
+ dev_res.max_srq, sw_max_en);
attr->max_srq_wqes = le32_to_cpu(sb->max_srq_wr) - 1;
attr->max_srq_sges = sb->max_srq_sge;
attr->max_pkey = 1;
@@ -185,6 +186,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw)
attr->page_size_cap = BIT_ULL(28) | BIT_ULL(21) | BIT_ULL(12);
bnxt_qplib_query_version(rcfw, attr->fw_ver);
+ attr->dev_cap_ext_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2);
for (i = 0; i < MAX_TQM_ALLOC_REQ / 4; i++) {
temp = le32_to_cpu(sb->tqm_alloc_reqs[i]);
diff --git a/sys/dev/bnxt/bnxt_re/qplib_sp.h b/sys/dev/bnxt/bnxt_re/qplib_sp.h
index e306db3b9d8e..5a5485dc5250 100644
--- a/sys/dev/bnxt/bnxt_re/qplib_sp.h
+++ b/sys/dev/bnxt/bnxt_re/qplib_sp.h
@@ -32,6 +32,7 @@
#define __BNXT_QPLIB_SP_H__
#include <rdma/ib_verbs.h>
+#include "bnxt_re-abi.h"
#define BNXT_QPLIB_RESERVED_QP_WRS 128
@@ -71,6 +72,7 @@ struct bnxt_qplib_dev_attr {
u32 l2_db_size;
u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ];
u8 is_atomic;
+ u16 dev_cap_ext_flags2;
u16 dev_cap_flags;
u64 page_size_cap;
u32 max_dpi;
@@ -394,6 +396,13 @@ bool ib_modify_qp_is_ok_compat(enum ib_qp_state cur_state, enum ib_qp_state next
#define BNXT_MAX_VAR_WQE_SIZE 512
#define BNXT_SGE_SIZE 16
+#define BNXT_VAR_MAX_WQE 4352
+#define BNXT_VAR_MAX_SLOT_ALIGN 256
+#define BNXT_VAR_MAX_SGE 13
+#define BNXT_RE_MAX_RQ_WQES 65536
+
+#define BNXT_STATIC_MAX_SGE 6
+
/* PF defines */
#define BNXT_RE_MAX_QP_SUPPORTED(chip_gen) \
chip_gen == BNXT_RE_DEFAULT ? (64 * 1024) : 0
diff --git a/sys/dev/clk/allwinner/ccu_h616.c b/sys/dev/clk/allwinner/ccu_h616.c
new file mode 100644
index 000000000000..ea112fbf8ea4
--- /dev/null
+++ b/sys/dev/clk/allwinner/ccu_h616.c
@@ -0,0 +1,493 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Emmanuel Vadot <manu@freebsd.org>
+ * Copyright (c) 2025 The FreeBSD Foundation
+ *
+ * Portions of this file were written by Tom Jones <thj@freebsd.org> under
+ * sponsorship from The FreeBSD Foundation.
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <machine/bus.h>
+
+#include <dev/fdt/simplebus.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <dev/clk/clk_div.h>
+#include <dev/clk/clk_fixed.h>
+#include <dev/clk/clk_mux.h>
+
+#include <dev/clk/allwinner/aw_ccung.h>
+
+#include <dt-bindings/clock/sun50i-h616-ccu.h>
+#include <dt-bindings/reset/sun50i-h616-ccu.h>
+
+/* Non-exported clocks */
+#define CLK_OSC_24M 0
+#define CLK_PLL_CPUX 1
+#define CLK_PLL_AUDIO 2
+#define CLK_PLL_PERIPH0_2X 4
+#define CLK_PLL_PERIPH1_2X 5
+#define CLK_PLL_PERIPH1 6
+#define CLK_PLL_VIDEO0_4X 8
+#define CLK_PLL_VIDEO1_4X 9
+#define CLK_PLL_VIDEO0 10
+#define CLK_PLL_VIDEO1 12
+#define CLK_PLL_VIDEO2 12
+#define CLK_PLL_VE 14
+#define CLK_PLL_DDR0 9
+#define CLK_PLL_DDR1 9
+#define CLK_PLL_DE 14
+#define CLK_PLL_GPU 16
+
+#define CLK_PSI_AHB1_AHB2 24
+#define CLK_AHB3 25
+#define CLK_APB2 27
+
+static struct aw_ccung_reset h616_ccu_resets[] = {
+ /* PSI_BGR_REG */
+ CCU_RESET(RST_BUS_PSI, 0x79c, 16)
+
+ /* SMHC_BGR_REG */
+ CCU_RESET(RST_BUS_MMC0, 0x84c, 16)
+ CCU_RESET(RST_BUS_MMC1, 0x84c, 17)
+ CCU_RESET(RST_BUS_MMC2, 0x84c, 18)
+
+ /* UART_BGR_REG */
+ CCU_RESET(RST_BUS_UART0, 0x90c, 16)
+ CCU_RESET(RST_BUS_UART1, 0x90c, 17)
+ CCU_RESET(RST_BUS_UART2, 0x90c, 18)
+ CCU_RESET(RST_BUS_UART3, 0x90c, 19)
+ CCU_RESET(RST_BUS_UART4, 0x90c, 20)
+ CCU_RESET(RST_BUS_UART5, 0x90c, 21)
+
+ /* TWI_BGR_REG */
+ CCU_RESET(RST_BUS_I2C0, 0x91c, 16)
+ CCU_RESET(RST_BUS_I2C1, 0x91c, 17)
+ CCU_RESET(RST_BUS_I2C2, 0x91c, 18)
+ CCU_RESET(RST_BUS_I2C3, 0x91c, 19)
+ CCU_RESET(RST_BUS_I2C4, 0x91c, 20)
+
+ /* EMAC_BGR_REG */
+ CCU_RESET(RST_BUS_EMAC0, 0x97c, 16)
+ CCU_RESET(RST_BUS_EMAC1, 0x97c, 17)
+
+ /* USB0_CLK_REG */
+ CCU_RESET(RST_USB_PHY0, 0xa70, 30)
+
+ /* USB1_CLK_REG */
+ CCU_RESET(RST_USB_PHY1, 0xa74, 30)
+
+ /* USB2_CLK_REG */
+ CCU_RESET(RST_USB_PHY2, 0xa78, 30)
+
+ /* USB2_CLK_REG */
+ CCU_RESET(RST_USB_PHY3, 0xa7c, 30)
+
+ /* USB_BGR_REG */
+ CCU_RESET(RST_BUS_OHCI0, 0xa8c, 16)
+ CCU_RESET(RST_BUS_OHCI1, 0xa8c, 17)
+ CCU_RESET(RST_BUS_OHCI2, 0xa8c, 18)
+ CCU_RESET(RST_BUS_OHCI3, 0xa8c, 19)
+ CCU_RESET(RST_BUS_EHCI0, 0xa8c, 20)
+ CCU_RESET(RST_BUS_EHCI1, 0xa8c, 21)
+ CCU_RESET(RST_BUS_EHCI2, 0xa8c, 22)
+ CCU_RESET(RST_BUS_EHCI3, 0xa8c, 23)
+ CCU_RESET(RST_BUS_OTG, 0xa8c, 24)
+};
+
+static struct aw_ccung_gate h616_ccu_gates[] = {
+ /* PSI_BGR_REG */
+ CCU_GATE(CLK_BUS_PSI, "bus-psi", "psi_ahb1_ahb2", 0x79c, 0)
+
+ /* SMHC_BGR_REG */
+ CCU_GATE(CLK_BUS_MMC0, "bus-mmc0", "ahb3", 0x84c, 0)
+ CCU_GATE(CLK_BUS_MMC1, "bus-mmc1", "ahb3", 0x84c, 1)
+ CCU_GATE(CLK_BUS_MMC2, "bus-mmc2", "ahb3", 0x84c, 2)
+
+ /*
+ * XXX-THJ: Inheritied comment from H6:
+ * UART_BGR_REG Enabling the gate enable weird behavior ...
+ */
+ /* CCU_GATE(CLK_BUS_UART0, "bus-uart0", "apb2", 0x90c, 0) */
+ /* CCU_GATE(CLK_BUS_UART1, "bus-uart1", "apb2", 0x90c, 1) */
+ /* CCU_GATE(CLK_BUS_UART2, "bus-uart2", "apb2", 0x90c, 2) */
+ /* CCU_GATE(CLK_BUS_UART3, "bus-uart3", "apb2", 0x90c, 3) */
+ /* CCU_GATE(CLK_BUS_UART4, "bus-uart4", "apb2", 0x90c, 4) */
+ /* CCU_GATE(CLK_BUS_UART5, "bus-uart5", "apb2", 0x90c, 5) */
+
+ /* TWI_BGR_REG */
+ CCU_GATE(CLK_BUS_I2C0, "bus-i2c0", "apb2", 0x91c, 0)
+ CCU_GATE(CLK_BUS_I2C1, "bus-i2c1", "apb2", 0x91c, 1)
+ CCU_GATE(CLK_BUS_I2C2, "bus-i2c2", "apb2", 0x91c, 2)
+ CCU_GATE(CLK_BUS_I2C3, "bus-i2c3", "apb2", 0x91c, 3)
+
+ /* EMAC_BGR_REG */
+ CCU_GATE(CLK_BUS_EMAC0, "bus-emac0", "ahb3", 0x97c, 0)
+ CCU_GATE(CLK_BUS_EMAC1, "bus-emac1", "ahb3", 0x97c, 1)
+
+ /* USB0_CLK_REG */
+ CCU_GATE(CLK_USB_PHY0, "usb-phy0", "ahb3", 0xa70, 29)
+ CCU_GATE(CLK_USB_OHCI0, "usb-ohci0", "ahb3", 0xa70, 31)
+
+ /* USB1_CLK_REG */
+ CCU_GATE(CLK_USB_PHY1, "usb-phy1", "ahb3", 0xa74, 29)
+ CCU_GATE(CLK_USB_OHCI1, "usb-ohci1", "ahb3", 0xa74, 31)
+
+ /* USB2_CLK_REG */
+ CCU_GATE(CLK_USB_PHY2, "usb-phy2", "ahb3", 0xa78, 29)
+ CCU_GATE(CLK_USB_OHCI2, "usb-ohci2", "ahb3", 0xa78, 31)
+
+ /* USB3_CLK_REG */
+ CCU_GATE(CLK_USB_PHY3, "usb-phy3", "ahb3", 0xa7c, 29)
+ CCU_GATE(CLK_USB_OHCI3, "usb-ohci3", "ahb3", 0xa7c, 31)
+
+ /* USB_BGR_REG */
+ CCU_GATE(CLK_BUS_OHCI0, "bus-ohchi0", "ahb3", 0xa8c, 0)
+ CCU_GATE(CLK_BUS_OHCI1, "bus-ohchi1", "ahb3", 0xa8c, 1)
+ CCU_GATE(CLK_BUS_OHCI2, "bus-ohchi2", "ahb3", 0xa8c, 2)
+ CCU_GATE(CLK_BUS_OHCI3, "bus-ohchi3", "ahb3", 0xa8c, 3)
+ CCU_GATE(CLK_BUS_EHCI0, "bus-ehchi0", "ahb3", 0xa8c, 4)
+ CCU_GATE(CLK_BUS_EHCI1, "bus-ehchi1", "ahb3", 0xa8c, 5)
+ CCU_GATE(CLK_BUS_EHCI2, "bus-ehchi2", "ahb3", 0xa8c, 6)
+ CCU_GATE(CLK_BUS_EHCI3, "bus-ehchi3", "ahb3", 0xa8c, 7)
+ CCU_GATE(CLK_BUS_OTG, "bus-otg", "ahb3", 0xa8c, 8)
+};
+
+static const char *pll_cpux_parents[] = {"osc24M"};
+NP_CLK(pll_cpux_clk,
+ CLK_PLL_CPUX, /* id */
+ "pll_cpux", pll_cpux_parents, /* name, parents */
+ 0x00, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 16, 2, 0, 0, /* p factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+
+static const char *pll_ddr0_parents[] = {"osc24M"};
+NMM_CLK(pll_ddr0_clk,
+ CLK_PLL_DDR0, /* id */
+ "pll_ddr0", pll_ddr0_parents, /* name, parents */
+ 0x10, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+
+static const char *pll_ddr1_parents[] = {"osc24M"};
+NMM_CLK(pll_ddr1_clk,
+ CLK_PLL_DDR1, /* id */
+ "pll_ddr1", pll_ddr1_parents, /* name, parents */
+ 0x18, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+
+static const char *pll_peri0_2x_parents[] = {"osc24M"};
+NMM_CLK(pll_peri0_2x_clk,
+ CLK_PLL_PERIPH0_2X, /* id */
+ "pll_periph0_2x", pll_peri0_2x_parents, /* name, parents */
+ 0x20, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+static const char *pll_peri0_parents[] = {"pll_periph0_2x"};
+FIXED_CLK(pll_peri0_clk,
+ CLK_PLL_PERIPH0, /* id */
+ "pll_periph0", /* name */
+ pll_peri0_parents, /* parent */
+ 0, /* freq */
+ 1, /* mult */
+ 2, /* div */
+ 0); /* flags */
+
+static const char *pll_peri1_2x_parents[] = {"osc24M"};
+NMM_CLK(pll_peri1_2x_clk,
+ CLK_PLL_PERIPH1_2X, /* id */
+ "pll_periph1_2x", pll_peri1_2x_parents, /* name, parents */
+ 0x28, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+static const char *pll_peri1_parents[] = {"pll_periph1_2x"};
+FIXED_CLK(pll_peri1_clk,
+ CLK_PLL_PERIPH1, /* id */
+ "pll_periph1", /* name */
+ pll_peri1_parents, /* parent */
+ 0, /* freq */
+ 1, /* mult */
+ 2, /* div */
+ 0); /* flags */
+
+static const char *pll_gpu_parents[] = {"osc24M"};
+NMM_CLK(pll_gpu_clk,
+ CLK_PLL_GPU, /* id */
+ "pll_gpu", pll_gpu_parents, /* name, parents */
+ 0x30, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+
+static const char *pll_video0_4x_parents[] = {"osc24M"};
+NMM_CLK(pll_video0_4x_clk,
+ CLK_PLL_VIDEO0_4X, /* id */
+ "pll_video0_4x", pll_video0_4x_parents, /* name, parents */
+ 0x40, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+static const char *pll_video0_parents[] = {"pll_video0_4x"};
+FIXED_CLK(pll_video0_clk,
+ CLK_PLL_VIDEO0, /* id */
+ "pll_video0", /* name */
+ pll_video0_parents, /* parent */
+ 0, /* freq */
+ 1, /* mult */
+ 4, /* div */
+ 0); /* flags */
+
+static const char *pll_video1_4x_parents[] = {"osc24M"};
+NMM_CLK(pll_video1_4x_clk,
+ CLK_PLL_VIDEO1_4X, /* id */
+ "pll_video1_4x", pll_video1_4x_parents, /* name, parents */
+ 0x48, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+static const char *pll_video1_parents[] = {"pll_video1_4x"};
+FIXED_CLK(pll_video1_clk,
+ CLK_PLL_VIDEO1, /* id */
+ "pll_video1", /* name */
+ pll_video1_parents, /* parent */
+ 0, /* freq */
+ 1, /* mult */
+ 4, /* div */
+ 0); /* flags */
+
+static const char *pll_video2_4x_parents[] = {"osc24M"};
+NMM_CLK(pll_video2_4x_clk,
+ CLK_PLL_VIDEO1_4X, /* id */
+ "pll_video2_4x", pll_video2_4x_parents, /* name, parents */
+ 0x50, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+static const char *pll_video2_parents[] = {"pll_video2_4x"};
+FIXED_CLK(pll_video2_clk,
+ CLK_PLL_VIDEO1, /* id */
+ "pll_video2", /* name */
+ pll_video2_parents, /* parent */
+ 0, /* freq */
+ 1, /* mult */
+ 4, /* div */
+ 0); /* flags */
+
+static const char *pll_ve_parents[] = {"osc24M"};
+NMM_CLK(pll_ve_clk,
+ CLK_PLL_VE, /* id */
+ "pll_ve", pll_ve_parents, /* name, parents */
+ 0x58, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+
+static const char *pll_de_parents[] = {"osc24M"};
+NMM_CLK(pll_de_clk,
+ CLK_PLL_DE, /* id */
+ "pll_de", pll_de_parents, /* name, parents */
+ 0x60, /* offset */
+ 8, 8, 0, 0, /* n factor */
+ 0, 1, 0, 0, /* m0 factor */
+ 1, 1, 0, 0, /* m1 factor */
+ 31, /* gate */
+ 28, 1000, /* lock */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */
+
+/* PLL_AUDIO missing */
+// in h616 datasheet
+
+/* CPUX_AXI missing */
+// in h616 datasheet
+
+static const char *psi_ahb1_ahb2_parents[] = {"osc24M", "osc32k", "iosc", "pll_periph0"};
+NM_CLK(psi_ahb1_ahb2_clk,
+ CLK_PSI_AHB1_AHB2, "psi_ahb1_ahb2", psi_ahb1_ahb2_parents, /* id, name, parents */
+ 0x510, /* offset */
+ 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */
+ 0, 2, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 0, /* gate */
+ AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */
+
+static const char *ahb3_parents[] = {"osc24M", "osc32k", "psi_ahb1_ahb2", "pll_periph0"};
+NM_CLK(ahb3_clk,
+ CLK_AHB3, "ahb3", ahb3_parents, /* id, name, parents */
+ 0x51C, /* offset */
+ 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */
+ 0, 2, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 0, /* gate */
+ AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */
+
+static const char *apb1_parents[] = {"osc24M", "osc32k", "psi_ahb1_ahb2", "pll_periph0"};
+NM_CLK(apb1_clk,
+ CLK_APB1, "apb1", apb1_parents, /* id, name, parents */
+ 0x520, /* offset */
+ 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */
+ 0, 2, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 0, /* gate */
+ AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */
+
+static const char *apb2_parents[] = {"osc24M", "osc32k", "psi_ahb1_ahb2", "pll_periph0"};
+NM_CLK(apb2_clk,
+ CLK_APB2, "apb2", apb2_parents, /* id, name, parents */
+ 0x524, /* offset */
+ 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */
+ 0, 2, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 0, /* gate */
+ AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */
+
+/* Missing MBUS clock */
+
+static const char *mod_parents[] = {"osc24M", "pll_periph0_2x", "pll_periph1_2x"};
+NM_CLK(mmc0_clk,
+ CLK_MMC0, "mmc0", mod_parents, /* id, name, parents */
+ 0x830, /* offset */
+ 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */
+ 0, 4, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 31, /* gate */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_MUX |
+ AW_CLK_REPARENT); /* flags */
+
+NM_CLK(mmc1_clk,
+ CLK_MMC1, "mmc1", mod_parents, /* id, name, parents */
+ 0x834, /* offset */
+ 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */
+ 0, 4, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 31, /* gate */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_MUX |
+ AW_CLK_REPARENT); /* flags */
+
+NM_CLK(mmc2_clk,
+ CLK_MMC2, "mmc2", mod_parents, /* id, name, parents */
+ 0x838, /* offset */
+ 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */
+ 0, 4, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 31, /* gate */
+ AW_CLK_HAS_GATE | AW_CLK_HAS_MUX |
+ AW_CLK_REPARENT); /* flags */
+
+static struct aw_ccung_clk h616_ccu_clks[] = {
+ { .type = AW_CLK_NP, .clk.np = &pll_cpux_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_ddr0_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_ddr1_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_peri0_2x_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_peri1_2x_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_gpu_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_video0_4x_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_video1_4x_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_video2_4x_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_ve_clk},
+ { .type = AW_CLK_NMM, .clk.nmm = &pll_de_clk},
+
+ { .type = AW_CLK_NM, .clk.nm = &psi_ahb1_ahb2_clk},
+ { .type = AW_CLK_NM, .clk.nm = &ahb3_clk},
+ { .type = AW_CLK_NM, .clk.nm = &apb1_clk},
+ { .type = AW_CLK_NM, .clk.nm = &apb2_clk},
+
+ { .type = AW_CLK_NM, .clk.nm = &mmc0_clk},
+ { .type = AW_CLK_NM, .clk.nm = &mmc1_clk},
+ { .type = AW_CLK_NM, .clk.nm = &mmc2_clk},
+
+ { .type = AW_CLK_FIXED, .clk.fixed = &pll_peri0_clk},
+ { .type = AW_CLK_FIXED, .clk.fixed = &pll_peri1_clk},
+ { .type = AW_CLK_FIXED, .clk.fixed = &pll_video0_clk},
+ { .type = AW_CLK_FIXED, .clk.fixed = &pll_video1_clk},
+ { .type = AW_CLK_FIXED, .clk.fixed = &pll_video2_clk},
+};
+
+static int
+ccu_h616_probe(device_t dev)
+{
+
+ if (!ofw_bus_status_okay(dev))
+ return (ENXIO);
+
+ if (!ofw_bus_is_compatible(dev, "allwinner,sun50i-h616-ccu"))
+ return (ENXIO);
+
+ device_set_desc(dev, "Allwinner H616 Clock Control Unit");
+ return (BUS_PROBE_DEFAULT);
+}
+
+static int
+ccu_h616_attach(device_t dev)
+{
+ struct aw_ccung_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ sc->resets = h616_ccu_resets;
+ sc->nresets = nitems(h616_ccu_resets);
+ sc->gates = h616_ccu_gates;
+ sc->ngates = nitems(h616_ccu_gates);
+ sc->clks = h616_ccu_clks;
+ sc->nclks = nitems(h616_ccu_clks);
+
+ return (aw_ccung_attach(dev));
+}
+
+static device_method_t ccu_h616ng_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, ccu_h616_probe),
+ DEVMETHOD(device_attach, ccu_h616_attach),
+
+ DEVMETHOD_END
+};
+
+DEFINE_CLASS_1(ccu_h616ng, ccu_h616ng_driver, ccu_h616ng_methods,
+ sizeof(struct aw_ccung_softc), aw_ccung_driver);
+
+EARLY_DRIVER_MODULE(ccu_h616ng, simplebus, ccu_h616ng_driver, 0, 0,
+ BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 3237c6649713..e35bb9f64951 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -900,6 +900,7 @@ static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS);
static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS);
static int sysctl_cpus(SYSCTL_HANDLER_ARGS);
static int sysctl_reset(SYSCTL_HANDLER_ARGS);
+static int sysctl_tcb_cache(SYSCTL_HANDLER_ARGS);
#ifdef TCP_OFFLOAD
static int sysctl_tls(SYSCTL_HANDLER_ARGS);
static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS);
@@ -8119,6 +8120,12 @@ t4_sysctls(struct adapter *sc)
sysctl_wcwr_stats, "A", "write combined work requests");
}
+ if (chip_id(sc) >= CHELSIO_T7) {
+ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tcb_cache",
+ CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_tcb_cache, "I",
+ "1 = enabled (default), 0 = disabled (for debug only)");
+ }
+
#ifdef KERN_TLS
if (is_ktls(sc)) {
/*
@@ -12204,6 +12211,40 @@ sysctl_reset(SYSCTL_HANDLER_ARGS)
return (0);
}
+static int
+sysctl_tcb_cache(SYSCTL_HANDLER_ARGS)
+{
+ struct adapter *sc = arg1;
+ u_int val, v;
+ int rc;
+
+ mtx_lock(&sc->reg_lock);
+ if (hw_off_limits(sc)) {
+ rc = ENXIO;
+ goto done;
+ }
+ t4_tp_pio_read(sc, &v, 1, A_TP_CMM_CONFIG, 1);
+ mtx_unlock(&sc->reg_lock);
+
+ val = v & F_GLFL ? 0 : 1;
+ rc = sysctl_handle_int(oidp, &val, 0, req);
+ if (rc != 0 || req->newptr == NULL)
+ return (rc);
+ if (val == 0)
+ v |= F_GLFL;
+ else
+ v &= ~F_GLFL;
+
+ mtx_lock(&sc->reg_lock);
+ if (hw_off_limits(sc))
+ rc = ENXIO;
+ else
+ t4_tp_pio_write(sc, &v, 1, A_TP_CMM_CONFIG, 1);
+done:
+ mtx_unlock(&sc->reg_lock);
+ return (rc);
+}
+
#ifdef TCP_OFFLOAD
static int
sysctl_tls(SYSCTL_HANDLER_ARGS)
diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c
index 0135bec6e2c1..a858867239c6 100644
--- a/sys/dev/cxgbe/t4_netmap.c
+++ b/sys/dev/cxgbe/t4_netmap.c
@@ -606,10 +606,8 @@ cxgbe_netmap_split_rss(struct adapter *sc, struct vi_info *vi,
(nm_state == NM_OFF && nm_kring_pending_on(kring))) {
MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID);
nactive[j]++;
- if (dq[j] == -1) {
+ if (dq[j] == -1)
dq[j] = nm_rxq->iq_abs_id;
- break;
- }
}
}
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index b6d44792dce4..af18b3019760 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -828,12 +828,17 @@ t4_tweak_chip_settings(struct adapter *sc)
t4_set_reg_field(sc, A_SGE_ITP_CONTROL, m, v);
if (sc->debug_flags & DF_DISABLE_TCB_CACHE) {
- m = V_RDTHRESHOLD(M_RDTHRESHOLD) | F_WRTHRTHRESHEN |
- V_WRTHRTHRESH(M_WRTHRTHRESH);
t4_tp_pio_read(sc, &v, 1, A_TP_CMM_CONFIG, 1);
- v &= ~m;
- v |= V_RDTHRESHOLD(1) | F_WRTHRTHRESHEN |
- V_WRTHRTHRESH(16);
+ if (chip_id(sc) >= CHELSIO_T7) {
+ v |= F_GLFL;
+ } else {
+ m = V_RDTHRESHOLD(M_RDTHRESHOLD) |
+ F_WRTHRTHRESHEN |
+ V_WRTHRTHRESH(M_WRTHRTHRESH);
+ v &= ~m;
+ v |= V_RDTHRESHOLD(1) | F_WRTHRTHRESHEN |
+ V_WRTHRTHRESH(16);
+ }
t4_tp_pio_write(sc, &v, 1, A_TP_CMM_CONFIG, 1);
}
}
diff --git a/sys/dev/dpaa/bman_fdt.c b/sys/dev/dpaa/bman_fdt.c
index dffec52d5248..34b29ad6e236 100644
--- a/sys/dev/dpaa/bman_fdt.c
+++ b/sys/dev/dpaa/bman_fdt.c
@@ -136,25 +136,6 @@ bman_portals_fdt_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
}
-static phandle_t
-bman_portal_find_cpu(int cpu)
-{
- phandle_t node;
- pcell_t reg;
-
- node = OF_finddevice("/cpus");
- if (node == -1)
- return (node);
-
- for (node = OF_child(node); node != 0; node = OF_peer(node)) {
- if (OF_getprop(node, "reg", &reg, sizeof(reg)) <= 0)
- continue;
- if (reg == cpu)
- return (node);
- }
- return (-1);
-}
-
static int
bman_portals_fdt_attach(device_t dev)
{
@@ -185,17 +166,15 @@ bman_portals_fdt_attach(device_t dev)
}
/* Checkout related cpu */
if (OF_getprop(child, "cpu-handle", (void *)&cpu,
- sizeof(cpu)) <= 0) {
- cpu = bman_portal_find_cpu(cpus);
- if (cpu <= 0)
- continue;
- }
- /* Acquire cpu number */
- cpu_node = OF_instance_to_package(cpu);
- if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
- device_printf(dev, "Could not retrieve CPU number.\n");
- return (ENXIO);
- }
+ sizeof(cpu)) > 0) {
+ cpu_node = OF_instance_to_package(cpu);
+ /* Acquire cpu number */
+ if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
+ device_printf(dev, "Could not retrieve CPU number.\n");
+ return (ENXIO);
+ }
+ } else
+ cpu_num = cpus;
cpus++;
diff --git a/sys/dev/dpaa/qman_fdt.c b/sys/dev/dpaa/qman_fdt.c
index 3f22ea4d651a..35016073ba0e 100644
--- a/sys/dev/dpaa/qman_fdt.c
+++ b/sys/dev/dpaa/qman_fdt.c
@@ -136,25 +136,6 @@ qman_portals_fdt_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
}
-static phandle_t
-qman_portal_find_cpu(int cpu)
-{
- phandle_t node;
- pcell_t reg;
-
- node = OF_finddevice("/cpus");
- if (node == -1)
- return (-1);
-
- for (node = OF_child(node); node != 0; node = OF_peer(node)) {
- if (OF_getprop(node, "reg", &reg, sizeof(reg)) <= 0)
- continue;
- if (reg == cpu)
- return (node);
- }
- return (-1);
-}
-
static int
qman_portals_fdt_attach(device_t dev)
{
@@ -213,18 +194,15 @@ qman_portals_fdt_attach(device_t dev)
}
/* Checkout related cpu */
if (OF_getprop(child, "cpu-handle", (void *)&cpu,
- sizeof(cpu)) <= 0) {
- cpu = qman_portal_find_cpu(cpus);
- if (cpu <= 0)
- continue;
- }
- /* Acquire cpu number */
- cpu_node = OF_instance_to_package(cpu);
- if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
- device_printf(dev, "Could not retrieve CPU number.\n");
- return (ENXIO);
- }
-
+ sizeof(cpu)) > 0) {
+ cpu_node = OF_instance_to_package(cpu);
+ /* Acquire cpu number */
+ if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
+ device_printf(dev, "Could not retrieve CPU number.\n");
+ return (ENXIO);
+ }
+ } else
+ cpu_num = cpus;
cpus++;
if (ofw_bus_gen_setup_devinfo(&ofw_di, child) != 0) {
diff --git a/sys/dev/dpaa2/dpaa2_ni.c b/sys/dev/dpaa2/dpaa2_ni.c
index 98a6c6047188..c72e68b8a62f 100644
--- a/sys/dev/dpaa2/dpaa2_ni.c
+++ b/sys/dev/dpaa2/dpaa2_ni.c
@@ -220,6 +220,9 @@ MALLOC_DEFINE(M_DPAA2_TXB, "dpaa2_txb", "DPAA2 DMA-mapped buffer (Tx)");
#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
#define RXH_DISCARD (1 << 31)
+/* Transmit checksum offload */
+#define DPAA2_CSUM_TX_OFFLOAD (CSUM_IP | CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6)
+
/* Default Rx hash options, set during attaching. */
#define DPAA2_RXH_DEFAULT (RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)
@@ -559,6 +562,7 @@ dpaa2_ni_attach(device_t dev)
if_settransmitfn(ifp, dpaa2_ni_transmit);
if_setqflushfn(ifp, dpaa2_ni_qflush);
+ if_sethwassist(sc->ifp, DPAA2_CSUM_TX_OFFLOAD);
if_setcapabilities(ifp, IFCAP_VLAN_MTU | IFCAP_HWCSUM |
IFCAP_HWCSUM_IPV6 | IFCAP_JUMBO_MTU);
if_setcapenable(ifp, if_getcapabilities(ifp));
@@ -2528,6 +2532,7 @@ dpaa2_ni_transmit(if_t ifp, struct mbuf *m)
ch = sc->channels[chidx];
error = buf_ring_enqueue(ch->xmit_br, m);
if (__predict_false(error != 0)) {
+ if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
m_freem(m);
} else {
taskqueue_enqueue(ch->cleanup_tq, &ch->cleanup_task);
@@ -2598,25 +2603,11 @@ dpaa2_ni_ioctl(if_t ifp, u_long c, caddr_t data)
break;
case SIOCSIFCAP:
changed = if_getcapenable(ifp) ^ ifr->ifr_reqcap;
- if (changed & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) {
- if ((ifr->ifr_reqcap & changed) &
- (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) {
- if_setcapenablebit(ifp,
- IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6, 0);
- } else {
- if_setcapenablebit(ifp, 0,
- IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
- }
- }
- if (changed & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) {
- if ((ifr->ifr_reqcap & changed) &
- (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) {
- if_setcapenablebit(ifp,
- IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6, 0);
- } else {
- if_setcapenablebit(ifp, 0,
- IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6);
- }
+ if ((changed & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) != 0)
+ if_togglecapenable(ifp, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
+ if ((changed & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0) {
+ if_togglecapenable(ifp, IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6);
+ if_togglehwassist(ifp, DPAA2_CSUM_TX_OFFLOAD);
}
rc = dpaa2_ni_setup_if_caps(sc);
@@ -2953,6 +2944,8 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
bus_dma_segment_t segs[DPAA2_TX_SEGLIMIT];
int rc, nsegs;
int error;
+ int len;
+ bool mcast;
mtx_assert(&tx->lock, MA_NOTOWNED);
mtx_lock(&tx->lock);
@@ -2967,6 +2960,8 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
buf->m = m;
sgt = buf->sgt;
}
+ len = m->m_pkthdr.len;
+ mcast = (m->m_flags & M_MCAST) != 0;
#if defined(INVARIANTS)
struct dpaa2_ni_tx_ring *btx = (struct dpaa2_ni_tx_ring *)buf->opt;
@@ -2984,6 +2979,7 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
if (md == NULL) {
device_printf(dev, "%s: m_collapse() failed\n", __func__);
fq->chan->tx_dropped++;
+ if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
goto err;
}
@@ -2994,6 +2990,7 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
device_printf(dev, "%s: bus_dmamap_load_mbuf_sg() "
"failed: error=%d\n", __func__, error);
fq->chan->tx_dropped++;
+ if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
goto err;
}
}
@@ -3003,6 +3000,7 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
device_printf(dev, "%s: failed to build frame descriptor: "
"error=%d\n", __func__, error);
fq->chan->tx_dropped++;
+ if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
goto err_unload;
}
@@ -3020,8 +3018,13 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
if (rc != 1) {
fq->chan->tx_dropped++;
+ if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
goto err_unload;
} else {
+ if (mcast)
+ if_inc_counter(sc->ifp, IFCOUNTER_OMCASTS, 1);
+ if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1);
+ if_inc_counter(sc->ifp, IFCOUNTER_OBYTES, len);
fq->chan->tx_frames++;
}
return;
@@ -3200,6 +3203,7 @@ dpaa2_ni_rx(struct dpaa2_channel *ch, struct dpaa2_ni_fq *fq, struct dpaa2_fd *f
m->m_pkthdr.rcvif = sc->ifp;
m->m_pkthdr.flowid = fq->fqid;
M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
+ if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1);
if (ctx->head == NULL) {
KASSERT(ctx->tail == NULL, ("%s: tail already given?", __func__));
diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c
index 5e2ca216b3c0..f57a19e8a112 100644
--- a/sys/dev/dwc/if_dwc.c
+++ b/sys/dev/dwc/if_dwc.c
@@ -265,18 +265,14 @@ dwc_ioctl(if_t ifp, u_long cmd, caddr_t data)
}
if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))
if_togglecapenable(ifp, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
- if (mask & IFCAP_TXCSUM)
+ if (mask & IFCAP_TXCSUM) {
if_togglecapenable(ifp, IFCAP_TXCSUM);
- if ((if_getcapenable(ifp) & IFCAP_TXCSUM) != 0)
- if_sethwassistbits(ifp, CSUM_IP | CSUM_DELAY_DATA, 0);
- else
- if_sethwassistbits(ifp, 0, CSUM_IP | CSUM_DELAY_DATA);
- if (mask & IFCAP_TXCSUM_IPV6)
+ if_togglehwassist(ifp, CSUM_IP | CSUM_DELAY_DATA);
+ }
+ if (mask & IFCAP_TXCSUM_IPV6) {
if_togglecapenable(ifp, IFCAP_TXCSUM_IPV6);
- if ((if_getcapenable(ifp) & IFCAP_TXCSUM_IPV6) != 0)
- if_sethwassistbits(ifp, CSUM_DELAY_DATA_IPV6, 0);
- else
- if_sethwassistbits(ifp, 0, CSUM_DELAY_DATA_IPV6);
+ if_togglehwassist(ifp, CSUM_DELAY_DATA_IPV6);
+ }
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
DWC_LOCK(sc);
diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c
index 647255417b3e..b86222e363e9 100644
--- a/sys/dev/e1000/em_txrx.c
+++ b/sys/dev/e1000/em_txrx.c
@@ -836,6 +836,6 @@ em_determine_rsstype(uint32_t pkt_info)
case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX:
return M_HASHTYPE_RSS_TCP_IPV6_EX;
default:
- return M_HASHTYPE_OPAQUE;
+ return M_HASHTYPE_NONE;
}
}
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 7d7655a7ae6f..4d7bc794a0b2 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -2106,11 +2106,11 @@ em_if_set_promisc(if_ctx_t ctx, int flags)
if (flags & IFF_PROMISC) {
reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
- em_if_vlan_filter_disable(sc);
/* Turn this on if you want to see bad packets */
if (em_debug_sbp)
reg_rctl |= E1000_RCTL_SBP;
E1000_WRITE_REG(&sc->hw, E1000_RCTL, reg_rctl);
+ em_if_vlan_filter_disable(sc);
} else {
if (flags & IFF_ALLMULTI) {
reg_rctl |= E1000_RCTL_MPE;
diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c
index 46fe5c741055..e01bc72cdc55 100644
--- a/sys/dev/e1000/igb_txrx.c
+++ b/sys/dev/e1000/igb_txrx.c
@@ -573,6 +573,6 @@ igb_determine_rsstype(uint16_t pkt_info)
case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX:
return M_HASHTYPE_RSS_TCP_IPV6_EX;
default:
- return M_HASHTYPE_OPAQUE;
+ return M_HASHTYPE_NONE;
}
}
diff --git a/sys/dev/evdev/input-event-codes.h b/sys/dev/evdev/input-event-codes.h
index 81c88ec86b9b..4f1d0f96e400 100644
--- a/sys/dev/evdev/input-event-codes.h
+++ b/sys/dev/evdev/input-event-codes.h
@@ -28,26 +28,18 @@
#ifndef _EVDEV_INPUT_EVENT_CODES_H
#define _EVDEV_INPUT_EVENT_CODES_H
-/*
- * Device properties and quirks
- */
-
-#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
-#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
-#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
-#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
-#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
-#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
-#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
-#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
+#define INPUT_PROP_POINTER 0x00
+#define INPUT_PROP_DIRECT 0x01
+#define INPUT_PROP_BUTTONPAD 0x02
+#define INPUT_PROP_SEMI_MT 0x03
+#define INPUT_PROP_TOPBUTTONPAD 0x04
+#define INPUT_PROP_POINTING_STICK 0x05
+#define INPUT_PROP_ACCELEROMETER 0x06
+#define INPUT_PROP_PRESSUREPAD 0x07
#define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
-/*
- * Event types
- */
-
#define EV_SYN 0x00
#define EV_KEY 0x01
#define EV_REL 0x02
@@ -63,10 +55,6 @@
#define EV_MAX 0x1f
#define EV_CNT (EV_MAX+1)
-/*
- * Synchronization events.
- */
-
#define SYN_REPORT 0
#define SYN_CONFIG 1
#define SYN_MT_REPORT 2
@@ -74,17 +62,6 @@
#define SYN_MAX 0xf
#define SYN_CNT (SYN_MAX+1)
-/*
- * Keys and buttons
- *
- * Most of the keys/buttons are modeled after USB HUT 1.12
- * (see http://www.usb.org/developers/hidpage).
- * Abbreviations in the comments:
- * AC - Application Control
- * AL - Application Launch Button
- * SC - System Control
- */
-
#define KEY_RESERVED 0
#define KEY_ESC 1
#define KEY_1 2
@@ -201,11 +178,11 @@
#define KEY_MUTE 113
#define KEY_VOLUMEDOWN 114
#define KEY_VOLUMEUP 115
-#define KEY_POWER 116 /* SC System Power Down */
+#define KEY_POWER 116
#define KEY_KPEQUAL 117
#define KEY_KPPLUSMINUS 118
#define KEY_PAUSE 119
-#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
+#define KEY_SCALE 120
#define KEY_KPCOMMA 121
#define KEY_HANGEUL 122
@@ -216,40 +193,40 @@
#define KEY_RIGHTMETA 126
#define KEY_COMPOSE 127
-#define KEY_STOP 128 /* AC Stop */
+#define KEY_STOP 128
#define KEY_AGAIN 129
-#define KEY_PROPS 130 /* AC Properties */
-#define KEY_UNDO 131 /* AC Undo */
+#define KEY_PROPS 130
+#define KEY_UNDO 131
#define KEY_FRONT 132
-#define KEY_COPY 133 /* AC Copy */
-#define KEY_OPEN 134 /* AC Open */
-#define KEY_PASTE 135 /* AC Paste */
-#define KEY_FIND 136 /* AC Search */
-#define KEY_CUT 137 /* AC Cut */
-#define KEY_HELP 138 /* AL Integrated Help Center */
-#define KEY_MENU 139 /* Menu (show menu) */
-#define KEY_CALC 140 /* AL Calculator */
+#define KEY_COPY 133
+#define KEY_OPEN 134
+#define KEY_PASTE 135
+#define KEY_FIND 136
+#define KEY_CUT 137
+#define KEY_HELP 138
+#define KEY_MENU 139
+#define KEY_CALC 140
#define KEY_SETUP 141
-#define KEY_SLEEP 142 /* SC System Sleep */
-#define KEY_WAKEUP 143 /* System Wake Up */
-#define KEY_FILE 144 /* AL Local Machine Browser */
+#define KEY_SLEEP 142
+#define KEY_WAKEUP 143
+#define KEY_FILE 144
#define KEY_SENDFILE 145
#define KEY_DELETEFILE 146
#define KEY_XFER 147
#define KEY_PROG1 148
#define KEY_PROG2 149
-#define KEY_WWW 150 /* AL Internet Browser */
+#define KEY_WWW 150
#define KEY_MSDOS 151
-#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
+#define KEY_COFFEE 152
#define KEY_SCREENLOCK KEY_COFFEE
-#define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */
+#define KEY_ROTATE_DISPLAY 153
#define KEY_DIRECTION KEY_ROTATE_DISPLAY
#define KEY_CYCLEWINDOWS 154
#define KEY_MAIL 155
-#define KEY_BOOKMARKS 156 /* AC Bookmarks */
+#define KEY_BOOKMARKS 156
#define KEY_COMPUTER 157
-#define KEY_BACK 158 /* AC Back */
-#define KEY_FORWARD 159 /* AC Forward */
+#define KEY_BACK 158
+#define KEY_FORWARD 159
#define KEY_CLOSECD 160
#define KEY_EJECTCD 161
#define KEY_EJECTCLOSECD 162
@@ -259,20 +236,20 @@
#define KEY_STOPCD 166
#define KEY_RECORD 167
#define KEY_REWIND 168
-#define KEY_PHONE 169 /* Media Select Telephone */
+#define KEY_PHONE 169
#define KEY_ISO 170
-#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
-#define KEY_HOMEPAGE 172 /* AC Home */
-#define KEY_REFRESH 173 /* AC Refresh */
-#define KEY_EXIT 174 /* AC Exit */
+#define KEY_CONFIG 171
+#define KEY_HOMEPAGE 172
+#define KEY_REFRESH 173
+#define KEY_EXIT 174
#define KEY_MOVE 175
#define KEY_EDIT 176
#define KEY_SCROLLUP 177
#define KEY_SCROLLDOWN 178
#define KEY_KPLEFTPAREN 179
#define KEY_KPRIGHTPAREN 180
-#define KEY_NEW 181 /* AC New */
-#define KEY_REDO 182 /* AC Redo/Repeat */
+#define KEY_NEW 181
+#define KEY_REDO 182
#define KEY_F13 183
#define KEY_F14 184
@@ -291,14 +268,14 @@
#define KEY_PAUSECD 201
#define KEY_PROG3 202
#define KEY_PROG4 203
-#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
+#define KEY_ALL_APPLICATIONS 204
#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
#define KEY_SUSPEND 205
-#define KEY_CLOSE 206 /* AC Close */
+#define KEY_CLOSE 206
#define KEY_PLAY 207
#define KEY_FASTFORWARD 208
#define KEY_BASSBOOST 209
-#define KEY_PRINT 210 /* AC Print */
+#define KEY_PRINT 210
#define KEY_HP 211
#define KEY_CAMERA 212
#define KEY_SOUND 213
@@ -307,25 +284,24 @@
#define KEY_CHAT 216
#define KEY_SEARCH 217
#define KEY_CONNECT 218
-#define KEY_FINANCE 219 /* AL Checkbook/Finance */
+#define KEY_FINANCE 219
#define KEY_SPORT 220
#define KEY_SHOP 221
#define KEY_ALTERASE 222
-#define KEY_CANCEL 223 /* AC Cancel */
+#define KEY_CANCEL 223
#define KEY_BRIGHTNESSDOWN 224
#define KEY_BRIGHTNESSUP 225
#define KEY_MEDIA 226
-#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
- outputs (Monitor/LCD/TV-out/etc) */
+#define KEY_SWITCHVIDEOMODE 227
#define KEY_KBDILLUMTOGGLE 228
#define KEY_KBDILLUMDOWN 229
#define KEY_KBDILLUMUP 230
-#define KEY_SEND 231 /* AC Send */
-#define KEY_REPLY 232 /* AC Reply */
-#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
-#define KEY_SAVE 234 /* AC Save */
+#define KEY_SEND 231
+#define KEY_REPLY 232
+#define KEY_FORWARDMAIL 233
+#define KEY_SAVE 234
#define KEY_DOCUMENTS 235
#define KEY_BATTERY 236
@@ -336,22 +312,18 @@
#define KEY_UNKNOWN 240
-#define KEY_VIDEO_NEXT 241 /* drive next video source */
-#define KEY_VIDEO_PREV 242 /* drive previous video source */
-#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
-#define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual
- brightness control is off,
- rely on ambient */
+#define KEY_VIDEO_NEXT 241
+#define KEY_VIDEO_PREV 242
+#define KEY_BRIGHTNESS_CYCLE 243
+#define KEY_BRIGHTNESS_AUTO 244
#define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO
-#define KEY_DISPLAY_OFF 245 /* display device to off state */
+#define KEY_DISPLAY_OFF 245
-#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */
+#define KEY_WWAN 246
#define KEY_WIMAX KEY_WWAN
-#define KEY_RFKILL 247 /* Key that controls all radios */
-
-#define KEY_MICMUTE 248 /* Mute / unmute the microphone */
+#define KEY_RFKILL 247
-/* Code 255 is reserved for special needs of AT keyboard driver */
+#define KEY_MICMUTE 248
#define BTN_MISC 0x100
#define BTN_0 0x100
@@ -420,14 +392,14 @@
#define BTN_TOOL_FINGER 0x145
#define BTN_TOOL_MOUSE 0x146
#define BTN_TOOL_LENS 0x147
-#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */
+#define BTN_TOOL_QUINTTAP 0x148
#define BTN_STYLUS3 0x149
#define BTN_TOUCH 0x14a
#define BTN_STYLUS 0x14b
#define BTN_STYLUS2 0x14c
#define BTN_TOOL_DOUBLETAP 0x14d
#define BTN_TOOL_TRIPLETAP 0x14e
-#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
+#define BTN_TOOL_QUADTAP 0x14f
#define BTN_WHEEL 0x150
#define BTN_GEAR_DOWN 0x150
@@ -439,56 +411,56 @@
#define KEY_CLEAR 0x163
#define KEY_POWER2 0x164
#define KEY_OPTION 0x165
-#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
+#define KEY_INFO 0x166
#define KEY_TIME 0x167
#define KEY_VENDOR 0x168
#define KEY_ARCHIVE 0x169
-#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
+#define KEY_PROGRAM 0x16a
#define KEY_CHANNEL 0x16b
#define KEY_FAVORITES 0x16c
#define KEY_EPG 0x16d
-#define KEY_PVR 0x16e /* Media Select Home */
+#define KEY_PVR 0x16e
#define KEY_MHP 0x16f
#define KEY_LANGUAGE 0x170
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
-#define KEY_FULL_SCREEN 0x174 /* AC View Toggle */
+#define KEY_FULL_SCREEN 0x174
#define KEY_ZOOM KEY_FULL_SCREEN
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
-#define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */
+#define KEY_ASPECT_RATIO 0x177
#define KEY_SCREEN KEY_ASPECT_RATIO
-#define KEY_PC 0x178 /* Media Select Computer */
-#define KEY_TV 0x179 /* Media Select TV */
-#define KEY_TV2 0x17a /* Media Select Cable */
-#define KEY_VCR 0x17b /* Media Select VCR */
-#define KEY_VCR2 0x17c /* VCR Plus */
-#define KEY_SAT 0x17d /* Media Select Satellite */
+#define KEY_PC 0x178
+#define KEY_TV 0x179
+#define KEY_TV2 0x17a
+#define KEY_VCR 0x17b
+#define KEY_VCR2 0x17c
+#define KEY_SAT 0x17d
#define KEY_SAT2 0x17e
-#define KEY_CD 0x17f /* Media Select CD */
-#define KEY_TAPE 0x180 /* Media Select Tape */
+#define KEY_CD 0x17f
+#define KEY_TAPE 0x180
#define KEY_RADIO 0x181
-#define KEY_TUNER 0x182 /* Media Select Tuner */
+#define KEY_TUNER 0x182
#define KEY_PLAYER 0x183
#define KEY_TEXT 0x184
-#define KEY_DVD 0x185 /* Media Select DVD */
+#define KEY_DVD 0x185
#define KEY_AUX 0x186
#define KEY_MP3 0x187
-#define KEY_AUDIO 0x188 /* AL Audio Browser */
-#define KEY_VIDEO 0x189 /* AL Movie Browser */
+#define KEY_AUDIO 0x188
+#define KEY_VIDEO 0x189
#define KEY_DIRECTORY 0x18a
#define KEY_LIST 0x18b
-#define KEY_MEMO 0x18c /* Media Select Messages */
+#define KEY_MEMO 0x18c
#define KEY_CALENDAR 0x18d
#define KEY_RED 0x18e
#define KEY_GREEN 0x18f
#define KEY_YELLOW 0x190
#define KEY_BLUE 0x191
-#define KEY_CHANNELUP 0x192 /* Channel Increment */
-#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
+#define KEY_CHANNELUP 0x192
+#define KEY_CHANNELDOWN 0x193
#define KEY_FIRST 0x194
-#define KEY_LAST 0x195 /* Recall Last */
+#define KEY_LAST 0x195
#define KEY_AB 0x196
#define KEY_NEXT 0x197
#define KEY_RESTART 0x198
@@ -499,40 +471,40 @@
#define KEY_DIGITS 0x19d
#define KEY_TEEN 0x19e
#define KEY_TWEN 0x19f
-#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
-#define KEY_GAMES 0x1a1 /* Media Select Games */
-#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
-#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
-#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
-#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
-#define KEY_EDITOR 0x1a6 /* AL Text Editor */
-#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
-#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
-#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
-#define KEY_DATABASE 0x1aa /* AL Database App */
-#define KEY_NEWS 0x1ab /* AL Newsreader */
-#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
-#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
-#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
-#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
+#define KEY_VIDEOPHONE 0x1a0
+#define KEY_GAMES 0x1a1
+#define KEY_ZOOMIN 0x1a2
+#define KEY_ZOOMOUT 0x1a3
+#define KEY_ZOOMRESET 0x1a4
+#define KEY_WORDPROCESSOR 0x1a5
+#define KEY_EDITOR 0x1a6
+#define KEY_SPREADSHEET 0x1a7
+#define KEY_GRAPHICSEDITOR 0x1a8
+#define KEY_PRESENTATION 0x1a9
+#define KEY_DATABASE 0x1aa
+#define KEY_NEWS 0x1ab
+#define KEY_VOICEMAIL 0x1ac
+#define KEY_ADDRESSBOOK 0x1ad
+#define KEY_MESSENGER 0x1ae
+#define KEY_DISPLAYTOGGLE 0x1af
#define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE
-#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
-#define KEY_LOGOFF 0x1b1 /* AL Logoff */
+#define KEY_SPELLCHECK 0x1b0
+#define KEY_LOGOFF 0x1b1
#define KEY_DOLLAR 0x1b2
#define KEY_EURO 0x1b3
-#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
+#define KEY_FRAMEBACK 0x1b4
#define KEY_FRAMEFORWARD 0x1b5
-#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
-#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
-#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
-#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
-#define KEY_IMAGES 0x1ba /* AL Image Browser */
-#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
-#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
-#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
-#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
+#define KEY_CONTEXT_MENU 0x1b6
+#define KEY_MEDIA_REPEAT 0x1b7
+#define KEY_10CHANNELSUP 0x1b8
+#define KEY_10CHANNELSDOWN 0x1b9
+#define KEY_IMAGES 0x1ba
+#define KEY_NOTIFICATION_CENTER 0x1bc
+#define KEY_PICKUP_PHONE 0x1bd
+#define KEY_HANGUP_PHONE 0x1be
+#define KEY_LINK_PHONE 0x1bf
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
@@ -573,8 +545,8 @@
#define KEY_BRL_DOT9 0x1f9
#define KEY_BRL_DOT10 0x1fa
-#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
-#define KEY_NUMERIC_1 0x201 /* and other keypads */
+#define KEY_NUMERIC_0 0x200
+#define KEY_NUMERIC_1 0x201
#define KEY_NUMERIC_2 0x202
#define KEY_NUMERIC_3 0x203
#define KEY_NUMERIC_4 0x204
@@ -585,15 +557,14 @@
#define KEY_NUMERIC_9 0x209
#define KEY_NUMERIC_STAR 0x20a
#define KEY_NUMERIC_POUND 0x20b
-#define KEY_NUMERIC_A 0x20c /* Phone key A - HUT Telephony 0xb9 */
+#define KEY_NUMERIC_A 0x20c
#define KEY_NUMERIC_B 0x20d
#define KEY_NUMERIC_C 0x20e
#define KEY_NUMERIC_D 0x20f
-
#define KEY_CAMERA_FOCUS 0x210
-#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
+#define KEY_WPS_BUTTON 0x211
-#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
+#define KEY_TOUCHPAD_TOGGLE 0x212
#define KEY_TOUCHPAD_ON 0x213
#define KEY_TOUCHPAD_OFF 0x214
@@ -603,11 +574,10 @@
#define KEY_CAMERA_DOWN 0x218
#define KEY_CAMERA_LEFT 0x219
#define KEY_CAMERA_RIGHT 0x21a
-
#define KEY_ATTENDANT_ON 0x21b
#define KEY_ATTENDANT_OFF 0x21c
-#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */
-#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */
+#define KEY_ATTENDANT_TOGGLE 0x21d
+#define KEY_LIGHTS_TOGGLE 0x21e
#define BTN_DPAD_UP 0x220
#define BTN_DPAD_DOWN 0x221
@@ -619,94 +589,69 @@
#define BTN_GRIPL2 0x226
#define BTN_GRIPR2 0x227
-#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
-#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
-#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
-
-#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
-#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
-#define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */
-#define KEY_CONTROLPANEL 0x243 /* AL Control Panel */
-#define KEY_APPSELECT 0x244 /* AL Select Task/Application */
-#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
-#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
-#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
-#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
-#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
-#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
-#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
-#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
-#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
-#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
-#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
-
-#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
-#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
-
-/*
- * Keycodes for hotkeys toggling the electronic privacy screen found on some
- * laptops on/off. Note when the embedded-controller turns on/off the eprivacy
- * screen itself then the state should be reported through drm connecter props:
- * https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
- * Except when implementing the drm connecter properties API is not possible
- * because e.g. the firmware does not allow querying the presence and/or status
- * of the eprivacy screen at boot.
- */
+#define KEY_ALS_TOGGLE 0x230
+#define KEY_ROTATE_LOCK_TOGGLE 0x231
+#define KEY_REFRESH_RATE_TOGGLE 0x232
+
+#define KEY_BUTTONCONFIG 0x240
+#define KEY_TASKMANAGER 0x241
+#define KEY_JOURNAL 0x242
+#define KEY_CONTROLPANEL 0x243
+#define KEY_APPSELECT 0x244
+#define KEY_SCREENSAVER 0x245
+#define KEY_VOICECOMMAND 0x246
+#define KEY_ASSISTANT 0x247
+#define KEY_KBD_LAYOUT_NEXT 0x248
+#define KEY_EMOJI_PICKER 0x249
+#define KEY_DICTATE 0x24a
+#define KEY_CAMERA_ACCESS_ENABLE 0x24b
+#define KEY_CAMERA_ACCESS_DISABLE 0x24c
+#define KEY_CAMERA_ACCESS_TOGGLE 0x24d
+#define KEY_ACCESSIBILITY 0x24e
+#define KEY_DO_NOT_DISTURB 0x24f
+
+#define KEY_BRIGHTNESS_MIN 0x250
+#define KEY_BRIGHTNESS_MAX 0x251
+
#define KEY_EPRIVACY_SCREEN_ON 0x252
#define KEY_EPRIVACY_SCREEN_OFF 0x253
#define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261
-#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
-#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263
-#define KEY_KBDINPUTASSIST_ACCEPT 0x264
-#define KEY_KBDINPUTASSIST_CANCEL 0x265
+#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
+#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263
+#define KEY_KBDINPUTASSIST_ACCEPT 0x264
+#define KEY_KBDINPUTASSIST_CANCEL 0x265
-/* Diagonal movement keys */
#define KEY_RIGHT_UP 0x266
#define KEY_RIGHT_DOWN 0x267
#define KEY_LEFT_UP 0x268
#define KEY_LEFT_DOWN 0x269
-#define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */
-/* Show Top Menu of the Media (e.g. DVD) */
+#define KEY_ROOT_MENU 0x26a
#define KEY_MEDIA_TOP_MENU 0x26b
#define KEY_NUMERIC_11 0x26c
#define KEY_NUMERIC_12 0x26d
-/*
- * Toggle Audio Description: refers to an audio service that helps blind and
- * visually impaired consumers understand the action in a program. Note: in
- * some countries this is referred to as "Video Description".
- */
#define KEY_AUDIO_DESC 0x26e
#define KEY_3D_MODE 0x26f
#define KEY_NEXT_FAVORITE 0x270
#define KEY_STOP_RECORD 0x271
#define KEY_PAUSE_RECORD 0x272
-#define KEY_VOD 0x273 /* Video on Demand */
+#define KEY_VOD 0x273
#define KEY_UNMUTE 0x274
#define KEY_FASTREVERSE 0x275
#define KEY_SLOWREVERSE 0x276
-/*
- * Control a data application associated with the currently viewed channel,
- * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.)
- */
#define KEY_DATA 0x277
#define KEY_ONSCREEN_KEYBOARD 0x278
-/* Electronic privacy screen control */
#define KEY_PRIVACY_SCREEN_TOGGLE 0x279
-/* Select an area of screen to be copied */
#define KEY_SELECTIVE_SCREENSHOT 0x27a
-/* Move the focus to the next or previous user controllable element within a UI container */
#define KEY_NEXT_ELEMENT 0x27b
#define KEY_PREVIOUS_ELEMENT 0x27c
-/* Toggle Autopilot engagement */
#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
-/* Shortcut Keys */
#define KEY_MARK_WAYPOINT 0x27e
#define KEY_SOS 0x27f
#define KEY_NAV_CHART 0x280
@@ -720,21 +665,6 @@
#define KEY_NAV_INFO 0x288
#define KEY_BRIGHTNESS_MENU 0x289
-/*
- * Some keyboards have keys which do not have a defined meaning, these keys
- * are intended to be programmed / bound to macros by the user. For most
- * keyboards with these macro-keys the key-sequence to inject, or action to
- * take, is all handled by software on the host side. So from the kernel's
- * point of view these are just normal keys.
- *
- * The KEY_MACRO# codes below are intended for such keys, which may be labeled
- * e.g. G1-G18, or S1 - S30. The KEY_MACRO# codes MUST NOT be used for keys
- * where the marking on the key does indicate a defined meaning / purpose.
- *
- * The KEY_MACRO# codes MUST also NOT be used as fallback for when no existing
- * KEY_FOO define matches the marking / purpose. In this case a new KEY_FOO
- * define MUST be added.
- */
#define KEY_MACRO1 0x290
#define KEY_MACRO2 0x291
#define KEY_MACRO3 0x292
@@ -766,16 +696,6 @@
#define KEY_MACRO29 0x2ac
#define KEY_MACRO30 0x2ad
-/*
- * Some keyboards with the macro-keys described above have some extra keys
- * for controlling the host-side software responsible for the macro handling:
- * -A macro recording start/stop key. Note that not all keyboards which emit
- * KEY_MACRO_RECORD_START will also emit KEY_MACRO_RECORD_STOP if
- * KEY_MACRO_RECORD_STOP is not advertised, then KEY_MACRO_RECORD_START
- * should be interpreted as a recording start/stop toggle;
- * -Keys for switching between different macro (pre)sets, either a key for
- * cycling through the configured presets or keys to directly select a preset.
- */
#define KEY_MACRO_RECORD_START 0x2b0
#define KEY_MACRO_RECORD_STOP 0x2b1
#define KEY_MACRO_PRESET_CYCLE 0x2b2
@@ -783,19 +703,12 @@
#define KEY_MACRO_PRESET2 0x2b4
#define KEY_MACRO_PRESET3 0x2b5
-/*
- * Some keyboards have a buildin LCD panel where the contents are controlled
- * by the host. Often these have a number of keys directly below the LCD
- * intended for controlling a menu shown on the LCD. These keys often don't
- * have any labeling so we just name them KEY_KBD_LCD_MENU#
- */
#define KEY_KBD_LCD_MENU1 0x2b8
#define KEY_KBD_LCD_MENU2 0x2b9
#define KEY_KBD_LCD_MENU3 0x2ba
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
-/* Performance Boost key (Alienware)/G-Mode key (Dell) */
#define KEY_PERFORMANCE 0x2bd
#define BTN_TRIGGER_HAPPY 0x2c0
@@ -840,15 +753,10 @@
#define BTN_TRIGGER_HAPPY39 0x2e6
#define BTN_TRIGGER_HAPPY40 0x2e7
-/* We avoid low common keys in module aliases so they don't get huge. */
#define KEY_MIN_INTERESTING KEY_MUTE
#define KEY_MAX 0x2ff
#define KEY_CNT (KEY_MAX+1)
-/*
- * Relative axes
- */
-
#define REL_X 0x00
#define REL_Y 0x01
#define REL_Z 0x02
@@ -859,23 +767,12 @@
#define REL_DIAL 0x07
#define REL_WHEEL 0x08
#define REL_MISC 0x09
-/*
- * 0x0a is reserved and should not be used in input drivers.
- * It was used by HID as REL_MISC+1 and userspace needs to detect if
- * the next REL_* event is correct or is just REL_MISC + n.
- * We define here REL_RESERVED so userspace can rely on it and detect
- * the situation described above.
- */
#define REL_RESERVED 0x0a
#define REL_WHEEL_HI_RES 0x0b
#define REL_HWHEEL_HI_RES 0x0c
#define REL_MAX 0x0f
#define REL_CNT (REL_MAX+1)
-/*
- * Absolute axes
- */
-
#define ABS_X 0x00
#define ABS_Y 0x01
#define ABS_Z 0x02
@@ -906,65 +803,49 @@
#define ABS_MISC 0x28
-/*
- * 0x2e is reserved and should not be used in input drivers.
- * It was used by HID as ABS_MISC+6 and userspace needs to detect if
- * the next ABS_* event is correct or is just ABS_MISC + n.
- * We define here ABS_RESERVED so userspace can rely on it and detect
- * the situation described above.
- */
#define ABS_RESERVED 0x2e
-#define ABS_MT_SLOT 0x2f /* MT slot being modified */
-#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
-#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
-#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
-#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
-#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
-#define ABS_MT_POSITION_X 0x35 /* Center X touch position */
-#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */
-#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
-#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
-#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
-#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
-#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
-#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
-#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
+#define ABS_MT_SLOT 0x2f
+#define ABS_MT_TOUCH_MAJOR 0x30
+#define ABS_MT_TOUCH_MINOR 0x31
+#define ABS_MT_WIDTH_MAJOR 0x32
+#define ABS_MT_WIDTH_MINOR 0x33
+#define ABS_MT_ORIENTATION 0x34
+#define ABS_MT_POSITION_X 0x35
+#define ABS_MT_POSITION_Y 0x36
+#define ABS_MT_TOOL_TYPE 0x37
+#define ABS_MT_BLOB_ID 0x38
+#define ABS_MT_TRACKING_ID 0x39
+#define ABS_MT_PRESSURE 0x3a
+#define ABS_MT_DISTANCE 0x3b
+#define ABS_MT_TOOL_X 0x3c
+#define ABS_MT_TOOL_Y 0x3d
#define ABS_MAX 0x3f
#define ABS_CNT (ABS_MAX+1)
-/*
- * Switch events
- */
-
-#define SW_LID 0x00 /* set = lid shut */
-#define SW_TABLET_MODE 0x01 /* set = tablet mode */
-#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
-#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
- set = radio enabled */
-#define SW_RADIO SW_RFKILL_ALL /* deprecated */
-#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
-#define SW_DOCK 0x05 /* set = plugged into dock */
-#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
-#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
-#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
-#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */
-#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */
-#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
-#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
-#define SW_LINEIN_INSERT 0x0d /* set = inserted */
-#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
-#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
-#define SW_MACHINE_COVER 0x10 /* set = cover closed */
-#define SW_USB_INSERT 0x11 /* set = USB audio device connected */
+#define SW_LID 0x00
+#define SW_TABLET_MODE 0x01
+#define SW_HEADPHONE_INSERT 0x02
+#define SW_RFKILL_ALL 0x03
+#define SW_RADIO SW_RFKILL_ALL
+#define SW_MICROPHONE_INSERT 0x04
+#define SW_DOCK 0x05
+#define SW_LINEOUT_INSERT 0x06
+#define SW_JACK_PHYSICAL_INSERT 0x07
+#define SW_VIDEOOUT_INSERT 0x08
+#define SW_CAMERA_LENS_COVER 0x09
+#define SW_KEYPAD_SLIDE 0x0a
+#define SW_FRONT_PROXIMITY 0x0b
+#define SW_ROTATE_LOCK 0x0c
+#define SW_LINEIN_INSERT 0x0d
+#define SW_MUTE_DEVICE 0x0e
+#define SW_PEN_INSERTED 0x0f
+#define SW_MACHINE_COVER 0x10
+#define SW_USB_INSERT 0x11
#define SW_MAX 0x11
#define SW_CNT (SW_MAX+1)
-/*
- * Misc events
- */
-
#define MSC_SERIAL 0x00
#define MSC_PULSELED 0x01
#define MSC_GESTURE 0x02
@@ -974,10 +855,6 @@
#define MSC_MAX 0x07
#define MSC_CNT (MSC_MAX+1)
-/*
- * LEDs
- */
-
#define LED_NUML 0x00
#define LED_CAPSL 0x01
#define LED_SCROLLL 0x02
@@ -992,19 +869,11 @@
#define LED_MAX 0x0f
#define LED_CNT (LED_MAX+1)
-/*
- * Autorepeat values
- */
-
#define REP_DELAY 0x00
#define REP_PERIOD 0x01
#define REP_MAX 0x01
#define REP_CNT (REP_MAX+1)
-/*
- * Sounds
- */
-
#define SND_CLICK 0x00
#define SND_BELL 0x01
#define SND_TONE 0x02
diff --git a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
index e086a1554940..638efa9e2ae2 100644
--- a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
+++ b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
@@ -1271,13 +1271,9 @@ static driver_t hpt_pci_driver = {
#error "no TARGETNAME found"
#endif
-/* use this to make TARGETNAME be expanded */
-#define __DRIVER_MODULE(p1, p2, p3, p4, p5) DRIVER_MODULE(p1, p2, p3, p4, p5)
-#define __MODULE_VERSION(p1, p2) MODULE_VERSION(p1, p2)
-#define __MODULE_DEPEND(p1, p2, p3, p4, p5) MODULE_DEPEND(p1, p2, p3, p4, p5)
-__DRIVER_MODULE(TARGETNAME, pci, hpt_pci_driver, 0, 0);
-__MODULE_VERSION(TARGETNAME, 1);
-__MODULE_DEPEND(TARGETNAME, cam, 1, 1, 1);
+DRIVER_MODULE(TARGETNAME, pci, hpt_pci_driver, NULL, NULL);
+MODULE_VERSION(TARGETNAME, 1);
+MODULE_DEPEND(TARGETNAME, cam, 1, 1, 1);
static int hpt_open(struct cdev *dev, int flags, int devtype, struct thread *td)
{
diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c
index f3d58f285b39..a82ffb66bdc8 100644
--- a/sys/dev/hptmv/entry.c
+++ b/sys/dev/hptmv/entry.c
@@ -95,8 +95,7 @@ static driver_t hpt_pci_driver = {
sizeof(IAL_ADAPTER_T)
};
-#define __DRIVER_MODULE(p1, p2, p3, p4, p5) DRIVER_MODULE(p1, p2, p3, p4, p5)
-__DRIVER_MODULE(PROC_DIR_NAME, pci, hpt_pci_driver, 0, 0);
+DRIVER_MODULE(PROC_DIR_NAME, pci, hpt_pci_driver, NULL, NULL);
MODULE_DEPEND(PROC_DIR_NAME, cam, 1, 1, 1);
#define ccb_ccb_ptr spriv_ptr0
diff --git a/sys/dev/hptnr/hptnr_osm_bsd.c b/sys/dev/hptnr/hptnr_osm_bsd.c
index 7426873964fb..fa0f78a7e01a 100644
--- a/sys/dev/hptnr/hptnr_osm_bsd.c
+++ b/sys/dev/hptnr/hptnr_osm_bsd.c
@@ -1561,13 +1561,9 @@ static driver_t hpt_pci_driver = {
#error "no TARGETNAME found"
#endif
-/* use this to make TARGETNAME be expanded */
-#define __DRIVER_MODULE(p1, p2, p3, p4, p5) DRIVER_MODULE(p1, p2, p3, p4, p5)
-#define __MODULE_VERSION(p1, p2) MODULE_VERSION(p1, p2)
-#define __MODULE_DEPEND(p1, p2, p3, p4, p5) MODULE_DEPEND(p1, p2, p3, p4, p5)
-__DRIVER_MODULE(TARGETNAME, pci, hpt_pci_driver, 0, 0);
-__MODULE_VERSION(TARGETNAME, 1);
-__MODULE_DEPEND(TARGETNAME, cam, 1, 1, 1);
+DRIVER_MODULE(TARGETNAME, pci, hpt_pci_driver, NULL, NULL);
+MODULE_VERSION(TARGETNAME, 1);
+MODULE_DEPEND(TARGETNAME, cam, 1, 1, 1);
static int hpt_open(struct cdev *dev, int flags, int devtype, struct thread *td)
{
diff --git a/sys/dev/hptrr/hptrr_osm_bsd.c b/sys/dev/hptrr/hptrr_osm_bsd.c
index 78a051d54cf8..f4ae6732ea5d 100644
--- a/sys/dev/hptrr/hptrr_osm_bsd.c
+++ b/sys/dev/hptrr/hptrr_osm_bsd.c
@@ -1204,13 +1204,9 @@ static driver_t hpt_pci_driver = {
#error "no TARGETNAME found"
#endif
-/* use this to make TARGETNAME be expanded */
-#define __DRIVER_MODULE(p1, p2, p3, p4, p5) DRIVER_MODULE(p1, p2, p3, p4, p5)
-#define __MODULE_VERSION(p1, p2) MODULE_VERSION(p1, p2)
-#define __MODULE_DEPEND(p1, p2, p3, p4, p5) MODULE_DEPEND(p1, p2, p3, p4, p5)
-__DRIVER_MODULE(TARGETNAME, pci, hpt_pci_driver, 0, 0);
-__MODULE_VERSION(TARGETNAME, 1);
-__MODULE_DEPEND(TARGETNAME, cam, 1, 1, 1);
+DRIVER_MODULE(TARGETNAME, pci, hpt_pci_driver, NULL, NULL);
+MODULE_VERSION(TARGETNAME, 1);
+MODULE_DEPEND(TARGETNAME, cam, 1, 1, 1);
static int hpt_open(struct cdev *dev, int flags, int devtype, struct thread *td)
{
diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c
index d2fb17549990..801b75b39595 100644
--- a/sys/dev/hwpmc/hwpmc_amd.c
+++ b/sys/dev/hwpmc/hwpmc_amd.c
@@ -53,43 +53,14 @@ DPCPU_DEFINE_STATIC(uint32_t, nmi_counter);
/* AMD K8 PMCs */
struct amd_descr {
- struct pmc_descr pm_descr; /* "base class" */
- uint32_t pm_evsel; /* address of EVSEL register */
- uint32_t pm_perfctr; /* address of PERFCTR register */
+ struct pmc_descr pm_descr; /* "base class" */
+ uint32_t pm_evsel; /* address of EVSEL register */
+ uint32_t pm_perfctr; /* address of PERFCTR register */
+ enum sub_class pm_subclass; /* register subclass */
};
-/* Counter hardware. */
-#define PMCDESC(evsel, perfctr) \
- { \
- .pm_descr = { \
- .pd_name = "", \
- .pd_class = PMC_CLASS_K8, \
- .pd_caps = AMD_PMC_CAPS, \
- .pd_width = 48 \
- }, \
- .pm_evsel = (evsel), \
- .pm_perfctr = (perfctr) \
- }
-
-static struct amd_descr amd_pmcdesc[AMD_NPMCS] =
-{
- PMCDESC(AMD_PMC_EVSEL_0, AMD_PMC_PERFCTR_0),
- PMCDESC(AMD_PMC_EVSEL_1, AMD_PMC_PERFCTR_1),
- PMCDESC(AMD_PMC_EVSEL_2, AMD_PMC_PERFCTR_2),
- PMCDESC(AMD_PMC_EVSEL_3, AMD_PMC_PERFCTR_3),
- PMCDESC(AMD_PMC_EVSEL_4, AMD_PMC_PERFCTR_4),
- PMCDESC(AMD_PMC_EVSEL_5, AMD_PMC_PERFCTR_5),
- PMCDESC(AMD_PMC_EVSEL_EP_L3_0, AMD_PMC_PERFCTR_EP_L3_0),
- PMCDESC(AMD_PMC_EVSEL_EP_L3_1, AMD_PMC_PERFCTR_EP_L3_1),
- PMCDESC(AMD_PMC_EVSEL_EP_L3_2, AMD_PMC_PERFCTR_EP_L3_2),
- PMCDESC(AMD_PMC_EVSEL_EP_L3_3, AMD_PMC_PERFCTR_EP_L3_3),
- PMCDESC(AMD_PMC_EVSEL_EP_L3_4, AMD_PMC_PERFCTR_EP_L3_4),
- PMCDESC(AMD_PMC_EVSEL_EP_L3_5, AMD_PMC_PERFCTR_EP_L3_5),
- PMCDESC(AMD_PMC_EVSEL_EP_DF_0, AMD_PMC_PERFCTR_EP_DF_0),
- PMCDESC(AMD_PMC_EVSEL_EP_DF_1, AMD_PMC_PERFCTR_EP_DF_1),
- PMCDESC(AMD_PMC_EVSEL_EP_DF_2, AMD_PMC_PERFCTR_EP_DF_2),
- PMCDESC(AMD_PMC_EVSEL_EP_DF_3, AMD_PMC_PERFCTR_EP_DF_3)
-};
+static int amd_npmcs;
+static struct amd_descr amd_pmcdesc[AMD_NPMCS_MAX];
struct amd_event_code_map {
enum pmc_event pe_ev; /* enum value */
@@ -203,7 +174,7 @@ const int amd_event_codes_size = nitems(amd_event_codes);
* Per-processor information
*/
struct amd_cpu {
- struct pmc_hw pc_amdpmcs[AMD_NPMCS];
+ struct pmc_hw pc_amdpmcs[AMD_NPMCS_MAX];
};
static struct amd_cpu **amd_pcpu;
@@ -219,7 +190,7 @@ amd_read_pmc(int cpu, int ri, struct pmc *pm, pmc_value_t *v)
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] illegal row-index %d", __LINE__, ri));
KASSERT(amd_pcpu[cpu],
("[amd,%d] null per-cpu, cpu %d", __LINE__, cpu));
@@ -264,7 +235,7 @@ amd_write_pmc(int cpu, int ri, struct pmc *pm, pmc_value_t v)
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] illegal row-index %d", __LINE__, ri));
pd = &amd_pmcdesc[ri];
@@ -293,7 +264,7 @@ amd_config_pmc(int cpu, int ri, struct pmc *pm)
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] illegal row-index %d", __LINE__, ri));
phw = &amd_pcpu[cpu]->pc_amdpmcs[ri];
@@ -362,7 +333,7 @@ amd_allocate_pmc(int cpu __unused, int ri, struct pmc *pm,
enum pmc_event pe;
int i;
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] illegal row index %d", __LINE__, ri));
pd = &amd_pmcdesc[ri].pm_descr;
@@ -379,14 +350,7 @@ amd_allocate_pmc(int cpu __unused, int ri, struct pmc *pm,
PMCDBG2(MDP, ALL, 1,"amd-allocate ri=%d caps=0x%x", ri, caps);
/* Validate sub-class. */
- if ((ri >= 0 && ri < 6) && a->pm_md.pm_amd.pm_amd_sub_class !=
- PMC_AMD_SUB_CLASS_CORE)
- return (EINVAL);
- if ((ri >= 6 && ri < 12) && a->pm_md.pm_amd.pm_amd_sub_class !=
- PMC_AMD_SUB_CLASS_L3_CACHE)
- return (EINVAL);
- if ((ri >= 12 && ri < 16) && a->pm_md.pm_amd.pm_amd_sub_class !=
- PMC_AMD_SUB_CLASS_DATA_FABRIC)
+ if (amd_pmcdesc[ri].pm_subclass != a->pm_md.pm_amd.pm_amd_sub_class)
return (EINVAL);
if (strlen(pmc_cpuid) != 0) {
@@ -455,7 +419,7 @@ amd_release_pmc(int cpu, int ri, struct pmc *pmc __unused)
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] illegal row-index %d", __LINE__, ri));
phw = &amd_pcpu[cpu]->pc_amdpmcs[ri];
@@ -477,13 +441,18 @@ amd_start_pmc(int cpu __diagused, int ri, struct pmc *pm)
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] illegal row-index %d", __LINE__, ri));
pd = &amd_pmcdesc[ri];
PMCDBG2(MDP, STA, 1, "amd-start cpu=%d ri=%d", cpu, ri);
+ /*
+ * Triggered by DF counters because all DF MSRs are shared. We need to
+ * change the code to honor the per-package flag in the JSON event
+ * definitions.
+ */
KASSERT(AMD_PMC_IS_STOPPED(pd->pm_evsel),
("[amd,%d] pmc%d,cpu%d: Starting active PMC \"%s\"", __LINE__,
ri, cpu, pd->pm_descr.pd_name));
@@ -509,7 +478,7 @@ amd_stop_pmc(int cpu __diagused, int ri, struct pmc *pm)
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] illegal row-index %d", __LINE__, ri));
pd = &amd_pmcdesc[ri];
@@ -578,7 +547,10 @@ amd_intr(struct trapframe *tf)
* a single interrupt. Check all the valid pmcs for
* overflow.
*/
- for (i = 0; i < AMD_CORE_NPMCS; i++) {
+ for (i = 0; i < amd_npmcs; i++) {
+ if (amd_pmcdesc[i].pm_subclass != PMC_AMD_SUB_CLASS_CORE)
+ break;
+
if ((pm = pac->pc_amdpmcs[i].phw_pmc) == NULL ||
!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) {
continue;
@@ -654,7 +626,7 @@ amd_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc)
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU %d", __LINE__, cpu));
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] row-index %d out of range", __LINE__, ri));
phw = &amd_pcpu[cpu]->pc_amdpmcs[ri];
@@ -680,7 +652,7 @@ amd_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc)
static int
amd_get_msr(int ri, uint32_t *msr)
{
- KASSERT(ri >= 0 && ri < AMD_NPMCS,
+ KASSERT(ri >= 0 && ri < amd_npmcs,
("[amd,%d] ri %d out of range", __LINE__, ri));
*msr = amd_pmcdesc[ri].pm_perfctr - AMD_PMC_PERFCTR_0;
@@ -715,7 +687,7 @@ amd_pcpu_init(struct pmc_mdep *md, int cpu)
KASSERT(pc != NULL, ("[amd,%d] NULL per-cpu pointer", __LINE__));
- for (n = 0, phw = pac->pc_amdpmcs; n < AMD_NPMCS; n++, phw++) {
+ for (n = 0, phw = pac->pc_amdpmcs; n < amd_npmcs; n++, phw++) {
phw->phw_state = PMC_PHW_FLAG_IS_ENABLED |
PMC_PHW_CPU_TO_STATE(cpu) | PMC_PHW_INDEX_TO_STATE(n);
phw->phw_pmc = NULL;
@@ -733,7 +705,6 @@ amd_pcpu_fini(struct pmc_mdep *md, int cpu)
{
struct amd_cpu *pac;
struct pmc_cpu *pc;
- uint32_t evsel;
int first_ri, i;
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
@@ -742,15 +713,6 @@ amd_pcpu_fini(struct pmc_mdep *md, int cpu)
PMCDBG1(MDP, INI, 1, "amd-cleanup cpu=%d", cpu);
/*
- * First, turn off all PMCs on this CPU.
- */
- for (i = 0; i < 4; i++) { /* XXX this loop is now not needed */
- evsel = rdmsr(AMD_PMC_EVSEL_0 + i);
- evsel &= ~AMD_PMC_ENABLE;
- wrmsr(AMD_PMC_EVSEL_0 + i, evsel);
- }
-
- /*
* Next, free up allocated space.
*/
if ((pac = amd_pcpu[cpu]) == NULL)
@@ -759,7 +721,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int cpu)
amd_pcpu[cpu] = NULL;
#ifdef HWPMC_DEBUG
- for (i = 0; i < AMD_NPMCS; i++) {
+ for (i = 0; i < AMD_NPMCS_K8; i++) {
KASSERT(pac->pc_amdpmcs[i].phw_pmc == NULL,
("[amd,%d] CPU%d/PMC%d in use", __LINE__, cpu, i));
KASSERT(AMD_PMC_IS_STOPPED(AMD_PMC_EVSEL_0 + i),
@@ -775,7 +737,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int cpu)
/*
* Reset pointers in the MI 'per-cpu' state.
*/
- for (i = 0; i < AMD_NPMCS; i++)
+ for (i = 0; i < amd_npmcs; i++)
pc->pc_hwpmcs[i + first_ri] = NULL;
free(pac, M_PMC);
@@ -793,6 +755,8 @@ pmc_amd_initialize(void)
enum pmc_cputype cputype;
int error, i, ncpus;
int family, model, stepping;
+ int amd_core_npmcs, amd_l3_npmcs, amd_df_npmcs;
+ struct amd_descr *d;
/*
* The presence of hardware performance counters on the AMD
@@ -824,6 +788,80 @@ pmc_amd_initialize(void)
}
/*
+ * From PPR for AMD Family 1Ah, a new cpuid leaf specifies the maximum
+ * number of PMCs of each type. If we do not have that leaf, we use
+ * the prior default values that are only valid if we have the feature
+ * bit enabled in CPU.
+ */
+ if ((amd_feature2 & AMDID2_PCXC) != 0) {
+ amd_core_npmcs = AMD_PMC_CORE_DEFAULT;
+ } else {
+ amd_core_npmcs = AMD_NPMCS_K8;
+ }
+ amd_l3_npmcs = AMD_PMC_L3_DEFAULT;
+ amd_df_npmcs = AMD_PMC_DF_DEFAULT;
+
+ if (cpu_exthigh >= CPUID_EXTPERFMON) {
+ u_int regs[4];
+ do_cpuid(CPUID_EXTPERFMON, regs);
+ if (regs[1] != 0) {
+ amd_core_npmcs = EXTPERFMON_CORE_PMCS(regs[1]);
+ amd_df_npmcs = EXTPERFMON_DF_PMCS(regs[1]);
+ }
+ }
+
+ /* Enable the newer core counters */
+ for (i = 0; i < amd_core_npmcs; i++) {
+ d = &amd_pmcdesc[i];
+ snprintf(d->pm_descr.pd_name, PMC_NAME_MAX,
+ "K8-%d", i);
+ d->pm_descr.pd_class = PMC_CLASS_K8;
+ d->pm_descr.pd_caps = AMD_PMC_CAPS;
+ d->pm_descr.pd_width = 48;
+ if ((amd_feature2 & AMDID2_PCXC) != 0) {
+ d->pm_evsel = AMD_PMC_CORE_BASE + 2 * i;
+ d->pm_perfctr = AMD_PMC_CORE_BASE + 2 * i + 1;
+ } else {
+ d->pm_evsel = AMD_PMC_EVSEL_0 + i;
+ d->pm_perfctr = AMD_PMC_PERFCTR_0 + i;
+ }
+ d->pm_subclass = PMC_AMD_SUB_CLASS_CORE;
+ }
+ amd_npmcs = amd_core_npmcs;
+
+ if ((amd_feature2 & AMDID2_PTSCEL2I) != 0) {
+ /* Enable the LLC/L3 counters */
+ for (i = 0; i < amd_l3_npmcs; i++) {
+ d = &amd_pmcdesc[amd_npmcs + i];
+ snprintf(d->pm_descr.pd_name, PMC_NAME_MAX,
+ "K8-L3-%d", i);
+ d->pm_descr.pd_class = PMC_CLASS_K8;
+ d->pm_descr.pd_caps = AMD_PMC_CAPS;
+ d->pm_descr.pd_width = 48;
+ d->pm_evsel = AMD_PMC_L3_BASE + 2 * i;
+ d->pm_perfctr = AMD_PMC_L3_BASE + 2 * i + 1;
+ d->pm_subclass = PMC_AMD_SUB_CLASS_L3_CACHE;
+ }
+ amd_npmcs += amd_l3_npmcs;
+ }
+
+ if ((amd_feature2 & AMDID2_PNXC) != 0) {
+ /* Enable the data fabric counters */
+ for (i = 0; i < amd_df_npmcs; i++) {
+ d = &amd_pmcdesc[amd_npmcs + i];
+ snprintf(d->pm_descr.pd_name, PMC_NAME_MAX,
+ "K8-DF-%d", i);
+ d->pm_descr.pd_class = PMC_CLASS_K8;
+ d->pm_descr.pd_caps = AMD_PMC_CAPS;
+ d->pm_descr.pd_width = 48;
+ d->pm_evsel = AMD_PMC_DF_BASE + 2 * i;
+ d->pm_perfctr = AMD_PMC_DF_BASE + 2 * i + 1;
+ d->pm_subclass = PMC_AMD_SUB_CLASS_DATA_FABRIC;
+ }
+ amd_npmcs += amd_df_npmcs;
+ }
+
+ /*
* Allocate space for pointers to PMC HW descriptors and for
* the MDEP structure used by MI code.
*/
@@ -848,16 +886,10 @@ pmc_amd_initialize(void)
pcd->pcd_caps = AMD_PMC_CAPS;
pcd->pcd_class = PMC_CLASS_K8;
- pcd->pcd_num = AMD_NPMCS;
+ pcd->pcd_num = amd_npmcs;
pcd->pcd_ri = pmc_mdep->pmd_npmc;
pcd->pcd_width = 48;
- /* fill in the correct pmc name and class */
- for (i = 0; i < AMD_NPMCS; i++) {
- snprintf(amd_pmcdesc[i].pm_descr.pd_name, PMC_NAME_MAX, "K8-%d",
- i);
- }
-
pcd->pcd_allocate_pmc = amd_allocate_pmc;
pcd->pcd_config_pmc = amd_config_pmc;
pcd->pcd_describe = amd_describe;
@@ -876,7 +908,7 @@ pmc_amd_initialize(void)
pmc_mdep->pmd_switch_in = amd_switch_in;
pmc_mdep->pmd_switch_out = amd_switch_out;
- pmc_mdep->pmd_npmc += AMD_NPMCS;
+ pmc_mdep->pmd_npmc += amd_npmcs;
PMCDBG0(MDP, INI, 0, "amd-initialize");
diff --git a/sys/dev/hwpmc/hwpmc_amd.h b/sys/dev/hwpmc/hwpmc_amd.h
index d72fbc4878b6..be484a1111a2 100644
--- a/sys/dev/hwpmc/hwpmc_amd.h
+++ b/sys/dev/hwpmc/hwpmc_amd.h
@@ -31,8 +31,12 @@
#ifndef _DEV_HWPMC_AMD_H_
#define _DEV_HWPMC_AMD_H_ 1
-/* AMD K8 PMCs */
+/* CPUIDs */
+#define CPUID_EXTPERFMON 0x80000022
+#define EXTPERFMON_CORE_PMCS(x) ((x) & 0x0F)
+#define EXTPERFMON_DF_PMCS(x) (((x) >> 10) & 0x3F)
+/* AMD K8 PMCs */
#define AMD_PMC_EVSEL_0 0xC0010000
#define AMD_PMC_EVSEL_1 0xC0010001
#define AMD_PMC_EVSEL_2 0xC0010002
@@ -42,40 +46,35 @@
#define AMD_PMC_PERFCTR_1 0xC0010005
#define AMD_PMC_PERFCTR_2 0xC0010006
#define AMD_PMC_PERFCTR_3 0xC0010007
+
+/*
+ * For older AMD processors we have hard coded the original four core counters.
+ * For newer processors we use the cpuid bits to setup the counter table. The
+ * counts below are the default number of registers assuming that you do not
+ * have CPUID leaf 0x80000022. The maximum number of counters is computed
+ * based on the available bits in the CPUID leaf and reserved MSR space.
+ *
+ * Refer to the PPRs for AMD Family 1Ah.
+ */
+
/* CORE */
-#define AMD_PMC_EVSEL_4 0xC0010208
-#define AMD_PMC_EVSEL_5 0xC001020A
+#define AMD_PMC_CORE_BASE 0xC0010200
+#define AMD_PMC_CORE_DEFAULT 6
+#define AMD_PMC_CORE_MAX 16
-#define AMD_PMC_PERFCTR_4 0xC0010209
-#define AMD_PMC_PERFCTR_5 0xC001020B
/* L3 */
-#define AMD_PMC_EVSEL_EP_L3_0 0xC0010230
-#define AMD_PMC_EVSEL_EP_L3_1 0xC0010232
-#define AMD_PMC_EVSEL_EP_L3_2 0xC0010234
-#define AMD_PMC_EVSEL_EP_L3_3 0xC0010236
-#define AMD_PMC_EVSEL_EP_L3_4 0xC0010238
-#define AMD_PMC_EVSEL_EP_L3_5 0xC001023A
-
-#define AMD_PMC_PERFCTR_EP_L3_0 0xC0010231
-#define AMD_PMC_PERFCTR_EP_L3_1 0xC0010233
-#define AMD_PMC_PERFCTR_EP_L3_2 0xC0010235
-#define AMD_PMC_PERFCTR_EP_L3_3 0xC0010237
-#define AMD_PMC_PERFCTR_EP_L3_4 0xC0010239
-#define AMD_PMC_PERFCTR_EP_L3_5 0xC001023B
-/* DF */
-#define AMD_PMC_EVSEL_EP_DF_0 0xC0010240
-#define AMD_PMC_EVSEL_EP_DF_1 0xC0010242
-#define AMD_PMC_EVSEL_EP_DF_2 0xC0010244
-#define AMD_PMC_EVSEL_EP_DF_3 0xC0010246
+#define AMD_PMC_L3_BASE 0xC0010230
+#define AMD_PMC_L3_DEFAULT 6
+#define AMD_PMC_L3_MAX 6
-#define AMD_PMC_PERFCTR_EP_DF_0 0xC0010241
-#define AMD_PMC_PERFCTR_EP_DF_1 0xC0010243
-#define AMD_PMC_PERFCTR_EP_DF_2 0xC0010245
-#define AMD_PMC_PERFCTR_EP_DF_3 0xC0010247
-
-#define AMD_NPMCS 16
-#define AMD_CORE_NPMCS 6
+/* DF */
+#define AMD_PMC_DF_BASE 0xC0010240
+#define AMD_PMC_DF_DEFAULT 4
+#define AMD_PMC_DF_MAX 64
+#define AMD_NPMCS_K8 4
+#define AMD_NPMCS_MAX (AMD_PMC_CORE_MAX + AMD_PMC_L3_MAX + \
+ AMD_PMC_DF_MAX)
#define AMD_PMC_COUNTERMASK 0xFF000000
#define AMD_PMC_TO_COUNTER(x) (((x) << 24) & AMD_PMC_COUNTERMASK)
@@ -118,7 +117,7 @@
#define AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(V) (-(V))
#define AMD_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P))
-enum sub_class{
+enum sub_class {
PMC_AMD_SUB_CLASS_CORE,
PMC_AMD_SUB_CLASS_L3_CACHE,
PMC_AMD_SUB_CLASS_DATA_FABRIC
diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
index 310e43065716..794b285c0b3c 100644
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -558,10 +558,9 @@ pmc_arm64_initialize(void)
snprintf(pmc_cpuid, sizeof(pmc_cpuid), "0x%016lx", midr);
/* Check if we have 64-bit counters */
- if (get_kernel_reg(ID_AA64DFR0_EL1, &dfr)) {
- if (ID_AA64DFR0_PMUVer_VAL(dfr) >= ID_AA64DFR0_PMUVer_3_5)
- arm64_64bit_events = true;
- }
+ get_kernel_reg(ID_AA64DFR0_EL1, &dfr);
+ if (ID_AA64DFR0_PMUVer_VAL(dfr) >= ID_AA64DFR0_PMUVer_3_5)
+ arm64_64bit_events = true;
/*
* Allocate space for pointers to PMC HW descriptors and for
diff --git a/sys/dev/hwpmc/hwpmc_intel.c b/sys/dev/hwpmc/hwpmc_intel.c
index 6d8b5c5de6b6..e1788a9ea409 100644
--- a/sys/dev/hwpmc/hwpmc_intel.c
+++ b/sys/dev/hwpmc/hwpmc_intel.c
@@ -247,6 +247,11 @@ pmc_intel_initialize(void)
cputype = PMC_CPU_INTEL_ATOM_TREMONT;
nclasses = 3;
break;
+ case 0xAD:
+ case 0xAE:
+ cputype = PMC_CPU_INTEL_GRANITE_RAPIDS;
+ nclasses = 3;
+ break;
case 0xBE:
cputype = PMC_CPU_INTEL_ALDERLAKEN;
nclasses = 3;
diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c
index 1469d2916465..6ea539d52e02 100644
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -1907,15 +1907,13 @@ ice_if_promisc_set(if_ctx_t ctx, int flags)
ice_set_default_promisc_mask(promisc_mask);
- if (multi_enable)
- return (EOPNOTSUPP);
-
if (promisc_enable) {
status = ice_set_vsi_promisc(hw, sc->pf_vsi.idx,
promisc_mask, 0);
if (status && status != ICE_ERR_ALREADY_EXISTS) {
device_printf(dev,
- "Failed to enable promiscuous mode for PF VSI, err %s aq_err %s\n",
+ "Failed to enable promiscuous mode for "
+ "PF VSI, err %s aq_err %s\n",
ice_status_str(status),
ice_aq_str(hw->adminq.sq_last_status));
return (EIO);
@@ -1925,11 +1923,28 @@ ice_if_promisc_set(if_ctx_t ctx, int flags)
promisc_mask, 0);
if (status) {
device_printf(dev,
- "Failed to disable promiscuous mode for PF VSI, err %s aq_err %s\n",
+ "Failed to disable promiscuous mode for"
+ " PF VSI, err %s aq_err %s\n",
ice_status_str(status),
ice_aq_str(hw->adminq.sq_last_status));
return (EIO);
}
+
+ if (multi_enable) {
+ ice_clear_bit(ICE_PROMISC_UCAST_TX, promisc_mask);
+ ice_clear_bit(ICE_PROMISC_UCAST_RX, promisc_mask);
+ status = ice_set_vsi_promisc(hw, sc->pf_vsi.idx,
+ promisc_mask, 0);
+ if (status && status != ICE_ERR_ALREADY_EXISTS) {
+ device_printf(dev,
+ "Failed to enable allmulti mode "
+ "for PF VSI, err %s aq_err %s\n",
+ ice_status_str(status),
+ ice_aq_str(
+ hw->adminq.sq_last_status));
+ return (EIO);
+ }
+ }
}
return (0);
diff --git a/sys/dev/ichiic/ig4_pci.c b/sys/dev/ichiic/ig4_pci.c
index 3a49e220e335..49036c6dabc9 100644
--- a/sys/dev/ichiic/ig4_pci.c
+++ b/sys/dev/ichiic/ig4_pci.c
@@ -192,6 +192,10 @@ static int ig4iic_pci_detach(device_t dev);
#define PCI_CHIP_ARROWLAKE_U_I2C_3 0x777b8086
#define PCI_CHIP_ARROWLAKE_U_I2C_4 0x77508086
#define PCI_CHIP_ARROWLAKE_U_I2C_5 0x77518086
+#define PCI_CHIP_LUNARLAKE_M_I2C_0 0xa8788086
+#define PCI_CHIP_LUNARLAKE_M_I2C_1 0xa8798086
+#define PCI_CHIP_LUNARLAKE_M_I2C_2 0xa87a8086
+#define PCI_CHIP_LUNARLAKE_M_I2C_3 0xa87b8086
struct ig4iic_pci_device {
uint32_t devid;
@@ -328,6 +332,10 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = {
{ PCI_CHIP_ARROWLAKE_U_I2C_3, "Intel Arrow Lake-H/U I2C Controller-3", IG4_TIGERLAKE},
{ PCI_CHIP_ARROWLAKE_U_I2C_4, "Intel Arrow Lake-H/U I2C Controller-4", IG4_TIGERLAKE},
{ PCI_CHIP_ARROWLAKE_U_I2C_5, "Intel Arrow Lake-H/U I2C Controller-5", IG4_TIGERLAKE},
+ { PCI_CHIP_LUNARLAKE_M_I2C_0, "Intel Lunar Lake-M I2C Controller-0", IG4_TIGERLAKE},
+ { PCI_CHIP_LUNARLAKE_M_I2C_1, "Intel Lunar Lake-M I2C Controller-1", IG4_TIGERLAKE},
+ { PCI_CHIP_LUNARLAKE_M_I2C_2, "Intel Lunar Lake-M I2C Controller-2", IG4_TIGERLAKE},
+ { PCI_CHIP_LUNARLAKE_M_I2C_3, "Intel Lunar Lake-M I2C Controller-3", IG4_TIGERLAKE},
};
static int
diff --git a/sys/dev/iicbus/controller/twsi/a10_twsi.c b/sys/dev/iicbus/controller/twsi/a10_twsi.c
index 4d370674fee3..a82eabff12fb 100644
--- a/sys/dev/iicbus/controller/twsi/a10_twsi.c
+++ b/sys/dev/iicbus/controller/twsi/a10_twsi.c
@@ -63,6 +63,7 @@ static struct ofw_compat_data compat_data[] = {
{"allwinner,sun4i-a10-i2c", 1},
{"allwinner,sun6i-a31-i2c", 1},
{"allwinner,sun8i-a83t-i2c", 1},
+ {"allwinner,sun50i-h616-i2c", 1},
{NULL, 0},
};
diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c
index a7d98f06aea3..6ab6e5a7f19e 100644
--- a/sys/dev/mfi/mfi.c
+++ b/sys/dev/mfi/mfi.c
@@ -52,11 +52,10 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include "opt_mfi.h"
-#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/abi_compat.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
@@ -3084,8 +3083,6 @@ out:
return (error);
}
-#define PTRIN(p) ((void *)(uintptr_t)(p))
-
static int
mfi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
{
diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c
index ca63d1d12ba6..302b9d9cc2f4 100644
--- a/sys/dev/mlx4/mlx4_core/mlx4_main.c
+++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c
@@ -135,7 +135,7 @@ static struct mlx4_profile default_profile = {
.num_cq = 1 << 16,
.num_mcg = 1 << 13,
.num_mpt = 1 << 19,
- .num_mtt = 1 << 20, /* It is really num mtt segements */
+ .num_mtt = 1 << 20, /* It is really num mtt segments */
};
static struct mlx4_profile low_mem_profile = {
diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c
index 6529b38cc5f1..f88dd6e2532f 100644
--- a/sys/dev/mpr/mpr_sas_lsi.c
+++ b/sys/dev/mpr/mpr_sas_lsi.c
@@ -1516,7 +1516,6 @@ mprsas_SSU_to_SATA_devices(struct mpr_softc *sc, int howto)
/*start*/FALSE,
/*load/eject*/0,
/*immediate*/FALSE,
- /*power_condition*/SSS_PC_START_VALID,
MPR_SENSE_LEN,
/*timeout*/10000);
xpt_action(ccb);
diff --git a/sys/dev/mps/mps_sas_lsi.c b/sys/dev/mps/mps_sas_lsi.c
index c48c8e15d4a4..bcde5d69a021 100644
--- a/sys/dev/mps/mps_sas_lsi.c
+++ b/sys/dev/mps/mps_sas_lsi.c
@@ -1152,7 +1152,6 @@ mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto)
/*start*/FALSE,
/*load/eject*/0,
/*immediate*/FALSE,
- /*power_condition*/SSS_PC_START_VALID,
MPS_SENSE_LEN,
/*timeout*/10000);
xpt_action(ccb);
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index 4f2c44da3b4f..f7dc231d74df 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -1209,7 +1209,7 @@ nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
static void
nvme_qpair_enable(struct nvme_qpair *qpair)
{
- bool is_admin __unused = qpair == &qpair->ctrlr->adminq;
+ bool is_admin __diagused = qpair == &qpair->ctrlr->adminq;
if (mtx_initialized(&qpair->recovery))
mtx_assert(&qpair->recovery, MA_OWNED);
diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c
index e0e47e11d401..0e6104fe37f2 100644
--- a/sys/dev/pci/pci_iov.c
+++ b/sys/dev/pci/pci_iov.c
@@ -735,16 +735,27 @@ pci_iov_config(struct cdev *cdev, struct pci_iov_arg *arg)
last_rid = first_rid + (num_vfs - 1) * rid_stride;
if (pci_get_bus(dev) != PCI_RID2BUS(last_rid)) {
- int rid = 0;
- uint16_t last_rid_bus = PCI_RID2BUS(last_rid);
-
- iov->iov_bus_res = bus_alloc_resource(bus, PCI_RES_BUS, &rid,
- last_rid_bus, last_rid_bus, 1, RF_ACTIVE);
- if (iov->iov_bus_res == NULL) {
- device_printf(dev,
- "failed to allocate PCIe bus number for VFs\n");
- error = ENOSPC;
- goto out;
+ device_t pcib = device_get_parent(bus);
+ uint8_t secbus = pci_read_config(pcib, PCIR_SECBUS_1, 1);
+ uint8_t subbus = pci_read_config(pcib, PCIR_SUBBUS_1, 1);
+ uint16_t vf_bus = PCI_RID2BUS(last_rid);
+
+ /*
+ * XXX: This should not be directly accessing the bridge registers and does
+ * nothing to prevent some other device from releasing this bus number while
+ * another PF is using it.
+ */
+ if (secbus == 0 || vf_bus < secbus || vf_bus > subbus) {
+ int rid = 0;
+
+ iov->iov_bus_res = bus_alloc_resource(bus, PCI_RES_BUS, &rid,
+ vf_bus, vf_bus, 1, RF_ACTIVE);
+ if (iov->iov_bus_res == NULL) {
+ device_printf(dev,
+ "failed to allocate PCIe bus number for VFs\n");
+ error = ENOSPC;
+ goto out;
+ }
}
}
diff --git a/sys/dev/qlnx/qlnxe/ecore_cxt.c b/sys/dev/qlnx/qlnxe/ecore_cxt.c
index 6ace59ed68ce..153aa956396b 100644
--- a/sys/dev/qlnx/qlnxe/ecore_cxt.c
+++ b/sys/dev/qlnx/qlnxe/ecore_cxt.c
@@ -733,7 +733,7 @@ enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn,
* block in the ILT client. This is later used to
* configure the CDU segment offset registers and
* results in an FL command for TIDs of this
- * segement behaves as regular load commands
+ * segment behaves as regular load commands
* (loading TIDs from the working memory).
*/
line = p_cli->pf_blks[CDUT_SEG_BLK(i)].start_line;
diff --git a/sys/dev/qlnx/qlnxe/ecore_l2.c b/sys/dev/qlnx/qlnxe/ecore_l2.c
index ee7d225540d0..5e281c330765 100644
--- a/sys/dev/qlnx/qlnxe/ecore_l2.c
+++ b/sys/dev/qlnx/qlnxe/ecore_l2.c
@@ -1617,14 +1617,13 @@ ecore_sp_eth_filter_mcast(struct ecore_hwfn *p_hwfn,
struct ecore_spq_comp_cb *p_comp_data)
{
struct vport_update_ramrod_data *p_ramrod = OSAL_NULL;
- u32 bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
struct ecore_spq_entry *p_ent = OSAL_NULL;
struct ecore_sp_init_data init_data;
u8 abs_vport_id = 0;
enum _ecore_status_t rc;
int i;
- if (p_filter_cmd->opcode == ECORE_FILTER_ADD)
+ if (p_filter_cmd->opcode == ECORE_FILTER_REPLACE)
rc = ecore_fw_vport(p_hwfn, p_filter_cmd->vport_to_add_to,
&abs_vport_id);
else
@@ -1654,30 +1653,33 @@ ecore_sp_eth_filter_mcast(struct ecore_hwfn *p_hwfn,
/* explicitly clear out the entire vector */
OSAL_MEMSET(&p_ramrod->approx_mcast.bins,
0, sizeof(p_ramrod->approx_mcast.bins));
- OSAL_MEMSET(bins, 0, sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS);
- /* filter ADD op is explicit set op and it removes
- * any existing filters for the vport.
- */
- if (p_filter_cmd->opcode == ECORE_FILTER_ADD) {
- for (i = 0; i < p_filter_cmd->num_mc_addrs; i++) {
- u32 bit;
-
- bit = ecore_mcast_bin_from_mac(p_filter_cmd->mac[i]);
- bins[bit / 32] |= 1 << (bit % 32);
- }
-
+ /*
+ * filter REPLACE op is explicit set op and it removes
+ * any existing filters for the vport.
+ */
+ if (p_filter_cmd->opcode == ECORE_FILTER_REPLACE) {
+ _Static_assert(sizeof(p_filter_cmd->bins) == sizeof(p_ramrod->approx_mcast.bins), "Size mismatch");
+ _Static_assert(nitems(p_filter_cmd->bins) == ETH_MULTICAST_MAC_BINS_IN_REGS, "Size mismatch");
/* Convert to correct endianity */
for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) {
struct vport_update_ramrod_mcast *p_ramrod_bins;
p_ramrod_bins = &p_ramrod->approx_mcast;
- p_ramrod_bins->bins[i] = OSAL_CPU_TO_LE32(bins[i]);
+ p_ramrod_bins->bins[i] = OSAL_CPU_TO_LE32(p_filter_cmd->bins[i]);
}
- }
+ } /* else FLUSH op clears existing filters */
p_ramrod->common.vport_id = abs_vport_id;
rc = ecore_spq_post(p_hwfn, p_ent, OSAL_NULL);
+
+ DP_INFO(p_hwfn, "Multicast filter cmd: [%s], bins: [%08x, %08x, %08x, %08x, %08x, %08x, %08x, %08x], ret = %d\n",
+ p_filter_cmd->opcode == ECORE_FILTER_REPLACE ? "replace" : "flush",
+ p_ramrod->approx_mcast.bins[0], p_ramrod->approx_mcast.bins[1],
+ p_ramrod->approx_mcast.bins[2], p_ramrod->approx_mcast.bins[3],
+ p_ramrod->approx_mcast.bins[4], p_ramrod->approx_mcast.bins[5],
+ p_ramrod->approx_mcast.bins[6], p_ramrod->approx_mcast.bins[7], rc);
+
if (rc != ECORE_SUCCESS)
DP_ERR(p_hwfn, "Multicast filter command failed %d\n", rc);
@@ -1692,10 +1694,9 @@ enum _ecore_status_t ecore_filter_mcast_cmd(struct ecore_dev *p_dev,
enum _ecore_status_t rc = ECORE_SUCCESS;
int i;
- /* only ADD and REMOVE operations are supported for multi-cast */
- if ((p_filter_cmd->opcode != ECORE_FILTER_ADD &&
- (p_filter_cmd->opcode != ECORE_FILTER_REMOVE)) ||
- (p_filter_cmd->num_mc_addrs > ECORE_MAX_MC_ADDRS)) {
+ /* only REPLACE and FLUSH operations are supported for multi-cast */
+ if ((p_filter_cmd->opcode != ECORE_FILTER_REPLACE &&
+ (p_filter_cmd->opcode != ECORE_FILTER_FLUSH))) {
return ECORE_INVAL;
}
diff --git a/sys/dev/qlnx/qlnxe/ecore_l2_api.h b/sys/dev/qlnx/qlnxe/ecore_l2_api.h
index 610cc329f1fd..3b2f48e9fe11 100644
--- a/sys/dev/qlnx/qlnxe/ecore_l2_api.h
+++ b/sys/dev/qlnx/qlnxe/ecore_l2_api.h
@@ -162,14 +162,13 @@ struct ecore_filter_ucast {
};
struct ecore_filter_mcast {
- /* MOVE is not supported for multicast */
+ /* Only REPLACE and FLUSH is supported for multicast */
enum ecore_filter_opcode opcode;
u8 vport_to_add_to;
u8 vport_to_remove_from;
- u8 num_mc_addrs;
-#define ECORE_MAX_MC_ADDRS 64
- unsigned char mac[ECORE_MAX_MC_ADDRS][ETH_ALEN];
+ u32 bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
};
+#define ECORE_MAX_MC_ADDRS 64
struct ecore_filter_accept_flags {
u8 update_rx_mode_config;
@@ -384,7 +383,7 @@ struct ecore_sp_vport_update_params {
u8 anti_spoofing_en;
u8 update_accept_any_vlan_flg;
u8 accept_any_vlan;
- u32 bins[8];
+ u32 bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
struct ecore_rss_params *rss_params;
struct ecore_filter_accept_flags accept_flags;
struct ecore_sge_tpa_params *sge_tpa_params;
diff --git a/sys/dev/qlnx/qlnxe/ecore_vf.c b/sys/dev/qlnx/qlnxe/ecore_vf.c
index 6cdc94d05c86..a7b006b982de 100644
--- a/sys/dev/qlnx/qlnxe/ecore_vf.c
+++ b/sys/dev/qlnx/qlnxe/ecore_vf.c
@@ -1515,18 +1515,13 @@ void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
struct ecore_filter_mcast *p_filter_cmd)
{
struct ecore_sp_vport_update_params sp_params;
- int i;
OSAL_MEMSET(&sp_params, 0, sizeof(sp_params));
sp_params.update_approx_mcast_flg = 1;
- if (p_filter_cmd->opcode == ECORE_FILTER_ADD) {
- for (i = 0; i < p_filter_cmd->num_mc_addrs; i++) {
- u32 bit;
-
- bit = ecore_mcast_bin_from_mac(p_filter_cmd->mac[i]);
- sp_params.bins[bit / 32] |= 1 << (bit % 32);
- }
+ if (p_filter_cmd->opcode == ECORE_FILTER_REPLACE) {
+ _Static_assert(sizeof(sp_params.bins) == sizeof(p_filter_cmd->bins), "Size mismatch");
+ memcpy(sp_params.bins, p_filter_cmd->bins, sizeof(sp_params.bins));
}
ecore_vf_pf_vport_update(p_hwfn, &sp_params);
diff --git a/sys/dev/qlnx/qlnxe/qlnx_def.h b/sys/dev/qlnx/qlnxe/qlnx_def.h
index 796845f3f8c6..f895487c47e4 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_def.h
+++ b/sys/dev/qlnx/qlnxe/qlnx_def.h
@@ -319,7 +319,6 @@ typedef struct qlnx_link_output qlnx_link_output_t;
#define QLNX_TPA_MAX_AGG_BUFFERS (20)
-#define QLNX_MAX_NUM_MULTICAST_ADDRS ECORE_MAX_MC_ADDRS
typedef struct _qlnx_mcast {
uint16_t rsrvd;
uint8_t addr[6];
@@ -370,7 +369,6 @@ struct qlnx_host {
uint16_t device_id;
if_t ifp;
- int if_flags;
volatile int link_up;
struct ifmedia media;
uint16_t max_frame_size;
@@ -443,9 +441,7 @@ struct qlnx_host {
qlnx_ivec_t irq_vec[QLNX_MAX_RSS];
uint8_t filter;
- uint32_t nmcast;
- qlnx_mcast_t mcast[QLNX_MAX_NUM_MULTICAST_ADDRS];
- struct ecore_filter_mcast ecore_mcast;
+ uint32_t ecore_mcast_bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
uint8_t primary_mac[ETH_ALEN];
uint8_t prio_to_tc[MAX_NUM_PRI];
struct ecore_eth_stats hw_stats;
@@ -683,7 +679,6 @@ extern int qlnx_grc_dump(qlnx_host_t *ha, uint32_t *num_dumped_dwords,
int hwfn_index);
extern int qlnx_idle_chk(qlnx_host_t *ha, uint32_t *num_dumped_dwords,
int hwfn_index);
-extern uint8_t *qlnx_get_mac_addr(qlnx_host_t *ha);
extern void qlnx_fill_link(qlnx_host_t *ha, struct ecore_hwfn *hwfn,
struct qlnx_link_output *if_link);
extern int qlnx_set_lldp_tlvx(qlnx_host_t *ha, qlnx_lldp_sys_tlvs_t *lldp_tlvs);
diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c
index 99110e5e2d8f..85c16842283c 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -30,8 +30,6 @@
* Author : David C Somayajulu, Cavium, Inc., San Jose, CA 95131.
*/
-#include "opt_inet.h"
-
#include <sys/cdefs.h>
#include "qlnx_os.h"
#include "bcm_osal.h"
@@ -50,6 +48,7 @@
#include "ecore_sp_commands.h"
#include "ecore_dev_api.h"
#include "ecore_l2_api.h"
+#include "ecore_l2.h"
#include "ecore_mcp.h"
#include "ecore_hw_defs.h"
#include "mcp_public.h"
@@ -91,9 +90,9 @@ static void qlnx_fp_isr(void *arg);
static void qlnx_init_ifnet(device_t dev, qlnx_host_t *ha);
static void qlnx_init(void *arg);
static void qlnx_init_locked(qlnx_host_t *ha);
-static int qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi);
-static int qlnx_set_promisc(qlnx_host_t *ha, int enabled);
-static int qlnx_set_allmulti(qlnx_host_t *ha, int enabled);
+static int qlnx_set_multi(qlnx_host_t *ha);
+static int qlnx_set_promisc_allmulti(qlnx_host_t *ha, int flags);
+static int _qlnx_set_promisc_allmulti(qlnx_host_t *ha, bool promisc, bool allmulti);
static int qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data);
static int qlnx_media_change(if_t ifp);
static void qlnx_media_status(if_t ifp, struct ifmediareq *ifmr);
@@ -101,6 +100,7 @@ static void qlnx_stop(qlnx_host_t *ha);
static int qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp,
struct mbuf **m_headp);
static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha);
+static void qlnx_get_mac_addr(qlnx_host_t *ha);
static uint32_t qlnx_get_optics(qlnx_host_t *ha,
struct qlnx_link_output *if_link);
static int qlnx_transmit(if_t ifp, struct mbuf *mp);
@@ -128,14 +128,13 @@ static void qlnx_set_id(struct ecore_dev *cdev, char name[NAME_SIZE],
char ver_str[VER_SIZE]);
static void qlnx_unload(qlnx_host_t *ha);
static int qlnx_load(qlnx_host_t *ha);
-static void qlnx_hw_set_multi(qlnx_host_t *ha, uint8_t *mta, uint32_t mcnt,
- uint32_t add_mac);
static void qlnx_dump_buf8(qlnx_host_t *ha, const char *msg, void *dbuf,
uint32_t len);
static int qlnx_alloc_rx_buffer(qlnx_host_t *ha, struct qlnx_rx_queue *rxq);
static void qlnx_reuse_rx_data(struct qlnx_rx_queue *rxq);
static void qlnx_update_rx_prod(struct ecore_hwfn *p_hwfn,
struct qlnx_rx_queue *rxq);
+static int qlnx_remove_all_mcast_mac(qlnx_host_t *ha);
static int qlnx_set_rx_accept_filter(qlnx_host_t *ha, uint8_t filter);
static int qlnx_grc_dumpsize(qlnx_host_t *ha, uint32_t *num_dwords,
int hwfn_index);
@@ -2322,7 +2321,7 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha)
ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN;
- memcpy(ha->primary_mac, qlnx_get_mac_addr(ha), ETH_ALEN);
+ qlnx_get_mac_addr(ha);
if (!ha->primary_mac[0] && !ha->primary_mac[1] &&
!ha->primary_mac[2] && !ha->primary_mac[3] &&
@@ -2392,8 +2391,6 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha)
ifmedia_set(&ha->media, (IFM_ETHER | IFM_AUTO));
ether_ifattach(ifp, ha->primary_mac);
- bcopy(if_getlladdr(ha->ifp), ha->primary_mac, ETHER_ADDR_LEN);
-
QL_DPRINT2(ha, "exit\n");
return;
@@ -2432,7 +2429,8 @@ qlnx_init(void *arg)
QL_DPRINT2(ha, "enter\n");
QLNX_LOCK(ha);
- qlnx_init_locked(ha);
+ if ((if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING) == 0)
+ qlnx_init_locked(ha);
QLNX_UNLOCK(ha);
QL_DPRINT2(ha, "exit\n");
@@ -2440,181 +2438,91 @@ qlnx_init(void *arg)
return;
}
-static int
-qlnx_config_mcast_mac_addr(qlnx_host_t *ha, uint8_t *mac_addr, uint32_t add_mac)
-{
- struct ecore_filter_mcast *mcast;
- struct ecore_dev *cdev;
- int rc;
-
- cdev = &ha->cdev;
-
- mcast = &ha->ecore_mcast;
- bzero(mcast, sizeof(struct ecore_filter_mcast));
-
- if (add_mac)
- mcast->opcode = ECORE_FILTER_ADD;
- else
- mcast->opcode = ECORE_FILTER_REMOVE;
-
- mcast->num_mc_addrs = 1;
- memcpy(mcast->mac, mac_addr, ETH_ALEN);
-
- rc = ecore_filter_mcast_cmd(cdev, mcast, ECORE_SPQ_MODE_CB, NULL);
-
- return (rc);
-}
-
-static int
-qlnx_hw_add_mcast(qlnx_host_t *ha, uint8_t *mta)
-{
- int i;
-
- for (i = 0; i < QLNX_MAX_NUM_MULTICAST_ADDRS; i++) {
- if (QL_MAC_CMP(ha->mcast[i].addr, mta) == 0)
- return 0; /* its been already added */
- }
-
- for (i = 0; i < QLNX_MAX_NUM_MULTICAST_ADDRS; i++) {
- if ((ha->mcast[i].addr[0] == 0) &&
- (ha->mcast[i].addr[1] == 0) &&
- (ha->mcast[i].addr[2] == 0) &&
- (ha->mcast[i].addr[3] == 0) &&
- (ha->mcast[i].addr[4] == 0) &&
- (ha->mcast[i].addr[5] == 0)) {
- if (qlnx_config_mcast_mac_addr(ha, mta, 1))
- return (-1);
-
- bcopy(mta, ha->mcast[i].addr, ETH_ALEN);
- ha->nmcast++;
-
- return 0;
- }
- }
- return 0;
-}
-
-static int
-qlnx_hw_del_mcast(qlnx_host_t *ha, uint8_t *mta)
-{
- int i;
-
- for (i = 0; i < QLNX_MAX_NUM_MULTICAST_ADDRS; i++) {
- if (QL_MAC_CMP(ha->mcast[i].addr, mta) == 0) {
- if (qlnx_config_mcast_mac_addr(ha, mta, 0))
- return (-1);
-
- ha->mcast[i].addr[0] = 0;
- ha->mcast[i].addr[1] = 0;
- ha->mcast[i].addr[2] = 0;
- ha->mcast[i].addr[3] = 0;
- ha->mcast[i].addr[4] = 0;
- ha->mcast[i].addr[5] = 0;
-
- ha->nmcast--;
-
- return 0;
- }
- }
- return 0;
-}
-
-/*
- * Name: qls_hw_set_multi
- * Function: Sets the Multicast Addresses provided the host O.S into the
- * hardware (for the given interface)
- */
-static void
-qlnx_hw_set_multi(qlnx_host_t *ha, uint8_t *mta, uint32_t mcnt,
- uint32_t add_mac)
-{
- int i;
-
- for (i = 0; i < mcnt; i++) {
- if (add_mac) {
- if (qlnx_hw_add_mcast(ha, mta))
- break;
- } else {
- if (qlnx_hw_del_mcast(ha, mta))
- break;
- }
-
- mta += ETHER_ADDR_LEN;
- }
- return;
-}
-
static u_int
-qlnx_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt)
+qlnx_mcast_bins_from_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt)
{
- uint8_t *mta = arg;
+ uint8_t bit;
+ uint32_t *bins = arg;
- if (mcnt == QLNX_MAX_NUM_MULTICAST_ADDRS)
- return (0);
-
- bcopy(LLADDR(sdl), &mta[mcnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN);
+ bit = ecore_mcast_bin_from_mac(LLADDR(sdl));
+ bins[bit / 32] |= 1 << (bit % 32);
return (1);
}
static int
-qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi)
+qlnx_set_multi(qlnx_host_t *ha)
{
- uint8_t mta[QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_ADDR_LEN];
- if_t ifp = ha->ifp;
- u_int mcnt;
+ struct ecore_filter_mcast mcast;
+ struct ecore_dev *cdev;
+ if_t ifp = ha->ifp;
+ u_int mcnt __unused;
+ int rc;
if (qlnx_vf_device(ha) == 0)
return (0);
- mcnt = if_foreach_llmaddr(ifp, qlnx_copy_maddr, mta);
+ bzero(&mcast, sizeof(struct ecore_filter_mcast));
+ mcnt = if_foreach_llmaddr(ifp, qlnx_mcast_bins_from_maddr, mcast.bins);
+ QL_DPRINT1(ha, "total %d multicast MACs found\n", mcnt);
- QLNX_LOCK(ha);
- qlnx_hw_set_multi(ha, mta, mcnt, add_multi);
- QLNX_UNLOCK(ha);
+ if (memcmp(ha->ecore_mcast_bins, mcast.bins, sizeof(mcast.bins)) == 0)
+ return (0);
- return (0);
+ cdev = &ha->cdev;
+ mcast.opcode = ECORE_FILTER_REPLACE;
+ rc = ecore_filter_mcast_cmd(cdev, &mcast, ECORE_SPQ_MODE_CB, NULL);
+ if (rc == 0)
+ memcpy(ha->ecore_mcast_bins, mcast.bins, sizeof(mcast.bins));
+
+ QL_DPRINT1(ha, "ecore_filter_mcast_cmd: end(%d)\n", rc);
+ return (rc);
}
static int
-qlnx_set_promisc(qlnx_host_t *ha, int enabled)
+qlnx_set_promisc_allmulti(qlnx_host_t *ha, int flags)
{
int rc = 0;
- uint8_t filter;
if (qlnx_vf_device(ha) == 0)
return (0);
- filter = ha->filter;
- if (enabled) {
- filter |= ECORE_ACCEPT_MCAST_UNMATCHED;
- filter |= ECORE_ACCEPT_UCAST_UNMATCHED;
- } else {
- filter &= ~ECORE_ACCEPT_MCAST_UNMATCHED;
- filter &= ~ECORE_ACCEPT_UCAST_UNMATCHED;
- }
-
- rc = qlnx_set_rx_accept_filter(ha, filter);
+ rc = _qlnx_set_promisc_allmulti(ha, flags & IFF_PROMISC,
+ flags & IFF_ALLMULTI);
return (rc);
}
static int
-qlnx_set_allmulti(qlnx_host_t *ha, int enabled)
+_qlnx_set_promisc_allmulti(qlnx_host_t *ha, bool promisc, bool allmulti)
{
int rc = 0;
uint8_t filter;
-
- if (qlnx_vf_device(ha) == 0)
- return (0);
+ bool mcast, ucast;
filter = ha->filter;
- if (enabled) {
+ filter |= ECORE_ACCEPT_UCAST_MATCHED;
+ filter |= ECORE_ACCEPT_MCAST_MATCHED;
+ filter |= ECORE_ACCEPT_BCAST;
+
+ mcast = promisc || allmulti;
+ ucast = promisc;
+
+ if (mcast)
filter |= ECORE_ACCEPT_MCAST_UNMATCHED;
- } else {
+ else
filter &= ~ECORE_ACCEPT_MCAST_UNMATCHED;
- }
- rc = qlnx_set_rx_accept_filter(ha, filter);
+ if (ucast)
+ filter |= ECORE_ACCEPT_UCAST_UNMATCHED;
+ else
+ filter &= ~ECORE_ACCEPT_UCAST_UNMATCHED;
+
+ if (filter == ha->filter)
+ return (0);
+
+ rc = qlnx_set_rx_accept_filter(ha, filter);
+ if (rc == 0)
+ ha->filter = filter;
return (rc);
}
@@ -2624,35 +2532,11 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
int ret = 0, mask;
int flags;
struct ifreq *ifr = (struct ifreq *)data;
-#ifdef INET
- struct ifaddr *ifa = (struct ifaddr *)data;
-#endif
qlnx_host_t *ha;
ha = (qlnx_host_t *)if_getsoftc(ifp);
switch (cmd) {
- case SIOCSIFADDR:
- QL_DPRINT4(ha, "SIOCSIFADDR (0x%lx)\n", cmd);
-
-#ifdef INET
- if (ifa->ifa_addr->sa_family == AF_INET) {
- if_setflagbits(ifp, IFF_UP, 0);
- if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) {
- QLNX_LOCK(ha);
- qlnx_init_locked(ha);
- QLNX_UNLOCK(ha);
- }
- QL_DPRINT4(ha, "SIOCSIFADDR (0x%lx) ipv4 [0x%08x]\n",
- cmd, ntohl(IA_SIN(ifa)->sin_addr.s_addr));
-
- arp_ifinit(ifp, ifa);
- break;
- }
-#endif
- ether_ioctl(ifp, cmd, data);
- break;
-
case SIOCSIFMTU:
QL_DPRINT4(ha, "SIOCSIFMTU (0x%lx)\n", cmd);
@@ -2680,13 +2564,8 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
if (flags & IFF_UP) {
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
- if ((flags ^ ha->if_flags) &
- IFF_PROMISC) {
- ret = qlnx_set_promisc(ha, flags & IFF_PROMISC);
- } else if ((if_getflags(ifp) ^ ha->if_flags) &
- IFF_ALLMULTI) {
- ret = qlnx_set_allmulti(ha, flags & IFF_ALLMULTI);
- }
+ if (qlnx_set_promisc_allmulti(ha, flags) != 0)
+ ret = EINVAL;
} else {
ha->max_frame_size = if_getmtu(ifp) +
ETHER_HDR_LEN + ETHER_CRC_LEN;
@@ -2697,26 +2576,19 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
qlnx_stop(ha);
}
- ha->if_flags = if_getflags(ifp);
QLNX_UNLOCK(ha);
break;
case SIOCADDMULTI:
- QL_DPRINT4(ha, "%s (0x%lx)\n", "SIOCADDMULTI", cmd);
-
- if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
- if (qlnx_set_multi(ha, 1))
- ret = EINVAL;
- }
- break;
-
case SIOCDELMULTI:
- QL_DPRINT4(ha, "%s (0x%lx)\n", "SIOCDELMULTI", cmd);
+ QL_DPRINT4(ha, "%s (0x%lx)\n", "SIOCADDMULTI/SIOCDELMULTI", cmd);
- if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
- if (qlnx_set_multi(ha, 0))
+ QLNX_LOCK(ha);
+ if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
+ if (qlnx_set_multi(ha) != 0)
ret = EINVAL;
}
+ QLNX_UNLOCK(ha);
break;
case SIOCSIFMEDIA:
@@ -3018,6 +2890,7 @@ qlnx_transmit_locked(if_t ifp, struct qlnx_fastpath *fp, struct mbuf *mp)
drbr_advance(ifp, fp->tx_br);
fp->tx_pkts_transmitted++;
fp->tx_pkts_processed++;
+ ETHER_BPF_MTAP(ifp, mp);
}
mp = drbr_peek(ifp, fp->tx_br);
@@ -3774,7 +3647,7 @@ qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha)
return(TX_RING_SIZE - 1);
}
-uint8_t *
+static void
qlnx_get_mac_addr(qlnx_host_t *ha)
{
struct ecore_hwfn *p_hwfn;
@@ -3783,8 +3656,10 @@ qlnx_get_mac_addr(qlnx_host_t *ha)
p_hwfn = &ha->cdev.hwfns[0];
- if (qlnx_vf_device(ha) != 0)
- return (p_hwfn->hw_info.hw_mac_addr);
+ if (qlnx_vf_device(ha) != 0) {
+ memcpy(ha->primary_mac, p_hwfn->hw_info.hw_mac_addr, ETH_ALEN);
+ return;
+ }
ecore_vf_read_bulletin(p_hwfn, &p_is_forced);
if (ecore_vf_bulletin_get_forced_mac(p_hwfn, mac, &p_is_forced) ==
@@ -3794,8 +3669,6 @@ qlnx_get_mac_addr(qlnx_host_t *ha)
p_is_forced, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
memcpy(ha->primary_mac, mac, ETH_ALEN);
}
-
- return (ha->primary_mac);
}
static uint32_t
@@ -6979,31 +6852,18 @@ qlnx_remove_all_ucast_mac(qlnx_host_t *ha)
static int
qlnx_remove_all_mcast_mac(qlnx_host_t *ha)
{
- struct ecore_filter_mcast *mcast;
+ struct ecore_filter_mcast mcast;
struct ecore_dev *cdev;
- int rc, i;
+ int rc;
cdev = &ha->cdev;
- mcast = &ha->ecore_mcast;
- bzero(mcast, sizeof(struct ecore_filter_mcast));
-
- mcast->opcode = ECORE_FILTER_REMOVE;
+ bzero(&mcast, sizeof(struct ecore_filter_mcast));
+ mcast.opcode = ECORE_FILTER_FLUSH;
- for (i = 0; i < QLNX_MAX_NUM_MULTICAST_ADDRS; i++) {
- if (ha->mcast[i].addr[0] || ha->mcast[i].addr[1] ||
- ha->mcast[i].addr[2] || ha->mcast[i].addr[3] ||
- ha->mcast[i].addr[4] || ha->mcast[i].addr[5]) {
- memcpy(&mcast->mac[i][0], &ha->mcast[i].addr[0], ETH_ALEN);
- mcast->num_mc_addrs++;
- }
- }
- mcast = &ha->ecore_mcast;
-
- rc = ecore_filter_mcast_cmd(cdev, mcast, ECORE_SPQ_MODE_CB, NULL);
-
- bzero(ha->mcast, (sizeof(qlnx_mcast_t) * QLNX_MAX_NUM_MULTICAST_ADDRS));
- ha->nmcast = 0;
+ rc = ecore_filter_mcast_cmd(cdev, &mcast, ECORE_SPQ_MODE_CB, NULL);
+ if (rc == 0)
+ bzero(ha->ecore_mcast_bins, sizeof(ha->ecore_mcast_bins));
return (rc);
}
@@ -7013,6 +6873,9 @@ qlnx_clean_filters(qlnx_host_t *ha)
{
int rc = 0;
+ /* Reset rx filter */
+ ha->filter = 0;
+
/* Remove all unicast macs */
rc = qlnx_remove_all_ucast_mac(ha);
if (rc)
@@ -7056,40 +6919,20 @@ static int
qlnx_set_rx_mode(qlnx_host_t *ha)
{
int rc = 0;
- uint8_t filter;
const if_t ifp = ha->ifp;
- const struct ifaddr *ifa;
- struct sockaddr_dl *sdl;
- ifa = if_getifaddr(ifp);
- if (if_gettype(ifp) == IFT_ETHER && ifa != NULL &&
- ifa->ifa_addr != NULL) {
- sdl = (struct sockaddr_dl *) ifa->ifa_addr;
-
- rc = qlnx_set_ucast_rx_mac(ha, ECORE_FILTER_REPLACE, LLADDR(sdl));
- } else {
- rc = qlnx_set_ucast_rx_mac(ha, ECORE_FILTER_REPLACE, ha->primary_mac);
- }
- if (rc)
- return rc;
+ rc = qlnx_set_ucast_rx_mac(ha, ECORE_FILTER_REPLACE, if_getlladdr(ifp));
+ if (rc)
+ return rc;
- rc = qlnx_remove_all_mcast_mac(ha);
+ rc = qlnx_set_multi(ha);
if (rc)
return rc;
- filter = ECORE_ACCEPT_UCAST_MATCHED |
- ECORE_ACCEPT_MCAST_MATCHED |
- ECORE_ACCEPT_BCAST;
-
- if (qlnx_vf_device(ha) == 0 || (if_getflags(ha->ifp) & IFF_PROMISC)) {
- filter |= ECORE_ACCEPT_UCAST_UNMATCHED;
- filter |= ECORE_ACCEPT_MCAST_UNMATCHED;
- } else if (if_getflags(ha->ifp) & IFF_ALLMULTI) {
- filter |= ECORE_ACCEPT_MCAST_UNMATCHED;
- }
- ha->filter = filter;
-
- rc = qlnx_set_rx_accept_filter(ha, filter);
+ if (qlnx_vf_device(ha) == 0)
+ rc = _qlnx_set_promisc_allmulti(ha, true, true);
+ else
+ rc = qlnx_set_promisc_allmulti(ha, if_getflags(ifp));
return (rc);
}
diff --git a/sys/dev/random/armv8rng.c b/sys/dev/random/armv8rng.c
index 9573c09aa77a..7aa6f4b0ded1 100644
--- a/sys/dev/random/armv8rng.c
+++ b/sys/dev/random/armv8rng.c
@@ -98,8 +98,8 @@ rndr_modevent(module_t mod, int type, void *unused)
switch (type) {
case MOD_LOAD:
has_rndr = false;
- if (get_kernel_reg(ID_AA64ISAR0_EL1, &reg) &&
- ID_AA64ISAR0_RNDR_VAL(reg) != ID_AA64ISAR0_RNDR_NONE) {
+ get_kernel_reg(ID_AA64ISAR0_EL1, &reg);
+ if (ID_AA64ISAR0_RNDR_VAL(reg) != ID_AA64ISAR0_RNDR_NONE) {
has_rndr = true;
random_source_register(&random_armv8_rndr);
printf("random: fast provider: \"%s\"\n",
diff --git a/sys/dev/rge/if_rge.c b/sys/dev/rge/if_rge.c
index fde8e9df31fe..443acbbd77c3 100644
--- a/sys/dev/rge/if_rge.c
+++ b/sys/dev/rge/if_rge.c
@@ -423,8 +423,12 @@ rge_attach(device_t dev)
// device_printf(dev, "RTL8126_2\n");
break;
case 0x68800000:
- sc->rge_type = MAC_R25D;
-// device_printf(dev, "RTL8125D\n");
+ sc->rge_type = MAC_R25D_1;
+// device_printf(dev, "RTL8125D_1\n");
+ break;
+ case 0x68900000:
+ sc->rge_type = MAC_R25D_2;
+// device_printf(dev, "RTL8125D_2\n");
break;
case 0x6c900000:
sc->rge_type = MAC_R27;
@@ -1159,7 +1163,7 @@ rge_init_locked(struct rge_softc *sc)
rxconf = RGE_RXCFG_CONFIG;
else if (sc->rge_type == MAC_R25B)
rxconf = RGE_RXCFG_CONFIG_8125B;
- else if (sc->rge_type == MAC_R25D)
+ else if (RGE_TYPE_R25D(sc))
rxconf = RGE_RXCFG_CONFIG_8125D;
else
rxconf = RGE_RXCFG_CONFIG_8126;
@@ -1173,7 +1177,7 @@ rge_init_locked(struct rge_softc *sc)
/* Disable L1 timeout. */
val = rge_read_csi(sc, 0x890) & ~0x00000001;
rge_write_csi(sc, 0x890, val);
- } else if (sc->rge_type != MAC_R25D)
+ } else if (!RGE_TYPE_R25D(sc))
RGE_WRITE_2(sc, 0x0382, 0x221b);
RGE_WRITE_1(sc, RGE_RSS_CTRL, 0);
@@ -1199,7 +1203,7 @@ rge_init_locked(struct rge_softc *sc)
val = rge_read_mac_ocp(sc, 0xe614);
val &= (sc->rge_type == MAC_R27) ? ~0x0f00 : ~0x0700;
- if (sc->rge_type == MAC_R25 || sc->rge_type == MAC_R25D)
+ if (sc->rge_type == MAC_R25 || RGE_TYPE_R25D(sc))
rge_write_mac_ocp(sc, 0xe614, val | 0x0300);
else if (sc->rge_type == MAC_R25B)
rge_write_mac_ocp(sc, 0xe614, val | 0x0200);
@@ -1235,7 +1239,7 @@ rge_init_locked(struct rge_softc *sc)
val = rge_read_mac_ocp(sc, 0xea1c) & ~0x0003;
rge_write_mac_ocp(sc, 0xea1c, val | 0x0001);
- if (sc->rge_type == MAC_R25D)
+ if (RGE_TYPE_R25D(sc))
rge_write_mac_ocp(sc, 0xe0c0, 0x4403);
else
rge_write_mac_ocp(sc, 0xe0c0, 0x4000);
@@ -1251,7 +1255,7 @@ rge_init_locked(struct rge_softc *sc)
if (sc->rge_type == MAC_R25)
RGE_SETBIT_1(sc, RGE_MCUCMD, 0x01);
- if (sc->rge_type != MAC_R25D) {
+ if (!RGE_TYPE_R25D(sc)) {
/* Disable EEE plus. */
RGE_MAC_CLRBIT(sc, 0xe080, 0x0002);
}
@@ -1306,7 +1310,7 @@ rge_init_locked(struct rge_softc *sc)
val = rge_read_csi(sc, 0x98) & ~0x0000ff00;
rge_write_csi(sc, 0x98, val);
- if (sc->rge_type == MAC_R25D) {
+ if (RGE_TYPE_R25D(sc)) {
val = rge_read_mac_ocp(sc, 0xe092) & ~0x00ff;
rge_write_mac_ocp(sc, 0xe092, val | 0x0008);
} else
diff --git a/sys/dev/rge/if_rge_hw.c b/sys/dev/rge/if_rge_hw.c
index ccd6580b2cfc..35a0e93dd193 100644
--- a/sys/dev/rge/if_rge_hw.c
+++ b/sys/dev/rge/if_rge_hw.c
@@ -78,7 +78,8 @@ static void rge_phy_config_mac_r26_1(struct rge_softc *sc);
static void rge_phy_config_mac_r26_2(struct rge_softc *sc);
static void rge_phy_config_mac_r25(struct rge_softc *sc);
static void rge_phy_config_mac_r25b(struct rge_softc *sc);
-static void rge_phy_config_mac_r25d(struct rge_softc *sc);
+static void rge_phy_config_mac_r25d_1(struct rge_softc *);
+static void rge_phy_config_mac_r25d_2(struct rge_softc *);
static void rge_phy_config_mcu(struct rge_softc *sc, uint16_t rcodever);
static void rge_hw_init(struct rge_softc *sc);
static void rge_disable_phy_ocp_pwrsave(struct rge_softc *sc);
@@ -230,7 +231,7 @@ rge_mac_config_mcu(struct rge_softc *sc, enum rge_mac_type type)
rge_write_mac_ocp(sc, rtl8125b_mac_bps[i].reg,
rtl8125b_mac_bps[i].val);
}
- } else if (type == MAC_R25D) {
+ } else if (type == MAC_R25D_1) {
for (npages = 0; npages < 3; npages++) {
rge_switch_mcu_ram_page(sc, npages);
@@ -268,6 +269,35 @@ rge_mac_config_mcu(struct rge_softc *sc, enum rge_mac_type type)
rge_write_mac_ocp(sc, 0xfc26, 0x8000);
rge_write_mac_ocp(sc, 0xfc28, 0x14a2);
rge_write_mac_ocp(sc, 0xfc48, 0x0001);
+ } else if (type == MAC_R25D_2) {
+ for (npages = 0; npages < 3; npages++) {
+ rge_switch_mcu_ram_page(sc, npages);
+
+ for (i = 0; i < nitems(rtl8125d_2_mac_bps); i++) {
+ if (npages == 0)
+ rge_write_mac_ocp(sc,
+ rtl8125d_2_mac_bps[i].reg,
+ rtl8125d_2_mac_bps[i].val);
+ else
+ rge_write_mac_ocp(sc,
+ rtl8125d_2_mac_bps[i].reg, 0);
+ }
+
+ for (reg = 0xf884; reg <= 0xf9f6; reg += 2)
+ rge_write_mac_ocp(sc, reg, 0);
+
+ rge_write_mac_ocp(sc, 0xf9f8,
+ (npages == 2) ? 0x6938 : 0);
+ rge_write_mac_ocp(sc, 0xf9fa,
+ (npages == 2) ? 0x0a19: 0);
+ rge_write_mac_ocp(sc, 0xf9fc,
+ (npages == 2) ? 0x030e: 0);
+ rge_write_mac_ocp(sc, 0xf9fe,
+ (npages == 2) ? 0x0b2f: 0);
+ }
+ rge_write_mac_ocp(sc, 0xfc26, 0x8000);
+ rge_write_mac_ocp(sc, 0xfc28, 0x2382);
+ rge_write_mac_ocp(sc, 0xfc48, 0x0001);
}
}
@@ -300,7 +330,7 @@ rge_mac_config_ext_mcu(struct rge_softc *sc, enum rge_mac_type type)
}
rge_write_mac_ocp(sc, 0xfc26, 0x8000);
rge_write_mac_ocp(sc, 0xfc2c, 0x2360);
- rge_write_mac_ocp(sc, 0xfc2E, 0x14a4);
+ rge_write_mac_ocp(sc, 0xfc2e, 0x14a4);
rge_write_mac_ocp(sc, 0xfc30, 0x415e);
rge_write_mac_ocp(sc, 0xfc32, 0x41e4);
rge_write_mac_ocp(sc, 0xfc34, 0x4280);
@@ -508,8 +538,11 @@ rge_phy_config(struct rge_softc *sc)
case MAC_R25B:
rge_phy_config_mac_r25b(sc);
break;
- case MAC_R25D:
- rge_phy_config_mac_r25d(sc);
+ case MAC_R25D_1:
+ rge_phy_config_mac_r25d_1(sc);
+ break;
+ case MAC_R25D_2:
+ rge_phy_config_mac_r25d_2(sc);
break;
case MAC_R26_1:
rge_phy_config_mac_r26_1(sc);
@@ -531,7 +564,7 @@ rge_phy_config(struct rge_softc *sc)
if (sc->rge_type == MAC_R25) {
RGE_MAC_CLRBIT(sc, 0xeb62, 0x0006);
RGE_PHY_CLRBIT(sc, 0xa432, 0x0010);
- } else if (sc->rge_type == MAC_R25B || sc->rge_type == MAC_R25D)
+ } else if (sc->rge_type == MAC_R25B || RGE_TYPE_R25D(sc))
RGE_PHY_SETBIT(sc, 0xa432, 0x0010);
RGE_PHY_CLRBIT(sc, 0xa5d0, (sc->rge_type == MAC_R27) ? 0x000e : 0x0006);
@@ -1363,12 +1396,12 @@ rge_phy_config_mac_r25b(struct rge_softc *sc)
}
static void
-rge_phy_config_mac_r25d(struct rge_softc *sc)
+rge_phy_config_mac_r25d_1(struct rge_softc *sc)
{
uint16_t val;
int i;
- rge_phy_config_mcu(sc, RGE_MAC_R25D_RCODE_VER);
+ rge_phy_config_mcu(sc, RGE_MAC_R25D_1_RCODE_VER);
RGE_PHY_SETBIT(sc, 0xa442, 0x0800);
@@ -1556,6 +1589,67 @@ rge_phy_config_mac_r25d(struct rge_softc *sc)
}
static void
+rge_phy_config_mac_r25d_2(struct rge_softc *sc)
+{
+ uint16_t val;
+
+ rge_phy_config_mcu(sc, RGE_MAC_R25D_2_RCODE_VER);
+
+ RGE_PHY_SETBIT(sc, 0xa442, 0x0800);
+
+ rge_patch_phy_mcu(sc, 1);
+ val = rge_read_phy_ocp(sc, 0xbcd8) & ~0xc000;
+ rge_write_phy_ocp(sc, 0xbcd8, val | 0x4000);
+ RGE_PHY_SETBIT(sc, 0xbcd8, 0xc000);
+ val = rge_read_phy_ocp(sc, 0xbcd8) & ~0xc000;
+ rge_write_phy_ocp(sc, 0xbcd8, val | 0x4000);
+ val = rge_read_phy_ocp(sc, 0xbc80) & ~0x001f;
+ rge_write_phy_ocp(sc, 0xbc80, val | 0x0004);
+ RGE_PHY_SETBIT(sc, 0xbc82, 0xe000);
+ RGE_PHY_SETBIT(sc, 0xbc82, 0x1c00);
+ val = rge_read_phy_ocp(sc, 0xbc80) & ~0x001f;
+ rge_write_phy_ocp(sc, 0xbc80, val | 0x0005);
+ val = rge_read_phy_ocp(sc, 0xbc82) & ~0x00e0;
+ rge_write_phy_ocp(sc, 0xbc82, val | 0x0040);
+ RGE_PHY_SETBIT(sc, 0xbc82, 0x001c);
+ RGE_PHY_CLRBIT(sc, 0xbcd8, 0xc000);
+ val = rge_read_phy_ocp(sc, 0xbcd8) & ~0xc000;
+ rge_write_phy_ocp(sc, 0xbcd8, val | 0x8000);
+ RGE_PHY_CLRBIT(sc, 0xbcd8, 0xc000);
+ rge_patch_phy_mcu(sc, 0);
+
+ val = rge_read_phy_ocp(sc, 0xac7e) & ~0x01fc;
+ rge_write_phy_ocp(sc, 0xac7e, val | 0x00b4);
+ rge_write_phy_ocp(sc, 0xb87c, 0x8105);
+ val = rge_read_phy_ocp(sc, 0xb87e) & ~0xff00;
+ rge_write_phy_ocp(sc, 0xb87e, val | 0x7a00);
+ rge_write_phy_ocp(sc, 0xb87c, 0x8117);
+ val = rge_read_phy_ocp(sc, 0xb87e) & ~0xff00;
+ rge_write_phy_ocp(sc, 0xb87e, val | 0x3a00);
+ rge_write_phy_ocp(sc, 0xb87c, 0x8103);
+ val = rge_read_phy_ocp(sc, 0xb87e) & ~0xff00;
+ rge_write_phy_ocp(sc, 0xb87e, val | 0x7400);
+ rge_write_phy_ocp(sc, 0xb87c, 0x8115);
+ val = rge_read_phy_ocp(sc, 0xb87e) & ~0xff00;
+ rge_write_phy_ocp(sc, 0xb87e, val | 0x3400);
+ rge_write_phy_ocp(sc, 0xb87c, 0x8feb);
+ val = rge_read_phy_ocp(sc, 0xb87e) & ~0xff00;
+ rge_write_phy_ocp(sc, 0xb87e, val | 0x0500);
+ rge_write_phy_ocp(sc, 0xb87c, 0x8fea);
+ val = rge_read_phy_ocp(sc, 0xb87e) & ~0xff00;
+ rge_write_phy_ocp(sc, 0xb87e, val | 0x0700);
+ rge_write_phy_ocp(sc, 0xb87c, 0x80d6);
+ val = rge_read_phy_ocp(sc, 0xb87e) & ~0xff00;
+ rge_write_phy_ocp(sc, 0xb87e, val | 0xef00);
+ RGE_PHY_CLRBIT(sc, 0xa5d4, 0x0020);
+ RGE_PHY_CLRBIT(sc, 0xa654, 0x0800);
+ RGE_PHY_CLRBIT(sc, 0xa448, 0x0400);
+ RGE_PHY_CLRBIT(sc, 0xa586, 0x0400);
+ RGE_PHY_SETBIT(sc, 0xa430, 0x1001);
+ RGE_PHY_SETBIT(sc, 0xa442, 0x0080);
+}
+
+static void
rge_phy_config_mcu(struct rge_softc *sc, uint16_t rcodever)
{
if (sc->rge_rcodever != rcodever) {
@@ -1586,22 +1680,37 @@ rge_phy_config_mcu(struct rge_softc *sc, uint16_t rcodever)
for (i = 0; i < nitems(mac_r25b_mcu); i++)
rge_write_phy_ocp(sc,
mac_r25b_mcu[i].reg, mac_r25b_mcu[i].val);
- } else if (sc->rge_type == MAC_R25D) {
+ } else if (sc->rge_type == MAC_R25D_1) {
for (i = 0; i < 2403; i++)
rge_write_phy_ocp(sc,
- mac_r25d_mcu[i].reg, mac_r25d_mcu[i].val);
+ mac_r25d_1_mcu[i].reg,
+ mac_r25d_1_mcu[i].val);
rge_patch_phy_mcu(sc, 0);
rge_patch_phy_mcu(sc, 1);
for (; i < 2528; i++)
rge_write_phy_ocp(sc,
- mac_r25d_mcu[i].reg, mac_r25d_mcu[i].val);
+ mac_r25d_1_mcu[i].reg,
+ mac_r25d_1_mcu[i].val);
+ rge_patch_phy_mcu(sc, 0);
+
+ rge_patch_phy_mcu(sc, 1);
+ for (; i < nitems(mac_r25d_1_mcu); i++)
+ rge_write_phy_ocp(sc,
+ mac_r25d_1_mcu[i].reg,
+ mac_r25d_1_mcu[i].val);
+ } else if (sc->rge_type == MAC_R25D_2) {
+ for (i = 0; i < 1269; i++)
+ rge_write_phy_ocp(sc,
+ mac_r25d_2_mcu[i].reg,
+ mac_r25d_2_mcu[i].val);
rge_patch_phy_mcu(sc, 0);
rge_patch_phy_mcu(sc, 1);
- for (; i < nitems(mac_r25d_mcu); i++)
+ for (; i < nitems(mac_r25d_2_mcu); i++)
rge_write_phy_ocp(sc,
- mac_r25d_mcu[i].reg, mac_r25d_mcu[i].val);
+ mac_r25d_2_mcu[i].reg,
+ mac_r25d_2_mcu[i].val);
} else if (sc->rge_type == MAC_R26_1) {
for (i = 0; i < 6989; i++)
rge_write_phy_ocp(sc,
diff --git a/sys/dev/rge/if_rge_microcode.h b/sys/dev/rge/if_rge_microcode.h
index f2803b869e3f..15f07099f80e 100644
--- a/sys/dev/rge/if_rge_microcode.h
+++ b/sys/dev/rge/if_rge_microcode.h
@@ -166,6 +166,31 @@ static const struct rge_hw_regaddr_array rtl8125b_mac_bps[] = {
{ 0xfc30, 0x4a20 }, { 0xfc32, 0x47a0 }, { 0xfc48, 0x003f }
};
+static const struct rge_hw_regaddr_array rtl8125d_2_mac_bps[] = {
+ { 0xf800, 0xe010 }, { 0xf802, 0xe014 }, { 0xf804, 0xe016 },
+ { 0xf806, 0xe018 }, { 0xf808, 0xe01a }, { 0xf80a, 0xe01c },
+ { 0xf80c, 0xe01e }, { 0xf80e, 0xe020 }, { 0xf810, 0xe022 },
+ { 0xf812, 0xe024 }, { 0xf814, 0xe026 }, { 0xf816, 0xe028 },
+ { 0xf818, 0xe02a }, { 0xf81a, 0xe02c }, { 0xf81c, 0xe02e },
+ { 0xf81e, 0xe030 }, { 0xf820, 0xc104 }, { 0xf822, 0xc202 },
+ { 0xf824, 0xba00 }, { 0xf826, 0x2384 }, { 0xf828, 0xd116 },
+ { 0xf82a, 0xc602 }, { 0xf82c, 0xbe00 }, { 0xf82e, 0x0000 },
+ { 0xf830, 0xc602 }, { 0xf832, 0xbe00 }, { 0xf834, 0x0000 },
+ { 0xf836, 0xc602 }, { 0xf838, 0xbe00 }, { 0xf83a, 0x0000 },
+ { 0xf83c, 0xc602 }, { 0xf83e, 0xbe00 }, { 0xf840, 0x0000 },
+ { 0xf842, 0xc602 }, { 0xf844, 0xbe00 }, { 0xf846, 0x0000 },
+ { 0xf848, 0xc602 }, { 0xf84a, 0xbe00 }, { 0xf84c, 0x0000 },
+ { 0xf84e, 0xc602 }, { 0xf850, 0xbe00 }, { 0xf852, 0x0000 },
+ { 0xf854, 0xc602 }, { 0xf856, 0xbe00 }, { 0xf858, 0x0000 },
+ { 0xf85a, 0xc602 }, { 0xf85c, 0xbe00 }, { 0xf85e, 0x0000 },
+ { 0xf860, 0xc602 }, { 0xf862, 0xbe00 }, { 0xf864, 0x0000 },
+ { 0xf866, 0xc602 }, { 0xf868, 0xbe00 }, { 0xf86a, 0x0000 },
+ { 0xf86c, 0xc602 }, { 0xf86e, 0xbe00 }, { 0xf870, 0x0000 },
+ { 0xf872, 0xc602 }, { 0xf874, 0xbe00 }, { 0xf876, 0x0000 },
+ { 0xf878, 0xc602 }, { 0xf87a, 0xbe00 }, { 0xf87c, 0x0000 },
+ { 0xf87e, 0xc602 }, { 0xf880, 0xbe00 }, { 0xf882, 0x0000 }
+};
+
struct rge_mac_bps {
int count;
const uint16_t *regs;
@@ -489,6 +514,615 @@ static const struct rge_hw_regaddr_array mac_r27_ephy[] = {
{ 0x941c, 0x0190 }, { 0x981c, 0x0140 }, { 0x9c1c, 0x0140 }
};
+static const struct rge_hw_regaddr_array mac_r25d_2_mcu[] = {
+ { 0xa436, 0x8023 }, { 0xa438, 0x3801 }, { 0xa436, 0xb82e },
+ { 0xa438, 0x0001 }, { 0xb820, 0x0090 }, { 0xa436, 0xa016 },
+ { 0xa438, 0x0000 }, { 0xa436, 0xa012 }, { 0xa438, 0x0000 },
+ { 0xa436, 0xa014 }, { 0xa438, 0x1800 }, { 0xa438, 0x8010 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x808e }, { 0xa438, 0x1800 },
+ { 0xa438, 0x80d6 }, { 0xa438, 0x1800 }, { 0xa438, 0x81e2 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x81e2 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x81e2 }, { 0xa438, 0x1800 }, { 0xa438, 0x81e2 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x81e2 }, { 0xa438, 0xd500 },
+ { 0xa438, 0xc48d }, { 0xa438, 0xd504 }, { 0xa438, 0x8d03 },
+ { 0xa438, 0xd701 }, { 0xa438, 0x4045 }, { 0xa438, 0xad02 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xd706 }, { 0xa438, 0x2529 },
+ { 0xa438, 0x8021 }, { 0xa438, 0xd718 }, { 0xa438, 0x607b },
+ { 0xa438, 0x40da }, { 0xa438, 0xf019 }, { 0xa438, 0x459a },
+ { 0xa438, 0xf03f }, { 0xa438, 0xd718 }, { 0xa438, 0x62bb },
+ { 0xa438, 0xbb01 }, { 0xa438, 0xd75e }, { 0xa438, 0x6231 },
+ { 0xa438, 0x0cf0 }, { 0xa438, 0x0c10 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xd70c }, { 0xa438, 0x6147 },
+ { 0xa438, 0x8480 }, { 0xa438, 0x8440 }, { 0xa438, 0x8420 },
+ { 0xa438, 0xa410 }, { 0xa438, 0xce00 }, { 0xa438, 0xd505 },
+ { 0xa438, 0x0c0f }, { 0xa438, 0x0808 }, { 0xa438, 0xf002 },
+ { 0xa438, 0xa4f0 }, { 0xa438, 0xf03c }, { 0xa438, 0xbb02 },
+ { 0xa438, 0xd75e }, { 0xa438, 0x6231 }, { 0xa438, 0x0cf0 },
+ { 0xa438, 0x0c20 }, { 0xa438, 0xd501 }, { 0xa438, 0xce01 },
+ { 0xa438, 0xd70c }, { 0xa438, 0x6147 }, { 0xa438, 0x8480 },
+ { 0xa438, 0x8440 }, { 0xa438, 0xa420 }, { 0xa438, 0x8410 },
+ { 0xa438, 0xce00 }, { 0xa438, 0xd505 }, { 0xa438, 0x0c0f },
+ { 0xa438, 0x0804 }, { 0xa438, 0xf002 }, { 0xa438, 0xa4f0 },
+ { 0xa438, 0xf028 }, { 0xa438, 0xbb04 }, { 0xa438, 0xd75e },
+ { 0xa438, 0x6231 }, { 0xa438, 0x0cf0 }, { 0xa438, 0x0c40 },
+ { 0xa438, 0xd501 }, { 0xa438, 0xce01 }, { 0xa438, 0xd70c },
+ { 0xa438, 0x6147 }, { 0xa438, 0x8480 }, { 0xa438, 0xa440 },
+ { 0xa438, 0x8420 }, { 0xa438, 0x8410 }, { 0xa438, 0xce00 },
+ { 0xa438, 0xd505 }, { 0xa438, 0x0c0f }, { 0xa438, 0x0802 },
+ { 0xa438, 0xf002 }, { 0xa438, 0xa4f0 }, { 0xa438, 0xf014 },
+ { 0xa438, 0xbb08 }, { 0xa438, 0xd75e }, { 0xa438, 0x6231 },
+ { 0xa438, 0x0cf0 }, { 0xa438, 0x0c80 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xd70c }, { 0xa438, 0x6147 },
+ { 0xa438, 0xa480 }, { 0xa438, 0x8440 }, { 0xa438, 0x8420 },
+ { 0xa438, 0x8410 }, { 0xa438, 0xce00 }, { 0xa438, 0xd505 },
+ { 0xa438, 0x0c0f }, { 0xa438, 0x0801 }, { 0xa438, 0xf002 },
+ { 0xa438, 0xa4f0 }, { 0xa438, 0xce00 }, { 0xa438, 0xd500 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x1a8a }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1829 }, { 0xa438, 0xd73e }, { 0xa438, 0x6074 },
+ { 0xa438, 0xd718 }, { 0xa438, 0x5f2d }, { 0xa438, 0x1000 },
+ { 0xa438, 0x81b7 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x1829 }, { 0xa438, 0xd73e },
+ { 0xa438, 0x7f74 }, { 0xa438, 0x1000 }, { 0xa438, 0x81ce },
+ { 0xa438, 0x1000 }, { 0xa438, 0x1a8a }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1829 }, { 0xa438, 0xd718 }, { 0xa438, 0x5f6d },
+ { 0xa438, 0x1800 }, { 0xa438, 0x1660 }, { 0xa438, 0xd75e },
+ { 0xa438, 0x68b1 }, { 0xa438, 0xd504 }, { 0xa438, 0xd71e },
+ { 0xa438, 0x667b }, { 0xa438, 0x645a }, { 0xa438, 0x6239 },
+ { 0xa438, 0x0cf0 }, { 0xa438, 0x0c10 }, { 0xa438, 0xd505 },
+ { 0xa438, 0x0c0f }, { 0xa438, 0x0808 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xd70c }, { 0xa438, 0x60c7 },
+ { 0xa438, 0x8480 }, { 0xa438, 0x8440 }, { 0xa438, 0x8420 },
+ { 0xa438, 0xa410 }, { 0xa438, 0xf032 }, { 0xa438, 0xa4f0 },
+ { 0xa438, 0xf030 }, { 0xa438, 0x0cf0 }, { 0xa438, 0x0c20 },
+ { 0xa438, 0xd505 }, { 0xa438, 0x0c0f }, { 0xa438, 0x0804 },
+ { 0xa438, 0xd501 }, { 0xa438, 0xce01 }, { 0xa438, 0xd70c },
+ { 0xa438, 0x60c7 }, { 0xa438, 0x8480 }, { 0xa438, 0x8440 },
+ { 0xa438, 0xa420 }, { 0xa438, 0x8410 }, { 0xa438, 0xf022 },
+ { 0xa438, 0xa4f0 }, { 0xa438, 0xf020 }, { 0xa438, 0x0cf0 },
+ { 0xa438, 0x0c40 }, { 0xa438, 0xd505 }, { 0xa438, 0x0c0f },
+ { 0xa438, 0x0802 }, { 0xa438, 0xd501 }, { 0xa438, 0xce01 },
+ { 0xa438, 0xd70c }, { 0xa438, 0x60c7 }, { 0xa438, 0x8480 },
+ { 0xa438, 0xa440 }, { 0xa438, 0x8420 }, { 0xa438, 0x8410 },
+ { 0xa438, 0xf012 }, { 0xa438, 0xa4f0 }, { 0xa438, 0xf010 },
+ { 0xa438, 0x0cf0 }, { 0xa438, 0x0c80 }, { 0xa438, 0xd505 },
+ { 0xa438, 0x0c0f }, { 0xa438, 0x0801 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xd70c }, { 0xa438, 0x60c7 },
+ { 0xa438, 0xa480 }, { 0xa438, 0x8440 }, { 0xa438, 0x8420 },
+ { 0xa438, 0x8410 }, { 0xa438, 0xf002 }, { 0xa438, 0xa4f0 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x168c }, { 0xa438, 0xd500 },
+ { 0xa438, 0xd706 }, { 0xa438, 0x2529 }, { 0xa438, 0x80e0 },
+ { 0xa438, 0xd718 }, { 0xa438, 0x607b }, { 0xa438, 0x40da },
+ { 0xa438, 0xf00f }, { 0xa438, 0x431a }, { 0xa438, 0xf021 },
+ { 0xa438, 0xd718 }, { 0xa438, 0x617b }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1a8a }, { 0xa438, 0x1000 }, { 0xa438, 0x1b1a },
+ { 0xa438, 0xd718 }, { 0xa438, 0x608e }, { 0xa438, 0xd73e },
+ { 0xa438, 0x5f34 }, { 0xa438, 0xf020 }, { 0xa438, 0xf053 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x1a8a }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1b1a }, { 0xa438, 0xd718 }, { 0xa438, 0x608e },
+ { 0xa438, 0xd73e }, { 0xa438, 0x5f34 }, { 0xa438, 0xf023 },
+ { 0xa438, 0xf067 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x1b1a }, { 0xa438, 0xd718 },
+ { 0xa438, 0x608e }, { 0xa438, 0xd73e }, { 0xa438, 0x5f34 },
+ { 0xa438, 0xf026 }, { 0xa438, 0xf07b }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1a8a }, { 0xa438, 0x1000 }, { 0xa438, 0x1b1a },
+ { 0xa438, 0xd718 }, { 0xa438, 0x608e }, { 0xa438, 0xd73e },
+ { 0xa438, 0x5f34 }, { 0xa438, 0xf029 }, { 0xa438, 0xf08f },
+ { 0xa438, 0x1000 }, { 0xa438, 0x81b7 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1a8a }, { 0xa438, 0xd73e }, { 0xa438, 0x7fb4 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x81ce }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1a8a }, { 0xa438, 0xd718 }, { 0xa438, 0x5fae },
+ { 0xa438, 0xf028 }, { 0xa438, 0x1000 }, { 0xa438, 0x81b7 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x1a8a }, { 0xa438, 0xd73e },
+ { 0xa438, 0x7fb4 }, { 0xa438, 0x1000 }, { 0xa438, 0x81ce },
+ { 0xa438, 0x1000 }, { 0xa438, 0x1a8a }, { 0xa438, 0xd718 },
+ { 0xa438, 0x5fae }, { 0xa438, 0xf039 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x81b7 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0xd73e }, { 0xa438, 0x7fb4 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x81ce }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0xd718 }, { 0xa438, 0x5fae }, { 0xa438, 0xf04a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x81b7 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1a8a }, { 0xa438, 0xd73e }, { 0xa438, 0x7fb4 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x81ce }, { 0xa438, 0x1000 },
+ { 0xa438, 0x1a8a }, { 0xa438, 0xd718 }, { 0xa438, 0x5fae },
+ { 0xa438, 0xf05b }, { 0xa438, 0xd719 }, { 0xa438, 0x4119 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac01 }, { 0xa438, 0xae01 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a78 },
+ { 0xa438, 0xf00a }, { 0xa438, 0xd719 }, { 0xa438, 0x4118 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac11 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xa410 }, { 0xa438, 0xce00 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0xd718 }, { 0xa438, 0x5fb0 }, { 0xa438, 0xd505 },
+ { 0xa438, 0xd719 }, { 0xa438, 0x4079 }, { 0xa438, 0xa80f },
+ { 0xa438, 0xf05d }, { 0xa438, 0x4b98 }, { 0xa438, 0xa808 },
+ { 0xa438, 0xf05a }, { 0xa438, 0xd719 }, { 0xa438, 0x4119 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac02 }, { 0xa438, 0xae01 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a78 },
+ { 0xa438, 0xf00a }, { 0xa438, 0xd719 }, { 0xa438, 0x4118 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac22 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xa420 }, { 0xa438, 0xce00 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0xd718 }, { 0xa438, 0x5fb0 }, { 0xa438, 0xd505 },
+ { 0xa438, 0xd719 }, { 0xa438, 0x4079 }, { 0xa438, 0xa80f },
+ { 0xa438, 0xf03f }, { 0xa438, 0x47d8 }, { 0xa438, 0xa804 },
+ { 0xa438, 0xf03c }, { 0xa438, 0xd719 }, { 0xa438, 0x4119 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac04 }, { 0xa438, 0xae01 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a78 },
+ { 0xa438, 0xf00a }, { 0xa438, 0xd719 }, { 0xa438, 0x4118 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac44 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xa440 }, { 0xa438, 0xce00 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0xd718 }, { 0xa438, 0x5fb0 }, { 0xa438, 0xd505 },
+ { 0xa438, 0xd719 }, { 0xa438, 0x4079 }, { 0xa438, 0xa80f },
+ { 0xa438, 0xf021 }, { 0xa438, 0x4418 }, { 0xa438, 0xa802 },
+ { 0xa438, 0xf01e }, { 0xa438, 0xd719 }, { 0xa438, 0x4119 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac08 }, { 0xa438, 0xae01 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a78 },
+ { 0xa438, 0xf00a }, { 0xa438, 0xd719 }, { 0xa438, 0x4118 },
+ { 0xa438, 0xd504 }, { 0xa438, 0xac88 }, { 0xa438, 0xd501 },
+ { 0xa438, 0xce01 }, { 0xa438, 0xa480 }, { 0xa438, 0xce00 },
+ { 0xa438, 0xd500 }, { 0xa438, 0x1000 }, { 0xa438, 0x1a8a },
+ { 0xa438, 0xd718 }, { 0xa438, 0x5fb0 }, { 0xa438, 0xd505 },
+ { 0xa438, 0xd719 }, { 0xa438, 0x4079 }, { 0xa438, 0xa80f },
+ { 0xa438, 0xf003 }, { 0xa438, 0x4058 }, { 0xa438, 0xa801 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x1736 }, { 0xa438, 0xd73e },
+ { 0xa438, 0xd505 }, { 0xa438, 0x3088 }, { 0xa438, 0x81c0 },
+ { 0xa438, 0x61d3 }, { 0xa438, 0x6172 }, { 0xa438, 0x6111 },
+ { 0xa438, 0x60b0 }, { 0xa438, 0xf00d }, { 0xa438, 0x3298 },
+ { 0xa438, 0x81cb }, { 0xa438, 0xf00a }, { 0xa438, 0xa808 },
+ { 0xa438, 0xf008 }, { 0xa438, 0xa804 }, { 0xa438, 0xf006 },
+ { 0xa438, 0xa802 }, { 0xa438, 0xf004 }, { 0xa438, 0xa801 },
+ { 0xa438, 0xf002 }, { 0xa438, 0xa80f }, { 0xa438, 0xd500 },
+ { 0xa438, 0x0800 }, { 0xa438, 0xd505 }, { 0xa438, 0xd75e },
+ { 0xa438, 0x6211 }, { 0xa438, 0xd71e }, { 0xa438, 0x619b },
+ { 0xa438, 0x611a }, { 0xa438, 0x6099 }, { 0xa438, 0x0c0f },
+ { 0xa438, 0x0808 }, { 0xa438, 0xf009 }, { 0xa438, 0x0c0f },
+ { 0xa438, 0x0804 }, { 0xa438, 0xf006 }, { 0xa438, 0x0c0f },
+ { 0xa438, 0x0802 }, { 0xa438, 0xf003 }, { 0xa438, 0x0c0f },
+ { 0xa438, 0x0801 }, { 0xa438, 0xd500 }, { 0xa438, 0x0800 },
+ { 0xa436, 0xa026 }, { 0xa438, 0xffff }, { 0xa436, 0xa024 },
+ { 0xa438, 0xffff }, { 0xa436, 0xa022 }, { 0xa438, 0xffff },
+ { 0xa436, 0xa020 }, { 0xa438, 0xffff }, { 0xa436, 0xa006 },
+ { 0xa438, 0xffff }, { 0xa436, 0xa004 }, { 0xa438, 0x16ab },
+ { 0xa436, 0xa002 }, { 0xa438, 0x1663 }, { 0xa436, 0xa000 },
+ { 0xa438, 0x1608 }, { 0xa436, 0xa008 }, { 0xa438, 0x0700 },
+ { 0xa436, 0xa016 }, { 0xa438, 0x0000 }, { 0xa436, 0xa012 },
+ { 0xa438, 0x07f8 }, { 0xa436, 0xa014 }, { 0xa438, 0xcc01 },
+ { 0xa438, 0x20f6 }, { 0xa438, 0x0000 }, { 0xa438, 0x0000 },
+ { 0xa438, 0x0000 }, { 0xa438, 0x0000 }, { 0xa438, 0x0000 },
+ { 0xa438, 0x0000 }, { 0xa436, 0xa152 }, { 0xa438, 0x021c },
+ { 0xa436, 0xa154 }, { 0xa438, 0x2100 }, { 0xa436, 0xa156 },
+ { 0xa438, 0x3fff }, { 0xa436, 0xa158 }, { 0xa438, 0x3fff },
+ { 0xa436, 0xa15a }, { 0xa438, 0x3fff }, { 0xa436, 0xa15c },
+ { 0xa438, 0x3fff }, { 0xa436, 0xa15e }, { 0xa438, 0x3fff },
+ { 0xa436, 0xa160 }, { 0xa438, 0x3fff }, { 0xa436, 0xa150 },
+ { 0xa438, 0x0003 }, { 0xa436, 0xa016 }, { 0xa438, 0x0010 },
+ { 0xa436, 0xa012 }, { 0xa438, 0x0000 }, { 0xa436, 0xa014 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x8010 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x8014 }, { 0xa438, 0x1800 }, { 0xa438, 0x803d },
+ { 0xa438, 0x1800 }, { 0xa438, 0x804a }, { 0xa438, 0x1800 },
+ { 0xa438, 0x804e }, { 0xa438, 0x1800 }, { 0xa438, 0x8052 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x8092 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x80a0 }, { 0xa438, 0xc2ff }, { 0xa438, 0x9a40 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0042 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x02e5 }, { 0xa438, 0xba20 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x02b4 }, { 0xa438, 0xd701 }, { 0xa438, 0x4103 },
+ { 0xa438, 0xd700 }, { 0xa438, 0x5f6c }, { 0xa438, 0x1000 },
+ { 0xa438, 0x8024 }, { 0xa438, 0x9a20 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x0073 }, { 0xa438, 0x1800 }, { 0xa438, 0x0084 },
+ { 0xa438, 0xd701 }, { 0xa438, 0x4061 }, { 0xa438, 0xba0f },
+ { 0xa438, 0xf004 }, { 0xa438, 0x4060 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x802d }, { 0xa438, 0xba10 }, { 0xa438, 0x0800 },
+ { 0xa438, 0xd700 }, { 0xa438, 0x60bb }, { 0xa438, 0x611c },
+ { 0xa438, 0x0c0f }, { 0xa438, 0x1a01 }, { 0xa438, 0xf00a },
+ { 0xa438, 0x60fc }, { 0xa438, 0x0c0f }, { 0xa438, 0x1a02 },
+ { 0xa438, 0xf006 }, { 0xa438, 0x0c0f }, { 0xa438, 0x1a04 },
+ { 0xa438, 0xf003 }, { 0xa438, 0x0c0f }, { 0xa438, 0x1a08 },
+ { 0xa438, 0x0800 }, { 0xa438, 0x0c0f }, { 0xa438, 0x0504 },
+ { 0xa438, 0xad02 }, { 0xa438, 0xd73e }, { 0xa438, 0x40f6 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02c0 }, { 0xa438, 0xd700 },
+ { 0xa438, 0x5fac }, { 0xa438, 0x1000 }, { 0xa438, 0x8024 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0139 }, { 0xa438, 0x9a3f },
+ { 0xa438, 0x8bf0 }, { 0xa438, 0x1800 }, { 0xa438, 0x02df },
+ { 0xa438, 0x9a3f }, { 0xa438, 0x9910 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x02d7 }, { 0xa438, 0xad02 }, { 0xa438, 0x8d01 },
+ { 0xa438, 0x9a7f }, { 0xa438, 0x9910 }, { 0xa438, 0x9860 },
+ { 0xa438, 0xcb00 }, { 0xa438, 0xd501 }, { 0xa438, 0xce01 },
+ { 0xa438, 0x85f0 }, { 0xa438, 0xd500 }, { 0xa438, 0x0c0f },
+ { 0xa438, 0x0505 }, { 0xa438, 0xb820 }, { 0xa438, 0xc000 },
+ { 0xa438, 0xc100 }, { 0xa438, 0xc628 }, { 0xa438, 0xc700 },
+ { 0xa438, 0xc801 }, { 0xa438, 0xc91e }, { 0xa438, 0xc001 },
+ { 0xa438, 0x4019 }, { 0xa438, 0xc6f8 }, { 0xa438, 0xc702 },
+ { 0xa438, 0xc809 }, { 0xa438, 0xc940 }, { 0xa438, 0xc002 },
+ { 0xa438, 0x4019 }, { 0xa438, 0x1000 }, { 0xa438, 0x02cc },
+ { 0xa438, 0xd700 }, { 0xa438, 0x5fa7 }, { 0xa438, 0xc010 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02cc }, { 0xa438, 0xd700 },
+ { 0xa438, 0x5fa0 }, { 0xa438, 0xc020 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x02cc }, { 0xa438, 0xd700 }, { 0xa438, 0x5fa1 },
+ { 0xa438, 0x0c0f }, { 0xa438, 0x0506 }, { 0xa438, 0xb840 },
+ { 0xa438, 0xc6ca }, { 0xa438, 0xc701 }, { 0xa438, 0xc809 },
+ { 0xa438, 0xc900 }, { 0xa438, 0xc001 }, { 0xa438, 0x4019 },
+ { 0xa438, 0xc6b8 }, { 0xa438, 0xc700 }, { 0xa438, 0xc800 },
+ { 0xa438, 0xc900 }, { 0xa438, 0xc008 }, { 0xa438, 0x4019 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02cc }, { 0xa438, 0xd700 },
+ { 0xa438, 0x5fa5 }, { 0xa438, 0x8580 }, { 0xa438, 0x8d02 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x018f }, { 0xa438, 0x1000 },
+ { 0xa438, 0x02cc }, { 0xa438, 0xd700 }, { 0xa438, 0x6124 },
+ { 0xa438, 0xd73e }, { 0xa438, 0x5f75 }, { 0xa438, 0xd700 },
+ { 0xa438, 0x5f2c }, { 0xa438, 0x1000 }, { 0xa438, 0x8024 },
+ { 0xa438, 0x9a20 }, { 0xa438, 0xfff5 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x00b8 }, { 0xa438, 0x0c0f }, { 0xa438, 0x0503 },
+ { 0xa438, 0xad02 }, { 0xa438, 0x68c8 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x02c0 }, { 0xa438, 0xd700 }, { 0xa438, 0x6848 },
+ { 0xa438, 0x604d }, { 0xa438, 0xfffb }, { 0xa438, 0xd73e },
+ { 0xa438, 0x6082 }, { 0xa438, 0x1000 }, { 0xa438, 0x02a1 },
+ { 0xa438, 0x8a0f }, { 0xa438, 0x1000 }, { 0xa438, 0x02c0 },
+ { 0xa438, 0xd700 }, { 0xa438, 0x5fae }, { 0xa438, 0x1000 },
+ { 0xa438, 0x02de }, { 0xa438, 0x1000 }, { 0xa438, 0x02c0 },
+ { 0xa438, 0xd700 }, { 0xa438, 0x5faf }, { 0xa438, 0x8d01 },
+ { 0xa438, 0x8b0f }, { 0xa438, 0x1000 }, { 0xa438, 0x02c0 },
+ { 0xa438, 0xd700 }, { 0xa438, 0x2a58 }, { 0xa438, 0x80c5 },
+ { 0xa438, 0x2a5b }, { 0xa438, 0x80cd }, { 0xa438, 0x2b53 },
+ { 0xa438, 0x80d9 }, { 0xa438, 0xfff7 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x022a }, { 0xa438, 0x1000 }, { 0xa438, 0x02e5 },
+ { 0xa438, 0xba40 }, { 0xa438, 0x1000 }, { 0xa438, 0x02fd },
+ { 0xa438, 0xf018 }, { 0xa438, 0x1000 }, { 0xa438, 0x022a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02e5 }, { 0xa438, 0xba40 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02c0 }, { 0xa438, 0xd700 },
+ { 0xa438, 0x5faa }, { 0xa438, 0x1000 }, { 0xa438, 0x02fd },
+ { 0xa438, 0xf00c }, { 0xa438, 0x1000 }, { 0xa438, 0x022a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02fd }, { 0xa438, 0x1000 },
+ { 0xa438, 0x02c0 }, { 0xa438, 0xd700 }, { 0xa438, 0x5fab },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02e5 }, { 0xa438, 0xba40 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x02c0 }, { 0xa438, 0xd700 },
+ { 0xa438, 0x6088 }, { 0xa438, 0xfffc }, { 0xa438, 0x1800 },
+ { 0xa438, 0x0120 }, { 0xa438, 0x1800 }, { 0xa438, 0x0122 },
+ { 0xa436, 0xa08e }, { 0xa438, 0x00db }, { 0xa436, 0xa08c },
+ { 0xa438, 0x00b4 }, { 0xa436, 0xa08a }, { 0xa438, 0x015a },
+ { 0xa436, 0xa088 }, { 0xa438, 0x02d6 }, { 0xa436, 0xa086 },
+ { 0xa438, 0x02de }, { 0xa436, 0xa084 }, { 0xa438, 0x0137 },
+ { 0xa436, 0xa082 }, { 0xa438, 0x0071 }, { 0xa436, 0xa080 },
+ { 0xa438, 0x0041 }, { 0xa436, 0xa090 }, { 0xa438, 0x00ff },
+ { 0xa436, 0xa016 }, { 0xa438, 0x0020 }, { 0xa436, 0xa012 },
+ { 0xa438, 0x0000 }, { 0xa436, 0xa014 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x8010 }, { 0xa438, 0x1800 }, { 0xa438, 0x801d },
+ { 0xa438, 0x1800 }, { 0xa438, 0x808a }, { 0xa438, 0x1800 },
+ { 0xa438, 0x80a5 }, { 0xa438, 0x1800 }, { 0xa438, 0x80b8 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x8108 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x810f }, { 0xa438, 0x1800 }, { 0xa438, 0x811b },
+ { 0xa438, 0x8980 }, { 0xa438, 0xd702 }, { 0xa438, 0x6126 },
+ { 0xa438, 0xd704 }, { 0xa438, 0x4063 }, { 0xa438, 0xd702 },
+ { 0xa438, 0x6060 }, { 0xa438, 0xd702 }, { 0xa438, 0x6077 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0c29 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x0c2b }, { 0xa438, 0x1000 }, { 0xa438, 0x115a },
+ { 0xa438, 0xd71f }, { 0xa438, 0x5fb4 }, { 0xa438, 0xd702 },
+ { 0xa438, 0x6c46 }, { 0xa438, 0xd704 }, { 0xa438, 0x4063 },
+ { 0xa438, 0xd702 }, { 0xa438, 0x6060 }, { 0xa438, 0xd702 },
+ { 0xa438, 0x6b97 }, { 0xa438, 0xa340 }, { 0xa438, 0x0c06 },
+ { 0xa438, 0x0102 }, { 0xa438, 0xce01 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x117a }, { 0xa438, 0xa240 }, { 0xa438, 0xa902 },
+ { 0xa438, 0xa204 }, { 0xa438, 0xa280 }, { 0xa438, 0xa364 },
+ { 0xa438, 0xab02 }, { 0xa438, 0x8380 }, { 0xa438, 0xa00a },
+ { 0xa438, 0xcd8d }, { 0xa438, 0x1000 }, { 0xa438, 0x115a },
+ { 0xa438, 0xd706 }, { 0xa438, 0x5fb5 }, { 0xa438, 0xb920 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x115a }, { 0xa438, 0xd71f },
+ { 0xa438, 0x7fb4 }, { 0xa438, 0x9920 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x115a }, { 0xa438, 0xd71f }, { 0xa438, 0x6065 },
+ { 0xa438, 0x7c74 }, { 0xa438, 0xfffb }, { 0xa438, 0xb820 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x115a }, { 0xa438, 0xd71f },
+ { 0xa438, 0x7fa5 }, { 0xa438, 0x9820 }, { 0xa438, 0xa410 },
+ { 0xa438, 0x8902 }, { 0xa438, 0xa120 }, { 0xa438, 0xa380 },
+ { 0xa438, 0xce02 }, { 0xa438, 0x1000 }, { 0xa438, 0x117a },
+ { 0xa438, 0x8280 }, { 0xa438, 0xa324 }, { 0xa438, 0xab02 },
+ { 0xa438, 0xa00a }, { 0xa438, 0x8118 }, { 0xa438, 0x863f },
+ { 0xa438, 0x87fb }, { 0xa438, 0xcd8e }, { 0xa438, 0xd193 },
+ { 0xa438, 0xd047 }, { 0xa438, 0x1000 }, { 0xa438, 0x115a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x115f }, { 0xa438, 0xd700 },
+ { 0xa438, 0x5f7b }, { 0xa438, 0xa280 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x115a }, { 0xa438, 0x1000 }, { 0xa438, 0x115f },
+ { 0xa438, 0xd706 }, { 0xa438, 0x5f78 }, { 0xa438, 0xa210 },
+ { 0xa438, 0xd700 }, { 0xa438, 0x6083 }, { 0xa438, 0xd101 },
+ { 0xa438, 0xd047 }, { 0xa438, 0xf003 }, { 0xa438, 0xd160 },
+ { 0xa438, 0xd04b }, { 0xa438, 0x1000 }, { 0xa438, 0x115a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x115f }, { 0xa438, 0xd700 },
+ { 0xa438, 0x5f7b }, { 0xa438, 0x1000 }, { 0xa438, 0x115a },
+ { 0xa438, 0x1000 }, { 0xa438, 0x115f }, { 0xa438, 0xd706 },
+ { 0xa438, 0x5f79 }, { 0xa438, 0x8120 }, { 0xa438, 0xbb20 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0c8b }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0x8f80 }, { 0xa438, 0x9503 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0c3c }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0xa608 }, { 0xa438, 0x9503 },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0x8f80 },
+ { 0xa438, 0x9503 }, { 0xa438, 0xd704 }, { 0xa438, 0x6192 },
+ { 0xa438, 0xd702 }, { 0xa438, 0x4116 }, { 0xa438, 0xce04 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x117a }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0x8f40 }, { 0xa438, 0x9503 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0b3d }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0xaf40 }, { 0xa438, 0x9503 },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0b48 }, { 0xa438, 0xd704 },
+ { 0xa438, 0x6192 }, { 0xa438, 0xd702 }, { 0xa438, 0x4116 },
+ { 0xa438, 0xce04 }, { 0xa438, 0x1000 }, { 0xa438, 0x117a },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0x8f40 },
+ { 0xa438, 0x9503 }, { 0xa438, 0x1800 }, { 0xa438, 0x1269 },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0xaf40 },
+ { 0xa438, 0x9503 }, { 0xa438, 0x1800 }, { 0xa438, 0x1274 },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0xa608 },
+ { 0xa438, 0xc700 }, { 0xa438, 0x9503 }, { 0xa438, 0xce54 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x117a }, { 0xa438, 0xa290 },
+ { 0xa438, 0xa304 }, { 0xa438, 0xab02 }, { 0xa438, 0xd700 },
+ { 0xa438, 0x6050 }, { 0xa438, 0xab04 }, { 0xa438, 0x0c38 },
+ { 0xa438, 0x0608 }, { 0xa438, 0xaa0b }, { 0xa438, 0xd702 },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0x8d01 },
+ { 0xa438, 0xae40 }, { 0xa438, 0x4044 }, { 0xa438, 0x8e20 },
+ { 0xa438, 0x9503 }, { 0xa438, 0x0c03 }, { 0xa438, 0x1502 },
+ { 0xa438, 0x8c20 }, { 0xa438, 0x9503 }, { 0xa438, 0xd700 },
+ { 0xa438, 0x6078 }, { 0xa438, 0xd700 }, { 0xa438, 0x609a },
+ { 0xa438, 0xd109 }, { 0xa438, 0xd074 }, { 0xa438, 0xf003 },
+ { 0xa438, 0xd109 }, { 0xa438, 0xd075 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x115a }, { 0xa438, 0xd704 }, { 0xa438, 0x6252 },
+ { 0xa438, 0xd702 }, { 0xa438, 0x4116 }, { 0xa438, 0xce54 },
+ { 0xa438, 0x1000 }, { 0xa438, 0x117a }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0x8f40 }, { 0xa438, 0x9503 },
+ { 0xa438, 0xa00a }, { 0xa438, 0xd704 }, { 0xa438, 0x41e7 },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0xa570 },
+ { 0xa438, 0x9503 }, { 0xa438, 0xf00a }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0xaf40 }, { 0xa438, 0x9503 },
+ { 0xa438, 0x800a }, { 0xa438, 0x0c03 }, { 0xa438, 0x1502 },
+ { 0xa438, 0x8570 }, { 0xa438, 0x9503 }, { 0xa438, 0xd704 },
+ { 0xa438, 0x60f3 }, { 0xa438, 0xd71f }, { 0xa438, 0x60ee },
+ { 0xa438, 0xd700 }, { 0xa438, 0x5bbe }, { 0xa438, 0x1800 },
+ { 0xa438, 0x0e71 }, { 0xa438, 0x1800 }, { 0xa438, 0x0e7c },
+ { 0xa438, 0x1800 }, { 0xa438, 0x0e7e }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0xaf80 }, { 0xa438, 0x9503 },
+ { 0xa438, 0xcd62 }, { 0xa438, 0x1800 }, { 0xa438, 0x0bd2 },
+ { 0xa438, 0x800a }, { 0xa438, 0x8530 }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0x8d10 }, { 0xa438, 0x9503 },
+ { 0xa438, 0xd700 }, { 0xa438, 0x6050 }, { 0xa438, 0xaa20 },
+ { 0xa438, 0x8306 }, { 0xa438, 0x1800 }, { 0xa438, 0x0cb6 },
+ { 0xa438, 0xd105 }, { 0xa438, 0xd040 }, { 0xa438, 0x1000 },
+ { 0xa438, 0x0d8f }, { 0xa438, 0xd700 }, { 0xa438, 0x5fbb },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0x8608 },
+ { 0xa438, 0x9503 }, { 0xa438, 0x1000 }, { 0xa438, 0x0d8f },
+ { 0xa438, 0xd704 }, { 0xa438, 0x7fb6 }, { 0xa438, 0x0c03 },
+ { 0xa438, 0x1502 }, { 0xa438, 0x87f0 }, { 0xa438, 0x9503 },
+ { 0xa438, 0xce88 }, { 0xa438, 0x1000 }, { 0xa438, 0x117a },
+ { 0xa438, 0x0c03 }, { 0xa438, 0x1502 }, { 0xa438, 0xa608 },
+ { 0xa438, 0x9503 }, { 0xa438, 0xd73e }, { 0xa438, 0x60a5 },
+ { 0xa438, 0xd705 }, { 0xa438, 0x4071 }, { 0xa438, 0x1800 },
+ { 0xa438, 0x0d65 }, { 0xa438, 0x1800 }, { 0xa438, 0x0d6f },
+ { 0xa436, 0xa10e }, { 0xa438, 0x0d58 }, { 0xa436, 0xa10c },
+ { 0xa438, 0x0cb5 }, { 0xa436, 0xa10a }, { 0xa438, 0x0bd1 },
+ { 0xa436, 0xa108 }, { 0xa438, 0x0e37 }, { 0xa436, 0xa106 },
+ { 0xa438, 0x1267 }, { 0xa436, 0xa104 }, { 0xa438, 0x0b3b },
+ { 0xa436, 0xa102 }, { 0xa438, 0x0c38 }, { 0xa436, 0xa100 },
+ { 0xa438, 0x0c24 }, { 0xa436, 0xa110 }, { 0xa438, 0x00ff },
+ { 0xa436, 0xa016 }, { 0xa438, 0x0020 }, { 0xa436, 0xa012 },
+ { 0xa438, 0x1ff8 }, { 0xa436, 0xa014 }, { 0xa438, 0x0000 },
+ { 0xa438, 0x0000 }, { 0xa438, 0x0000 }, { 0xa438, 0x0000 },
+ { 0xa438, 0x0000 }, { 0xa438, 0x0000 }, { 0xa438, 0x0000 },
+ { 0xa438, 0x0000 }, { 0xa436, 0xa164 }, { 0xa438, 0x0ceb },
+ { 0xa436, 0xa166 }, { 0xa438, 0x0e73 }, { 0xa436, 0xa168 },
+ { 0xa438, 0x0deb }, { 0xa436, 0xa16a }, { 0xa438, 0x3fff },
+ { 0xa436, 0xa16c }, { 0xa438, 0x3fff }, { 0xa436, 0xa16e },
+ { 0xa438, 0x3fff }, { 0xa436, 0xa170 }, { 0xa438, 0x3fff },
+ { 0xa436, 0xa172 }, { 0xa438, 0x3fff }, { 0xa436, 0xa162 },
+ { 0xa438, 0x0007 }, { 0xa436, 0xb87c }, { 0xa438, 0x85bf },
+ { 0xa436, 0xb87e }, { 0xa438, 0xaf85 }, { 0xa438, 0xd7af },
+ { 0xa438, 0x85fb }, { 0xa438, 0xaf86 }, { 0xa438, 0x10af },
+ { 0xa438, 0x8638 }, { 0xa438, 0xaf86 }, { 0xa438, 0x47af },
+ { 0xa438, 0x8647 }, { 0xa438, 0xaf86 }, { 0xa438, 0x47af },
+ { 0xa438, 0x8647 }, { 0xa438, 0xbf85 }, { 0xa438, 0xf802 },
+ { 0xa438, 0x627f }, { 0xa438, 0xbf61 }, { 0xa438, 0xc702 },
+ { 0xa438, 0x627f }, { 0xa438, 0xae0c }, { 0xa438, 0xbf85 },
+ { 0xa438, 0xf802 }, { 0xa438, 0x6276 }, { 0xa438, 0xbf61 },
+ { 0xa438, 0xc702 }, { 0xa438, 0x6276 }, { 0xa438, 0xee85 },
+ { 0xa438, 0x4200 }, { 0xa438, 0xaf1b }, { 0xa438, 0x2333 },
+ { 0xa438, 0xa484 }, { 0xa438, 0xbf86 }, { 0xa438, 0x0a02 },
+ { 0xa438, 0x627f }, { 0xa438, 0xbf86 }, { 0xa438, 0x0d02 },
+ { 0xa438, 0x627f }, { 0xa438, 0xaf1b }, { 0xa438, 0x8422 },
+ { 0xa438, 0xa484 }, { 0xa438, 0x66ac }, { 0xa438, 0x0ef8 },
+ { 0xa438, 0xfbef }, { 0xa438, 0x79fb }, { 0xa438, 0xe080 },
+ { 0xa438, 0x16ad }, { 0xa438, 0x230f }, { 0xa438, 0xee85 },
+ { 0xa438, 0x4200 }, { 0xa438, 0x1f44 }, { 0xa438, 0xbf86 },
+ { 0xa438, 0x30d7 }, { 0xa438, 0x0008 }, { 0xa438, 0x0264 },
+ { 0xa438, 0xa3ff }, { 0xa438, 0xef97 }, { 0xa438, 0xfffc },
+ { 0xa438, 0x0485 }, { 0xa438, 0xf861 }, { 0xa438, 0xc786 },
+ { 0xa438, 0x0a86 }, { 0xa438, 0x0de1 }, { 0xa438, 0x8feb },
+ { 0xa438, 0xe583 }, { 0xa438, 0x20e1 }, { 0xa438, 0x8fea },
+ { 0xa438, 0xe583 }, { 0xa438, 0x21af }, { 0xa438, 0x41a7 },
+ { 0xa436, 0xb85e }, { 0xa438, 0x1b05 }, { 0xa436, 0xb860 },
+ { 0xa438, 0x1b78 }, { 0xa436, 0xb862 }, { 0xa438, 0x1a08 },
+ { 0xa436, 0xb864 }, { 0xa438, 0x419f }, { 0xa436, 0xb886 },
+ { 0xa438, 0xffff }, { 0xa436, 0xb888 }, { 0xa438, 0xffff },
+ { 0xa436, 0xb88a }, { 0xa438, 0xffff }, { 0xa436, 0xb88c },
+ { 0xa438, 0xffff }, { 0xa436, 0xb838 }, { 0xa438, 0x000f },
+ { 0xb820, 0x0010 }, { 0xa436, 0x0000 }, { 0xa438, 0x0000 },
+ { 0xb82e, 0x0000 }, { 0xa436, 0x8023 }, { 0xa438, 0x0000 },
+ { 0xa436, 0x801e }, { 0xa438, 0x0013 }, { 0xb820, 0x0000 },
+ { 0xa436, 0xacca }, { 0xa438, 0x0104 }, { 0xa436, 0xaccc },
+ { 0xa438, 0x8000 }, { 0xa436, 0xacce }, { 0xa438, 0xffff },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0fff }, { 0xa436, 0xacce },
+ { 0xa438, 0xfd47 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0fff },
+ { 0xa436, 0xacce }, { 0xa438, 0xffff }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0xe56f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01c0 }, { 0xa436, 0xacce },
+ { 0xa438, 0xffff }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0xed97 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x01c8 }, { 0xa436, 0xacce }, { 0xa438, 0xffff },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x07ff }, { 0xa436, 0xacce },
+ { 0xa438, 0xf5bf }, { 0xa436, 0xacd0 }, { 0xa438, 0x01d0 },
+ { 0xa436, 0xacce }, { 0xa438, 0xfb07 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0xfb0f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01d8 }, { 0xa436, 0xacce },
+ { 0xa438, 0xa087 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0180 },
+ { 0xa436, 0xacce }, { 0xa438, 0xa00f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0108 }, { 0xa436, 0xacce }, { 0xa438, 0xa807 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0100 }, { 0xa436, 0xacce },
+ { 0xa438, 0xa88f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0188 },
+ { 0xa436, 0xacce }, { 0xa438, 0xb027 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0120 }, { 0xa436, 0xacce }, { 0xa438, 0xb02f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0128 }, { 0xa436, 0xacce },
+ { 0xa438, 0xb847 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0140 },
+ { 0xa436, 0xacce }, { 0xa438, 0xb84f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0148 }, { 0xa436, 0xacce }, { 0xa438, 0xfb17 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x07ff }, { 0xa436, 0xacce },
+ { 0xa438, 0xfb1f }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0xa017 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0110 }, { 0xa436, 0xacce }, { 0xa438, 0xa01f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0118 }, { 0xa436, 0xacce },
+ { 0xa438, 0xa837 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0130 },
+ { 0xa436, 0xacce }, { 0xa438, 0xa83f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0138 }, { 0xa436, 0xacce }, { 0xa438, 0xb097 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0190 }, { 0xa436, 0xacce },
+ { 0xa438, 0xb05f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0158 },
+ { 0xa436, 0xacce }, { 0xa438, 0xb857 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0150 }, { 0xa436, 0xacce }, { 0xa438, 0xb89f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0198 }, { 0xa436, 0xacce },
+ { 0xa438, 0xfb27 }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0xfb2f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0x8087 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0180 }, { 0xa436, 0xacce },
+ { 0xa438, 0x800f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0108 },
+ { 0xa436, 0xacce }, { 0xa438, 0x8807 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0100 }, { 0xa436, 0xacce }, { 0xa438, 0x888f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0188 }, { 0xa436, 0xacce },
+ { 0xa438, 0x9027 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0120 },
+ { 0xa436, 0xacce }, { 0xa438, 0x902f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0128 }, { 0xa436, 0xacce }, { 0xa438, 0x9847 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0140 }, { 0xa436, 0xacce },
+ { 0xa438, 0x984f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0148 },
+ { 0xa436, 0xacce }, { 0xa438, 0xa0a7 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x01a0 }, { 0xa436, 0xacce }, { 0xa438, 0xa8af },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01a8 }, { 0xa436, 0xacce },
+ { 0xa438, 0xa067 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0161 },
+ { 0xa436, 0xacce }, { 0xa438, 0xa86f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0169 }, { 0xa436, 0xacce }, { 0xa438, 0xfb37 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x07ff }, { 0xa436, 0xacce },
+ { 0xa438, 0xfb3f }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0x8017 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0110 }, { 0xa436, 0xacce }, { 0xa438, 0x801f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0118 }, { 0xa436, 0xacce },
+ { 0xa438, 0x8837 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0130 },
+ { 0xa436, 0xacce }, { 0xa438, 0x883f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0138 }, { 0xa436, 0xacce }, { 0xa438, 0x9097 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0190 }, { 0xa436, 0xacce },
+ { 0xa438, 0x905f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0158 },
+ { 0xa436, 0xacce }, { 0xa438, 0x9857 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0150 }, { 0xa436, 0xacce }, { 0xa438, 0x989f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0198 }, { 0xa436, 0xacce },
+ { 0xa438, 0xb0b7 }, { 0xa436, 0xacd0 }, { 0xa438, 0x01b0 },
+ { 0xa436, 0xacce }, { 0xa438, 0xb8bf }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x01b8 }, { 0xa436, 0xacce }, { 0xa438, 0xb077 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0171 }, { 0xa436, 0xacce },
+ { 0xa438, 0xb87f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0179 },
+ { 0xa436, 0xacce }, { 0xa438, 0xfb47 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0xfb4f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x07ff }, { 0xa436, 0xacce },
+ { 0xa438, 0x6087 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0180 },
+ { 0xa436, 0xacce }, { 0xa438, 0x600f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0108 }, { 0xa436, 0xacce }, { 0xa438, 0x6807 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0100 }, { 0xa436, 0xacce },
+ { 0xa438, 0x688f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0188 },
+ { 0xa436, 0xacce }, { 0xa438, 0x7027 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0120 }, { 0xa436, 0xacce }, { 0xa438, 0x702f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0128 }, { 0xa436, 0xacce },
+ { 0xa438, 0x7847 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0140 },
+ { 0xa436, 0xacce }, { 0xa438, 0x784f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0148 }, { 0xa436, 0xacce }, { 0xa438, 0x80a7 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01a0 }, { 0xa436, 0xacce },
+ { 0xa438, 0x88af }, { 0xa436, 0xacd0 }, { 0xa438, 0x01a8 },
+ { 0xa436, 0xacce }, { 0xa438, 0x8067 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0161 }, { 0xa436, 0xacce }, { 0xa438, 0x886f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0169 }, { 0xa436, 0xacce },
+ { 0xa438, 0xfb57 }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0xfb5f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0x6017 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0110 }, { 0xa436, 0xacce },
+ { 0xa438, 0x601f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0118 },
+ { 0xa436, 0xacce }, { 0xa438, 0x6837 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0130 }, { 0xa436, 0xacce }, { 0xa438, 0x683f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0138 }, { 0xa436, 0xacce },
+ { 0xa438, 0x7097 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0190 },
+ { 0xa436, 0xacce }, { 0xa438, 0x705f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0158 }, { 0xa436, 0xacce }, { 0xa438, 0x7857 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0150 }, { 0xa436, 0xacce },
+ { 0xa438, 0x789f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0198 },
+ { 0xa436, 0xacce }, { 0xa438, 0x90b7 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x01b0 }, { 0xa436, 0xacce }, { 0xa438, 0x98bf },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01b8 }, { 0xa436, 0xacce },
+ { 0xa438, 0x9077 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0171 },
+ { 0xa436, 0xacce }, { 0xa438, 0x987f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0179 }, { 0xa436, 0xacce }, { 0xa438, 0xfb67 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x07ff }, { 0xa436, 0xacce },
+ { 0xa438, 0xfb6f }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0x4087 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0180 }, { 0xa436, 0xacce }, { 0xa438, 0x400f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0108 }, { 0xa436, 0xacce },
+ { 0xa438, 0x4807 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0100 },
+ { 0xa436, 0xacce }, { 0xa438, 0x488f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0188 }, { 0xa436, 0xacce }, { 0xa438, 0x5027 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0120 }, { 0xa436, 0xacce },
+ { 0xa438, 0x502f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0128 },
+ { 0xa436, 0xacce }, { 0xa438, 0x5847 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0140 }, { 0xa436, 0xacce }, { 0xa438, 0x584f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0148 }, { 0xa436, 0xacce },
+ { 0xa438, 0x60a7 }, { 0xa436, 0xacd0 }, { 0xa438, 0x01a0 },
+ { 0xa436, 0xacce }, { 0xa438, 0x68af }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x01a8 }, { 0xa436, 0xacce }, { 0xa438, 0x6067 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0161 }, { 0xa436, 0xacce },
+ { 0xa438, 0x686f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0169 },
+ { 0xa436, 0xacce }, { 0xa438, 0xfb77 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0xfb7f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x07ff }, { 0xa436, 0xacce },
+ { 0xa438, 0x4017 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0110 },
+ { 0xa436, 0xacce }, { 0xa438, 0x401f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0118 }, { 0xa436, 0xacce }, { 0xa438, 0x4837 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0130 }, { 0xa436, 0xacce },
+ { 0xa438, 0x483f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0138 },
+ { 0xa436, 0xacce }, { 0xa438, 0x5097 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0190 }, { 0xa436, 0xacce }, { 0xa438, 0x505f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0158 }, { 0xa436, 0xacce },
+ { 0xa438, 0x5857 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0150 },
+ { 0xa436, 0xacce }, { 0xa438, 0x589f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0198 }, { 0xa436, 0xacce }, { 0xa438, 0x70b7 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01b0 }, { 0xa436, 0xacce },
+ { 0xa438, 0x78bf }, { 0xa436, 0xacd0 }, { 0xa438, 0x01b8 },
+ { 0xa436, 0xacce }, { 0xa438, 0x7077 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0171 }, { 0xa436, 0xacce }, { 0xa438, 0x787f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0179 }, { 0xa436, 0xacce },
+ { 0xa438, 0xfb87 }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0xfb8f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0x40a7 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01a0 }, { 0xa436, 0xacce },
+ { 0xa438, 0x48af }, { 0xa436, 0xacd0 }, { 0xa438, 0x01a8 },
+ { 0xa436, 0xacce }, { 0xa438, 0x4067 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0161 }, { 0xa436, 0xacce }, { 0xa438, 0x486f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0169 }, { 0xa436, 0xacce },
+ { 0xa438, 0xfb97 }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0xfb9f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0x50b7 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x01b0 }, { 0xa436, 0xacce },
+ { 0xa438, 0x58bf }, { 0xa436, 0xacd0 }, { 0xa438, 0x01b8 },
+ { 0xa436, 0xacce }, { 0xa438, 0x5077 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0171 }, { 0xa436, 0xacce }, { 0xa438, 0x587f },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0179 }, { 0xa436, 0xacce },
+ { 0xa438, 0xfba7 }, { 0xa436, 0xacd0 }, { 0xa438, 0x07ff },
+ { 0xa436, 0xacce }, { 0xa438, 0xfbaf }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0x2067 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x0161 }, { 0xa436, 0xacce },
+ { 0xa438, 0x286f }, { 0xa436, 0xacd0 }, { 0xa438, 0x0169 },
+ { 0xa436, 0xacce }, { 0xa438, 0xfbb7 }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x07ff }, { 0xa436, 0xacce }, { 0xa438, 0xfbbf },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x07ff }, { 0xa436, 0xacce },
+ { 0xa438, 0x3077 }, { 0xa436, 0xacd0 }, { 0xa438, 0x0171 },
+ { 0xa436, 0xacce }, { 0xa438, 0x387f }, { 0xa436, 0xacd0 },
+ { 0xa438, 0x0179 }, { 0xa436, 0xacce }, { 0xa438, 0xfff9 },
+ { 0xa436, 0xacd0 }, { 0xa438, 0x17ff }, { 0xa436, 0xacce },
+ { 0xa438, 0xfff9 }, { 0xa436, 0xacd0 }, { 0xa438, 0x17ff },
+ { 0xa436, 0xacca }, { 0xa438, 0x0004 }, { 0xa436, 0xacc6 },
+ { 0xa438, 0x0008 }, { 0xa436, 0xacc8 }, { 0xa438, 0xc000 },
+ { 0xa436, 0xacc8 }, { 0xa438, 0x0000 }, { 0xb820, 0x0000 }
+};
+
static const struct rge_hw_regaddr_array mac_r26_1_mcu[] = {
{ 0xa436, 0x8023 }, { 0xa438, 0x4700 }, { 0xa436, 0xb82e },
{ 0xa438, 0x0001 }, { 0xb820, 0x0090 }, { 0xa436, 0xa016 },
@@ -9614,7 +10248,7 @@ static const struct {
MAC_R25_MCU
}, mac_r25b_mcu[] = {
MAC_R25B_MCU
-}, mac_r25d_mcu[] = {
+}, mac_r25d_1_mcu[] = {
MAC_R25D_MCU
};
diff --git a/sys/dev/rge/if_rgereg.h b/sys/dev/rge/if_rgereg.h
index 7b34e3cefbe6..7da8ff42f2b4 100644
--- a/sys/dev/rge/if_rgereg.h
+++ b/sys/dev/rge/if_rgereg.h
@@ -365,13 +365,17 @@ struct rge_hw_mac_stats {
#define RGE_STATS_ALIGNMENT 64
/* Ram version */
-#define RGE_MAC_R25D_RCODE_VER 0x0027
+#define RGE_MAC_R25D_1_RCODE_VER 0x0027
+#define RGE_MAC_R25D_2_RCODE_VER 0x0031
#define RGE_MAC_R26_1_RCODE_VER 0x0033
#define RGE_MAC_R26_2_RCODE_VER 0x0060
#define RGE_MAC_R27_RCODE_VER 0x0036
#define RGE_MAC_R25_RCODE_VER 0x0b33
#define RGE_MAC_R25B_RCODE_VER 0x0b99
+#define RGE_TYPE_R25D(sc) \
+ ((sc)->rge_type == MAC_R25D_1 || (sc)->rge_type == MAC_R25D_2)
+
#define RGE_TYPE_R26(sc) \
((sc)->rge_type == MAC_R26_1 || (sc)->rge_type == MAC_R26_2)
diff --git a/sys/dev/rge/if_rgevar.h b/sys/dev/rge/if_rgevar.h
index 504d56cba423..924133da45e3 100644
--- a/sys/dev/rge/if_rgevar.h
+++ b/sys/dev/rge/if_rgevar.h
@@ -30,7 +30,8 @@ enum rge_mac_type {
MAC_UNKNOWN = 1,
MAC_R25,
MAC_R25B,
- MAC_R25D,
+ MAC_R25D_1,
+ MAC_R25D_2,
MAC_R26_1,
MAC_R26_2,
MAC_R27
diff --git a/sys/dev/sdhci/sdhci_fdt_rockchip.c b/sys/dev/sdhci/sdhci_fdt_rockchip.c
index 44a5e2ffe271..2d0ade8055e7 100644
--- a/sys/dev/sdhci/sdhci_fdt_rockchip.c
+++ b/sys/dev/sdhci/sdhci_fdt_rockchip.c
@@ -113,12 +113,10 @@ static struct ofw_compat_data compat_data[] = {
static int
sdhci_fdt_rockchip_probe(device_t dev)
{
- struct sdhci_fdt_softc *sc = device_get_softc(dev);
-
- sc->quirks = 0;
- switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) {
if (!ofw_bus_status_okay(dev))
return (ENXIO);
+
+ switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) {
case SDHCI_FDT_RK3399:
device_set_desc(dev, "Rockchip RK3399 fdt SDHCI controller");
break;
@@ -129,7 +127,7 @@ sdhci_fdt_rockchip_probe(device_t dev)
return (ENXIO);
}
- return (0);
+ return (BUS_PROBE_DEFAULT);
}
static int
diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c
index 93043a296c5d..690b38c9f855 100644
--- a/sys/dev/smartpqi/smartpqi_cam.c
+++ b/sys/dev/smartpqi/smartpqi_cam.c
@@ -54,7 +54,7 @@ update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi)
cpi->initiator_id = 255;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN-1);
cpi->sim_vid[sizeof(cpi->sim_vid)-1] = '\0';
- strncpy(cpi->hba_vid, "Microsemi", HBA_IDLEN-1);
+ strncpy(cpi->hba_vid, "Microchip", HBA_IDLEN-1);
cpi->hba_vid[sizeof(cpi->hba_vid)-1] = '\0';
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN-1);
cpi->dev_name[sizeof(cpi->dev_name)-1] = '\0';
diff --git a/sys/dev/smartpqi/smartpqi_controllers.h b/sys/dev/smartpqi/smartpqi_controllers.h
index 6356159fd5f7..d5276f01a7e1 100644
--- a/sys/dev/smartpqi/smartpqi_controllers.h
+++ b/sys/dev/smartpqi/smartpqi_controllers.h
@@ -122,6 +122,7 @@ struct pqi_ident
{0x9005, 0x028f, 0x1f51, 0x1044, PQI_HWIF_SRCV, "SmartHBA P6500-8i"},
{0x9005, 0x028f, 0x1f3f, 0x0610, PQI_HWIF_SRCV, "3SNIC SSSRAID 3S610"},
{0x9005, 0x028f, 0x207d, 0x4840, PQI_HWIF_SRCV, "HRDT TrustHBA H3100s-8i"},
+ {0x9005, 0x028f, 0x207d, 0x4940, PQI_HWIF_SRCV, "HRDT TrustRAID D3102s-8i"},
/* (SRCx MSCC FVB 24x12G based) */
{0x9005, 0x028f, 0x103c, 0x1001, PQI_HWIF_SRCV, "MSCC FVB"},
@@ -151,11 +152,13 @@ struct pqi_ident
{0x9005, 0x028f, 0x1cf2, 0x0B27, PQI_HWIF_SRCV, "ZTE SmartROC3100 SDPSA/B-18i 4G"},
{0x9005, 0x028f, 0x1cf2, 0x0B45, PQI_HWIF_SRCV, "ZTE SmartROC3100 SDPSA/B_L-18i 2G"},
{0x9005, 0x028f, 0x1cf2, 0x5445, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM241-18i 2G"},
+ {0x9005, 0x028f, 0x1cf2, 0x544D, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM241B-18i 2G"},
{0x9005, 0x028f, 0x1cf2, 0x5446, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM242-18i 4G"},
+ {0x9005, 0x028f, 0x1cf2, 0x544E, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM242B-18i 4G"},
+ {0x9005, 0x028f, 0x1cf2, 0x5451, PQI_HWIF_SRCV, "ZTE SmartROC3100 RS231-8i 2G"},
+ {0x9005, 0x028f, 0x1cf2, 0x5452, PQI_HWIF_SRCV, "ZTE SmartROC3100 RS232-8i 4G"},
{0x9005, 0x028f, 0x1cf2, 0x5449, PQI_HWIF_SRCV, "ZTE SmartROC3100 RS241-18i 2G"},
{0x9005, 0x028f, 0x1cf2, 0x544A, PQI_HWIF_SRCV, "ZTE SmartROC3100 RS242-18i 4G"},
- {0x9005, 0x028f, 0x1cf2, 0x544D, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM241B-18i 2G"},
- {0x9005, 0x028f, 0x1cf2, 0x544E, PQI_HWIF_SRCV, "ZTE SmartROC3100 RM242B-18i 4G"},
{0x9005, 0x028f, 0x1bd4, 0x006F, PQI_HWIF_SRCV, "RS0804M5R16i"},
{0x9005, 0x028f, 0x1ff9, 0x006F, PQI_HWIF_SRCV, "RS0804M5R16i"},
{0x9005, 0x028f, 0x1f51, 0x1010, PQI_HWIF_SRCV, "SmartRAID P7504N-16i"},
@@ -178,6 +181,7 @@ struct pqi_ident
{0x9005, 0x028f, 0x1458, 0x1000, PQI_HWIF_SRCV, "GIGABYTE SmartHBA CLN1832"},
{0x9005, 0x028f, 0x1cf2, 0x0B29, PQI_HWIF_SRCV, "ZTE SmartIOC2100 SDPSA/B_I-18i"},
{0x9005, 0x028f, 0x1cf2, 0x5447, PQI_HWIF_SRCV, "ZTE SmartIOC2100 RM243-18i"},
+ {0x9005, 0x028f, 0x1cf2, 0x5453, PQI_HWIF_SRCV, "ZTE SmartIOC2100 RS233-8i"},
{0x9005, 0x028f, 0x1cf2, 0x544B, PQI_HWIF_SRCV, "ZTE SmartIOC2100 RS243-18i"},
{0x9005, 0x028f, 0x1cf2, 0x544F, PQI_HWIF_SRCV, "ZTE SmartIOC2100 RM243B-18i"},
{0x9005, 0x028f, 0x1bd4, 0x0071, PQI_HWIF_SRCV, "RS0800M5H16i"},
diff --git a/sys/dev/smartpqi/smartpqi_defines.h b/sys/dev/smartpqi/smartpqi_defines.h
index fe2edf7a74a9..0277abd3e318 100644
--- a/sys/dev/smartpqi/smartpqi_defines.h
+++ b/sys/dev/smartpqi/smartpqi_defines.h
@@ -911,9 +911,14 @@ static inline uint64_t CALC_PERCENT_TOTAL(uint64_t val, uint64_t total)
#define CCISS_GETDRIVVER _IOWR(SMARTPQI_IOCTL_BASE, 0, driver_info)
#define CCISS_GETPCIINFO _IOWR(SMARTPQI_IOCTL_BASE, 1, pqi_pci_info_t)
#define SMARTPQI_PASS_THRU _IOWR(SMARTPQI_IOCTL_BASE, 2, IOCTL_Command_struct)
+#define SMARTPQI_BIG_PASS_THRU _IOWR(SMARTPQI_IOCTL_BASE, 3, BIG_IOCTL_Command_struct)
#define CCISS_PASSTHRU _IOWR('C', 210, IOCTL_Command_struct)
#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
+#if !defined(SMARTPQI_BIG_PASSTHRU_SUPPORTED)
+#define SMARTPQI_BIG_PASSTHRU_SUPPORTED _IO(SMARTPQI_IOCTL_BASE, 4)
+#endif
+
/*IOCTL pci_info structure */
typedef struct pqi_pci_info
{
@@ -939,12 +944,12 @@ typedef uint8_t *passthru_buf_type_t;
#define PQISRC_DRIVER_MAJOR __FreeBSD__
#if __FreeBSD__ <= 14
-#define PQISRC_DRIVER_MINOR 4660
+#define PQISRC_DRIVER_MINOR 4690
#else
-#define PQISRC_DRIVER_MINOR 0
+#define PQISRC_DRIVER_MINOR 2
#endif
#define PQISRC_DRIVER_RELEASE 0
-#define PQISRC_DRIVER_REVISION 2002
+#define PQISRC_DRIVER_REVISION 2008
#define STR(s) # s
#define PQISRC_VERSION(a, b, c, d) STR(a.b.c-d)
diff --git a/sys/dev/smartpqi/smartpqi_event.c b/sys/dev/smartpqi/smartpqi_event.c
index 761bb5588ff9..77a70f9fb031 100644
--- a/sys/dev/smartpqi/smartpqi_event.c
+++ b/sys/dev/smartpqi/smartpqi_event.c
@@ -417,7 +417,7 @@ pqisrc_report_event_config(pqisrc_softstate_t *softs)
softs->event_config.num_event_descriptors = MIN(event_config_p->num_event_descriptors,
PQI_MAX_EVENT_DESCRIPTORS) ;
- for (i = 0; i < softs->event_config.num_event_descriptors; i++) {
+ for (i=0; i < softs->event_config.num_event_descriptors; i++) {
softs->event_config.descriptors[i].event_type =
event_config_p->descriptors[i].event_type;
}
@@ -477,7 +477,7 @@ pqisrc_set_event_config(pqisrc_softstate_t *softs)
event_config_p->num_event_descriptors = softs->event_config.num_event_descriptors;
- for (i = 0; i < softs->event_config.num_event_descriptors; i++) {
+ for (i=0; i < softs->event_config.num_event_descriptors; i++) {
event_config_p->descriptors[i].event_type =
softs->event_config.descriptors[i].event_type;
if( pqisrc_event_type_to_event_index(event_config_p->descriptors[i].event_type) != -1)
diff --git a/sys/dev/smartpqi/smartpqi_features.c b/sys/dev/smartpqi/smartpqi_features.c
index 2a53dbe654b1..ae6114ef066b 100644
--- a/sys/dev/smartpqi/smartpqi_features.c
+++ b/sys/dev/smartpqi/smartpqi_features.c
@@ -1,5 +1,5 @@
/*-
- * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries.
+ * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/sys/dev/smartpqi/smartpqi_helper.c b/sys/dev/smartpqi/smartpqi_helper.c
index 0a4bf6ec21cb..9454fa8b63ab 100644
--- a/sys/dev/smartpqi/smartpqi_helper.c
+++ b/sys/dev/smartpqi/smartpqi_helper.c
@@ -333,6 +333,8 @@ check_struct_sizes(void)
64 bit and 32 bit system*/
ASSERT(sizeof(IOCTL_Command_struct)== 86 ||
sizeof(IOCTL_Command_struct)== 82);
+ ASSERT(sizeof(BIG_IOCTL_Command_struct)== 88 ||
+ sizeof(BIG_IOCTL_Command_struct)== 84);
ASSERT(sizeof(struct bmic_host_wellness_driver_version)== 44);
ASSERT(sizeof(struct bmic_host_wellness_time)== 20);
ASSERT(sizeof(struct pqi_dev_adminq_cap)== 8);
@@ -386,7 +388,7 @@ void
check_device_pending_commands_to_complete(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device)
{
uint32_t tag = softs->max_outstanding_io, active_requests;
- uint64_t timeout = 0, delay_in_usec = 1000; /* In micro Seconds */
+ uint64_t timeout = 0, delay_in_usec = 1000; /* In microseconds */
rcb_t* rcb;
DBG_FUNC("IN\n");
diff --git a/sys/dev/smartpqi/smartpqi_helper.h b/sys/dev/smartpqi/smartpqi_helper.h
index 507caeb9b0b6..362eb0d05379 100644
--- a/sys/dev/smartpqi/smartpqi_helper.h
+++ b/sys/dev/smartpqi/smartpqi_helper.h
@@ -1,5 +1,5 @@
/*-
- * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries.
+ * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/sys/dev/smartpqi/smartpqi_includes.h b/sys/dev/smartpqi/smartpqi_includes.h
index a8682e8a848d..30846b1a1d6c 100644
--- a/sys/dev/smartpqi/smartpqi_includes.h
+++ b/sys/dev/smartpqi/smartpqi_includes.h
@@ -1,5 +1,5 @@
/*-
- * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries.
+ * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/sys/dev/smartpqi/smartpqi_ioctl.c b/sys/dev/smartpqi/smartpqi_ioctl.c
index 0517c0513cce..7fd68b1a3263 100644
--- a/sys/dev/smartpqi/smartpqi_ioctl.c
+++ b/sys/dev/smartpqi/smartpqi_ioctl.c
@@ -169,6 +169,13 @@ smartpqi_ioctl(struct cdev *cdev, u_long cmd, caddr_t udata,
pqi_status = pqisrc_passthru_ioctl(softs, udata, 0);
bsd_status = pqi_status_to_bsd_ioctl_status(pqi_status);
break;
+ case SMARTPQI_BIG_PASS_THRU:
+ pqi_status = pqisrc_big_passthru_ioctl(softs, udata, 0);
+ bsd_status = pqi_status_to_bsd_ioctl_status(pqi_status);
+ break;
+ case SMARTPQI_BIG_PASSTHRU_SUPPORTED:
+ bsd_status = BSD_SUCCESS;
+ break;
case CCISS_REGNEWD:
pqi_status = pqisrc_scan_devices(softs);
bsd_status = pqi_status_to_bsd_ioctl_status(pqi_status);
@@ -422,3 +429,195 @@ out:
DBG_FUNC("Failed OUT\n");
return PQI_STATUS_FAILURE;
}
+
+/*
+ * Function used to send big passthru commands to adapter
+ * to support management tools. For eg. ssacli, sscon.
+ */
+int
+pqisrc_big_passthru_ioctl(struct pqisrc_softstate *softs, void *arg, int mode)
+{
+ int ret;
+ char *drv_buf = NULL;
+ uint32_t tag = 0;
+ BIG_IOCTL_Command_struct *iocommand = (BIG_IOCTL_Command_struct *)arg;
+ dma_mem_t ioctl_dma_buf;
+ pqisrc_raid_req_t request;
+ raid_path_error_info_elem_t error_info;
+ ib_queue_t *ib_q = &softs->op_raid_ib_q[PQI_DEFAULT_IB_QUEUE];
+ ob_queue_t const *ob_q = &softs->op_ob_q[PQI_DEFAULT_IB_QUEUE];
+ rcb_t *rcb = NULL;
+
+ memset(&request, 0, sizeof(request));
+ memset(&error_info, 0, sizeof(error_info));
+
+ DBG_FUNC("IN\n");
+
+ if (pqisrc_ctrl_offline(softs))
+ return PQI_STATUS_FAILURE;
+
+ if (!arg)
+ return PQI_STATUS_FAILURE;
+
+ if (iocommand->buf_size < 1 &&
+ iocommand->Request.Type.Direction != PQIIOCTL_NONE)
+ return PQI_STATUS_FAILURE;
+ if (iocommand->Request.CDBLen > sizeof(request.cmd.cdb))
+ return PQI_STATUS_FAILURE;
+
+ switch (iocommand->Request.Type.Direction) {
+ case PQIIOCTL_NONE:
+ case PQIIOCTL_WRITE:
+ case PQIIOCTL_READ:
+ case PQIIOCTL_BIDIRECTIONAL:
+ break;
+ default:
+ return PQI_STATUS_FAILURE;
+ }
+
+ if (iocommand->buf_size > 0) {
+ memset(&ioctl_dma_buf, 0, sizeof(struct dma_mem));
+ os_strlcpy(ioctl_dma_buf.tag, "Ioctl_PassthruCmd_Buffer", sizeof(ioctl_dma_buf.tag));
+ ioctl_dma_buf.size = iocommand->buf_size;
+ ioctl_dma_buf.align = PQISRC_DEFAULT_DMA_ALIGN;
+ /* allocate memory */
+ ret = os_dma_mem_alloc(softs, &ioctl_dma_buf);
+ if (ret) {
+ DBG_ERR("Failed to Allocate dma mem for Ioctl PassthruCmd Buffer : %d\n", ret);
+ goto out;
+ }
+
+ DBG_IO("ioctl_dma_buf.dma_addr = %p\n",(void*)ioctl_dma_buf.dma_addr);
+ DBG_IO("ioctl_dma_buf.virt_addr = %p\n",(void*)ioctl_dma_buf.virt_addr);
+
+ drv_buf = (char *)ioctl_dma_buf.virt_addr;
+ if (iocommand->Request.Type.Direction & PQIIOCTL_WRITE) {
+ ret = os_copy_from_user(softs, (void *)drv_buf, (void *)iocommand->buf, iocommand->buf_size, mode);
+ if (ret != 0) {
+ goto free_mem;
+ }
+ }
+ }
+
+ request.header.iu_type = PQI_IU_TYPE_RAID_PATH_IO_REQUEST;
+ request.header.iu_length = offsetof(pqisrc_raid_req_t, sg_descriptors[1]) -
+ PQI_REQUEST_HEADER_LENGTH;
+ memcpy(request.lun_number, iocommand->LUN_info.LunAddrBytes,
+ sizeof(request.lun_number));
+ memcpy(request.cmd.cdb, iocommand->Request.CDB, iocommand->Request.CDBLen);
+ request.additional_cdb_bytes_usage = PQI_ADDITIONAL_CDB_BYTES_0;
+
+ switch (iocommand->Request.Type.Direction) {
+ case PQIIOCTL_NONE:
+ request.data_direction = SOP_DATA_DIR_NONE;
+ break;
+ case PQIIOCTL_WRITE:
+ request.data_direction = SOP_DATA_DIR_FROM_DEVICE;
+ break;
+ case PQIIOCTL_READ:
+ request.data_direction = SOP_DATA_DIR_TO_DEVICE;
+ break;
+ case PQIIOCTL_BIDIRECTIONAL:
+ request.data_direction = SOP_DATA_DIR_BIDIRECTIONAL;
+ break;
+ }
+
+ request.task_attribute = SOP_TASK_ATTRIBUTE_SIMPLE;
+ if (iocommand->buf_size > 0) {
+ request.buffer_length = iocommand->buf_size;
+ request.sg_descriptors[0].addr = ioctl_dma_buf.dma_addr;
+ request.sg_descriptors[0].len = iocommand->buf_size;
+ request.sg_descriptors[0].flags = SG_FLAG_LAST;
+ }
+ tag = pqisrc_get_tag(&softs->taglist);
+ if (INVALID_ELEM == tag) {
+ DBG_ERR("Tag not available\n");
+ goto free_mem;
+ }
+ request.request_id = tag;
+ request.response_queue_id = ob_q->q_id;
+ request.error_index = request.request_id;
+ if (softs->timeout_in_passthrough) {
+ request.timeout_in_sec = iocommand->Request.Timeout;
+ }
+
+ rcb = &softs->rcb[tag];
+ rcb->success_cmp_callback = pqisrc_process_internal_raid_response_success;
+ rcb->error_cmp_callback = pqisrc_process_internal_raid_response_error;
+ rcb->tag = tag;
+ rcb->req_pending = true;
+ /* Submit Command */
+ ret = pqisrc_submit_cmnd(softs, ib_q, &request);
+ if (ret != PQI_STATUS_SUCCESS) {
+ DBG_ERR("Unable to submit command\n");
+ goto err_out;
+ }
+
+ ret = pqisrc_wait_on_condition(softs, rcb, PQISRC_PASSTHROUGH_CMD_TIMEOUT);
+ if (ret != PQI_STATUS_SUCCESS) {
+ DBG_ERR("Passthru IOCTL cmd timed out !!\n");
+ goto err_out;
+ }
+
+ memset(&iocommand->error_info, 0, sizeof(iocommand->error_info));
+
+
+ if (rcb->status) {
+ size_t sense_data_length;
+
+ memcpy(&error_info, rcb->error_info, sizeof(error_info));
+ iocommand->error_info.ScsiStatus = error_info.status;
+ sense_data_length = error_info.sense_data_len;
+
+ if (!sense_data_length)
+ sense_data_length = error_info.resp_data_len;
+
+ if (sense_data_length &&
+ (sense_data_length > sizeof(error_info.data)))
+ sense_data_length = sizeof(error_info.data);
+
+ if (sense_data_length) {
+ if (sense_data_length >
+ sizeof(iocommand->error_info.SenseInfo))
+ sense_data_length =
+ sizeof(iocommand->error_info.SenseInfo);
+ memcpy (iocommand->error_info.SenseInfo,
+ error_info.data, sense_data_length);
+ iocommand->error_info.SenseLen = sense_data_length;
+ }
+
+ if (error_info.data_out_result == PQI_RAID_DATA_IN_OUT_UNDERFLOW) {
+ rcb->status = PQI_STATUS_SUCCESS;
+ }
+ }
+
+ if (rcb->status == PQI_STATUS_SUCCESS && iocommand->buf_size > 0 &&
+ (iocommand->Request.Type.Direction & PQIIOCTL_READ)) {
+
+ ret = os_copy_to_user(softs, (void*)iocommand->buf, (void*)drv_buf, iocommand->buf_size, mode);
+ if (ret != 0) {
+ DBG_ERR("Failed to copy the response\n");
+ goto err_out;
+ }
+ }
+
+ os_reset_rcb(rcb);
+ pqisrc_put_tag(&softs->taglist, request.request_id);
+ if (iocommand->buf_size > 0)
+ os_dma_mem_free(softs,&ioctl_dma_buf);
+
+ DBG_FUNC("OUT\n");
+ return PQI_STATUS_SUCCESS;
+
+err_out:
+ os_reset_rcb(rcb);
+ pqisrc_put_tag(&softs->taglist, request.request_id);
+
+free_mem:
+ if (iocommand->buf_size > 0)
+ os_dma_mem_free(softs, &ioctl_dma_buf);
+
+out:
+ DBG_FUNC("Failed OUT\n");
+ return PQI_STATUS_FAILURE;
+} \ No newline at end of file
diff --git a/sys/dev/smartpqi/smartpqi_ioctl.h b/sys/dev/smartpqi/smartpqi_ioctl.h
index 633465aeb8cd..ef4678ad5a3b 100644
--- a/sys/dev/smartpqi/smartpqi_ioctl.h
+++ b/sys/dev/smartpqi/smartpqi_ioctl.h
@@ -1,5 +1,5 @@
/*-
- * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries.
+ * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -137,5 +137,12 @@ typedef struct pqi_ioctl_passthruCmd_struct {
}OS_ATTRIBUTE_PACKED IOCTL_Command_struct;
+typedef struct _BIG_IOCTL_Command_struct {
+ LUNAddr_struct LUN_info;
+ RequestBlock_struct Request;
+ ErrorInfo_struct error_info;
+ DWORD buf_size; /* size in bytes of the buf */
+ passthru_buf_type_t buf;
+}OS_ATTRIBUTE_PACKED BIG_IOCTL_Command_struct;
#endif /* _PQI_IOCTL_H_ */
diff --git a/sys/dev/smartpqi/smartpqi_main.c b/sys/dev/smartpqi/smartpqi_main.c
index 6274ecc957d4..dea7809a1b8e 100644
--- a/sys/dev/smartpqi/smartpqi_main.c
+++ b/sys/dev/smartpqi/smartpqi_main.c
@@ -25,7 +25,7 @@
/*
- * Driver for the Microsemi Smart storage controllers
+ * Driver for the Microchip Smart storage controllers
*/
#include "smartpqi_includes.h"
diff --git a/sys/dev/smartpqi/smartpqi_mem.c b/sys/dev/smartpqi/smartpqi_mem.c
index 239d619968d2..08f806681dce 100644
--- a/sys/dev/smartpqi/smartpqi_mem.c
+++ b/sys/dev/smartpqi/smartpqi_mem.c
@@ -1,5 +1,5 @@
/*-
- * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries.
+ * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/sys/dev/smartpqi/smartpqi_prototypes.h b/sys/dev/smartpqi/smartpqi_prototypes.h
index fdf69e38fa59..7abce9c3789d 100644
--- a/sys/dev/smartpqi/smartpqi_prototypes.h
+++ b/sys/dev/smartpqi/smartpqi_prototypes.h
@@ -251,6 +251,7 @@ int pqisrc_process_task_management_response(pqisrc_softstate_t *,
/* smartpqi_ioctl.c*/
int pqisrc_passthru_ioctl(struct pqisrc_softstate *, void *, int);
+int pqisrc_big_passthru_ioctl(struct pqisrc_softstate *, void *, int);
/* Functions Prototypes */
/* smartpqi_mem.c */
diff --git a/sys/dev/smartpqi/smartpqi_queue.c b/sys/dev/smartpqi/smartpqi_queue.c
index 22bc2db572f8..e8a467531aa4 100644
--- a/sys/dev/smartpqi/smartpqi_queue.c
+++ b/sys/dev/smartpqi/smartpqi_queue.c
@@ -688,7 +688,7 @@ pqisrc_create_op_obq(pqisrc_softstate_t *softs,
int i = 0;
DBG_WARN("Error Status Descriptors\n");
for (i = 0; i < 4; i++)
- DBG_WARN(" %x ",admin_resp.resp_type.create_op_oq.status_desc[i]);
+ DBG_WARN(" %x\n",admin_resp.resp_type.create_op_oq.status_desc[i]);
}
DBG_FUNC("OUT ret : %d\n", ret);
@@ -731,7 +731,7 @@ pqisrc_create_op_ibq(pqisrc_softstate_t *softs,
int i = 0;
DBG_WARN("Error Status Decsriptors\n");
for (i = 0; i < 4; i++)
- DBG_WARN(" %x ",admin_resp.resp_type.create_op_iq.status_desc[i]);
+ DBG_WARN(" %x\n",admin_resp.resp_type.create_op_iq.status_desc[i]);
}
DBG_FUNC("OUT ret : %d\n", ret);
diff --git a/sys/dev/smartpqi/smartpqi_request.c b/sys/dev/smartpqi/smartpqi_request.c
index e6ba41a814b2..c5f8ac3c41ba 100644
--- a/sys/dev/smartpqi/smartpqi_request.c
+++ b/sys/dev/smartpqi/smartpqi_request.c
@@ -1180,7 +1180,7 @@ fill_lba_for_scsi_rw(pqisrc_softstate_t *softs, uint8_t *cdb, aio_req_locator_t
/* determine whether writes to certain types of RAID are supported. */
-static inline boolean_t
+static boolean_t
pqisrc_is_supported_write(pqisrc_softstate_t const *softs,
pqi_scsi_dev_t const *device)
{
diff --git a/sys/dev/smartpqi/smartpqi_tag.c b/sys/dev/smartpqi/smartpqi_tag.c
index 214b1bd3ce7d..d9680a65f265 100644
--- a/sys/dev/smartpqi/smartpqi_tag.c
+++ b/sys/dev/smartpqi/smartpqi_tag.c
@@ -1,5 +1,5 @@
/*-
- * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries.
+ * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/sys/dev/spibus/spigen.c b/sys/dev/spibus/spigen.c
index 66c93e927281..39b94c6123fc 100644
--- a/sys/dev/spibus/spigen.c
+++ b/sys/dev/spibus/spigen.c
@@ -283,8 +283,10 @@ spigen_mmap_cleanup(void *arg)
{
struct spigen_mmap *mmap = arg;
- if (mmap->kvaddr != 0)
+ if (mmap->kvaddr != 0) {
pmap_qremove(mmap->kvaddr, mmap->bufsize / PAGE_SIZE);
+ kva_free(mmap->kvaddr, mmap->bufsize);
+ }
if (mmap->bufobj != NULL)
vm_object_deallocate(mmap->bufobj);
free(mmap, M_DEVBUF);
diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c
index b4e5c1075fb4..1399eadb21fb 100644
--- a/sys/dev/sym/sym_hipd.c
+++ b/sys/dev/sym/sym_hipd.c
@@ -58,7 +58,6 @@
*/
#include <sys/cdefs.h>
-#define SYM_DRIVER_NAME "sym-1.6.5-20000902"
/* #define SYM_DEBUG_GENERIC_SUPPORT */
@@ -114,17 +113,15 @@ typedef u_int32_t u32;
#include <dev/sym/sym_fw.h>
/*
- * IA32 architecture does not reorder STORES and prevents
- * LOADS from passing STORES. It is called `program order'
- * by Intel and allows device drivers to deal with memory
- * ordering by only ensuring that the code is not reordered
- * by the compiler when ordering is required.
- * Other architectures implement a weaker ordering that
- * requires memory barriers (and also IO barriers when they
- * make sense) to be used.
+ * With uncacheable memory, x86 does not reorder STORES and prevents LOADS
+ * from passing STORES. For ensuring this program order, we still need to
+ * employ compiler barriers, though, when the ordering of LOADS and STORES
+ * matters.
+ * Other architectures may implement weaker ordering guarantees and, thus,
+ * require memory barriers (and also IO barriers) to be used.
*/
#if defined __i386__ || defined __amd64__
-#define MEMORY_BARRIER() do { ; } while(0)
+#define MEMORY_BARRIER() __compiler_membar()
#elif defined __powerpc__
#define MEMORY_BARRIER() __asm__ volatile("eieio; sync" : : : "memory")
#elif defined __arm__
@@ -594,10 +591,10 @@ static m_addr_t ___dma_getp(m_pool_s *mp)
goto out_err;
if (bus_dmamem_alloc(mp->dmat, &vaddr,
- BUS_DMA_COHERENT | BUS_DMA_WAITOK, &vbp->dmamap))
+ BUS_DMA_COHERENT | BUS_DMA_NOCACHE | BUS_DMA_WAITOK, &vbp->dmamap))
goto out_err;
- bus_dmamap_load(mp->dmat, vbp->dmamap, vaddr,
- MEMO_CLUSTER_SIZE, getbaddrcb, &baddr, BUS_DMA_NOWAIT);
+ bus_dmamap_load(mp->dmat, vbp->dmamap, vaddr, MEMO_CLUSTER_SIZE,
+ getbaddrcb, &baddr, BUS_DMA_NOWAIT);
if (baddr) {
int hc = VTOB_HASH_CODE(vaddr);
vbp->vaddr = (m_addr_t) vaddr;
@@ -1484,7 +1481,7 @@ struct sym_hcb {
u32 scr_ram_seg;
/*
- * Chip and controller indentification.
+ * Chip and controller identification.
*/
device_t device;
@@ -1534,7 +1531,6 @@ struct sym_hcb {
struct resource *io_res;
struct resource *mmio_res;
struct resource *ram_res;
- int ram_id;
void *intr;
/*
@@ -1558,8 +1554,6 @@ struct sym_hcb {
* BUS addresses of the chip
*/
vm_offset_t mmio_ba; /* MMIO BUS address */
- int mmio_ws; /* MMIO Window size */
-
vm_offset_t ram_ba; /* RAM BUS address */
int ram_ws; /* RAM window size */
@@ -2012,8 +2006,8 @@ static void sym_fw_bind_script (hcb_p np, u32 *start, int len)
* command.
*/
if (opcode == 0) {
- printf ("%s: ERROR0 IN SCRIPT at %d.\n",
- sym_name(np), (int) (cur-start));
+ device_printf(np->device, "ERROR0 IN SCRIPT at %d.\n",
+ (int)(cur-start));
MDELAY (10000);
++cur;
continue;
@@ -2056,8 +2050,9 @@ static void sym_fw_bind_script (hcb_p np, u32 *start, int len)
tmp1 = cur[1];
tmp2 = cur[2];
if ((tmp1 ^ tmp2) & 3) {
- printf ("%s: ERROR1 IN SCRIPT at %d.\n",
- sym_name(np), (int) (cur-start));
+ device_printf(np->device,
+ "ERROR1 IN SCRIPT at %d.\n",
+ (int)(cur-start));
MDELAY (10000);
}
/*
@@ -2248,10 +2243,11 @@ static void sym_update_dflags(hcb_p np, u_char *flags,
struct ccb_trans_settings *cts);
static const struct sym_pci_chip *sym_find_pci_chip (device_t dev);
-static int sym_pci_probe (device_t dev);
-static int sym_pci_attach (device_t dev);
-static void sym_pci_free (hcb_p np);
+static device_probe_t sym_pci_probe;
+static device_attach_t sym_pci_attach;
+static device_detach_t sym_pci_detach;
+
static int sym_cam_attach (hcb_p np);
static void sym_cam_free (hcb_p np);
@@ -2426,8 +2422,8 @@ static void sym_print_targets_flag(hcb_p np, int mask, char *msg)
continue;
if (np->target[i].usrflags & mask) {
if (!cnt++)
- printf("%s: %s disabled for targets",
- sym_name(np), msg);
+ device_printf(np->device,
+ "%s disabled for targets", msg);
printf(" %d", i);
}
}
@@ -2750,41 +2746,42 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram)
* Let user know about the settings.
*/
i = nvram->type;
- printf("%s: %s NVRAM, ID %d, Fast-%d, %s, %s\n", sym_name(np),
- i == SYM_SYMBIOS_NVRAM ? "Symbios" :
- (i == SYM_TEKRAM_NVRAM ? "Tekram" : "No"),
- np->myaddr,
- (np->features & FE_ULTRA3) ? 80 :
- (np->features & FE_ULTRA2) ? 40 :
- (np->features & FE_ULTRA) ? 20 : 10,
- sym_scsi_bus_mode(np->scsi_mode),
- (np->rv_scntl0 & 0xa) ? "parity checking" : "NO parity");
+ device_printf(np->device, "%s NVRAM, ID %d, Fast-%d, %s, %s\n",
+ i == SYM_SYMBIOS_NVRAM ? "Symbios" :
+ (i == SYM_TEKRAM_NVRAM ? "Tekram" : "No"),
+ np->myaddr,
+ (np->features & FE_ULTRA3) ? 80 :
+ (np->features & FE_ULTRA2) ? 40 :
+ (np->features & FE_ULTRA) ? 20 : 10,
+ sym_scsi_bus_mode(np->scsi_mode),
+ (np->rv_scntl0 & 0xa) ? "parity checking" : "NO parity");
/*
* Tell him more on demand.
*/
if (sym_verbose) {
- printf("%s: %s IRQ line driver%s\n",
- sym_name(np),
- np->rv_dcntl & IRQM ? "totem pole" : "open drain",
- np->ram_ba ? ", using on-chip SRAM" : "");
- printf("%s: using %s firmware.\n", sym_name(np), np->fw_name);
+ device_printf(np->device, "%s IRQ line driver%s\n",
+ np->rv_dcntl & IRQM ? "totem pole" : "open drain",
+ np->ram_ba ? ", using on-chip SRAM" : "");
+ device_printf(np->device, "using %s firmware.\n", np->fw_name);
if (np->features & FE_NOPM)
- printf("%s: handling phase mismatch from SCRIPTS.\n",
- sym_name(np));
+ device_printf(np->device,
+ "handling phase mismatch from SCRIPTS.\n");
}
/*
* And still more.
*/
if (sym_verbose > 1) {
- printf ("%s: initial SCNTL3/DMODE/DCNTL/CTEST3/4/5 = "
- "(hex) %02x/%02x/%02x/%02x/%02x/%02x\n",
- sym_name(np), np->sv_scntl3, np->sv_dmode, np->sv_dcntl,
- np->sv_ctest3, np->sv_ctest4, np->sv_ctest5);
+ device_printf(np->device,
+ "initial SCNTL3/DMODE/DCNTL/CTEST3/4/5 = "
+ "(hex) %02x/%02x/%02x/%02x/%02x/%02x\n",
+ np->sv_scntl3, np->sv_dmode, np->sv_dcntl, np->sv_ctest3,
+ np->sv_ctest4, np->sv_ctest5);
- printf ("%s: final SCNTL3/DMODE/DCNTL/CTEST3/4/5 = "
- "(hex) %02x/%02x/%02x/%02x/%02x/%02x\n",
- sym_name(np), np->rv_scntl3, np->rv_dmode, np->rv_dcntl,
- np->rv_ctest3, np->rv_ctest4, np->rv_ctest5);
+ device_printf(np->device,
+ "final SCNTL3/DMODE/DCNTL/CTEST3/4/5 = "
+ "(hex) %02x/%02x/%02x/%02x/%02x/%02x\n",
+ np->rv_scntl3, np->rv_dmode, np->rv_dcntl,
+ np->rv_ctest3, np->rv_ctest4, np->rv_ctest5);
}
/*
* Let user be aware of targets that have some disable flags set.
@@ -2911,7 +2908,7 @@ static void sym_put_start_queue(hcb_p np, ccb_p cp)
np->squeueput = qidx;
if (DEBUG_FLAGS & DEBUG_QUEUE)
- printf ("%s: queuepos=%d.\n", sym_name (np), np->squeueput);
+ device_printf(np->device, "queuepos=%d.\n", np->squeueput);
/*
* Script processor may be waiting for reselect.
@@ -2965,8 +2962,8 @@ static void sym_soft_reset (hcb_p np)
}
}
if (!i)
- printf("%s: unable to abort current chip operation.\n",
- sym_name(np));
+ device_printf(np->device,
+ "unable to abort current chip operation.\n");
sym_chip_reset (np);
}
@@ -3016,13 +3013,12 @@ static int sym_reset_scsi_bus(hcb_p np, int enab_int)
term &= 0x3ffff;
if (term != (2<<7)) {
- printf("%s: suspicious SCSI data while resetting the BUS.\n",
- sym_name(np));
- printf("%s: %sdp0,d7-0,rst,req,ack,bsy,sel,atn,msg,c/d,i/o = "
- "0x%lx, expecting 0x%lx\n",
- sym_name(np),
- (np->features & FE_WIDE) ? "dp1,d15-8," : "",
- (u_long)term, (u_long)(2<<7));
+ device_printf(np->device,
+ "suspicious SCSI data while resetting the BUS.\n");
+ device_printf(np->device,
+ "%sdp0,d7-0,rst,req,ack,bsy,sel,atn,msg,c/d,i/o = "
+ "0x%lx, expecting 0x%lx\n", (np->features & FE_WIDE) ?
+ "dp1,d15-8," : "", (u_long)term, (u_long)(2 << 7));
if (SYM_SETUP_SCSI_BUS_CHECK == 1)
retv = 1;
}
@@ -3062,10 +3058,9 @@ static int sym_wakeup_done (hcb_p np)
MEMORY_BARRIER();
sym_complete_ok (np, cp);
++n;
- }
- else
- printf ("%s: bad DSA (%x) in done queue.\n",
- sym_name(np), (u_int) dsa);
+ } else
+ device_printf(np->device,
+ "bad DSA (%x) in done queue.\n", (u_int)dsa);
}
np->dqueueget = i;
@@ -3286,8 +3281,8 @@ static void sym_init (hcb_p np, int reason)
*/
if (np->ram_ba) {
if (sym_verbose > 1)
- printf ("%s: Downloading SCSI SCRIPTS.\n",
- sym_name(np));
+ device_printf(np->device,
+ "Downloading SCSI SCRIPTS.\n");
if (np->ram_ws == 8192) {
OUTRAM_OFF(4096, np->scriptb0, np->scriptb_sz);
OUTL (nc_mmws, np->scr_ram_seg);
@@ -3710,11 +3705,11 @@ static void sym_log_hard_error(hcb_p np, u_short sist, u_char dstat)
if (((script_ofs & 3) == 0) &&
(unsigned)script_ofs < script_size) {
- printf ("%s: script cmd = %08x\n", sym_name(np),
- scr_to_cpu((int) *(u32 *)(script_base + script_ofs)));
+ device_printf(np->device, "script cmd = %08x\n",
+ scr_to_cpu((int) *(u32 *)(script_base + script_ofs)));
}
- printf ("%s: regdump:", sym_name(np));
+ device_printf(np->device, "regdump:");
for (i = 0; i < 24; i++)
printf (" %02x", (unsigned)INB_OFF(i));
printf (".\n");
@@ -3727,8 +3722,8 @@ static void sym_log_hard_error(hcb_p np, u_short sist, u_char dstat)
pci_sts = pci_read_config(np->device, PCIR_STATUS, 2);
if (pci_sts & 0xf900) {
pci_write_config(np->device, PCIR_STATUS, pci_sts, 2);
- printf("%s: PCI STATUS = 0x%04x\n",
- sym_name(np), pci_sts & 0xf900);
+ device_printf(np->device, "PCI STATUS = 0x%04x\n",
+ pci_sts & 0xf900);
}
}
}
@@ -3933,9 +3928,9 @@ unknown_int:
* We just miss the cause of the interrupt. :(
* Print a message. The timeout will do the real work.
*/
- printf( "%s: unknown interrupt(s) ignored, "
- "ISTAT=0x%x DSTAT=0x%x SIST=0x%x\n",
- sym_name(np), istat, dstat, sist);
+ device_printf(np->device,
+ "unknown interrupt(s) ignored, ISTAT=0x%x DSTAT=0x%x SIST=0x%x\n",
+ istat, dstat, sist);
}
static void sym_intr(void *arg)
@@ -4050,7 +4045,7 @@ static void sym_int_sto (hcb_p np)
*/
static void sym_int_udc (hcb_p np)
{
- printf ("%s: unexpected disconnect\n", sym_name(np));
+ device_printf(np->device, "unexpected disconnect\n");
sym_recover_scsi_int(np, HS_UNEXPECTED);
}
@@ -4117,8 +4112,9 @@ static void sym_int_par (hcb_p np, u_short sist)
int phase = cmd & 7;
ccb_p cp = sym_ccb_from_dsa(np, dsa);
- printf("%s: SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n",
- sym_name(np), hsts, dbc, sbcl);
+ device_printf(np->device,
+ "SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n", hsts, dbc,
+ sbcl);
/*
* Check that the chip is connected to the SCSI BUS.
@@ -4305,14 +4301,14 @@ static void sym_int_ma (hcb_p np)
}
if (!vdsp) {
- printf ("%s: interrupted SCRIPT address not found.\n",
- sym_name (np));
+ device_printf(np->device,
+ "interrupted SCRIPT address not found.\n");
goto reset_all;
}
if (!cp) {
- printf ("%s: SCSI phase error fixup: CCB already dequeued.\n",
- sym_name (np));
+ device_printf(np->device,
+ "SCSI phase error fixup: CCB already dequeued.\n");
goto reset_all;
}
@@ -6757,15 +6753,15 @@ restart_test:
dstat = INB (nc_dstat);
#if 1 /* Band aiding for broken hardwares that fail PCI parity */
if ((dstat & MDPE) && (np->rv_ctest4 & MPEE)) {
- printf ("%s: PCI DATA PARITY ERROR DETECTED - "
- "DISABLING MASTER DATA PARITY CHECKING.\n",
- sym_name(np));
+ device_printf(np->device, "PCI DATA PARITY ERROR DETECTED - "
+ "DISABLING MASTER DATA PARITY CHECKING.\n");
np->rv_ctest4 &= ~MPEE;
goto restart_test;
}
#endif
if (dstat & (MDPE|BF|IID)) {
- printf ("CACHE TEST FAILED: DMA error (dstat=0x%02x).", dstat);
+ device_printf(np->device,
+ "CACHE TEST FAILED: DMA error (dstat=0x%02x).\n", dstat);
return (0x80);
}
/*
@@ -6783,28 +6779,32 @@ restart_test:
* Check termination position.
*/
if (pc != SCRIPTB0_BA (np, snoopend)+8) {
- printf ("CACHE TEST FAILED: script execution failed.\n");
- printf ("start=%08lx, pc=%08lx, end=%08lx\n",
- (u_long) SCRIPTB0_BA (np, snooptest), (u_long) pc,
- (u_long) SCRIPTB0_BA (np, snoopend) +8);
+ device_printf(np->device,
+ "CACHE TEST FAILED: script execution failed.\n");
+ device_printf(np->device, "start=%08lx, pc=%08lx, end=%08lx\n",
+ (u_long)SCRIPTB0_BA(np, snooptest), (u_long)pc,
+ (u_long)SCRIPTB0_BA(np, snoopend) + 8);
return (0x40);
}
/*
* Show results.
*/
if (host_wr != sym_rd) {
- printf ("CACHE TEST FAILED: host wrote %d, chip read %d.\n",
- (int) host_wr, (int) sym_rd);
+ device_printf(np->device,
+ "CACHE TEST FAILED: host wrote %d, chip read %d.\n",
+ (int)host_wr, (int)sym_rd);
err |= 1;
}
if (host_rd != sym_wr) {
- printf ("CACHE TEST FAILED: chip wrote %d, host read %d.\n",
- (int) sym_wr, (int) host_rd);
+ device_printf(np->device,
+ "CACHE TEST FAILED: chip wrote %d, host read %d.\n",
+ (int)sym_wr, (int)host_rd);
err |= 2;
}
if (sym_bk != sym_wr) {
- printf ("CACHE TEST FAILED: chip wrote %d, read back %d.\n",
- (int) sym_wr, (int) sym_bk);
+ device_printf(np->device,
+ "CACHE TEST FAILED: chip wrote %d, read back %d.\n",
+ (int)sym_wr, (int)sym_bk);
err |= 4;
}
@@ -6843,7 +6843,7 @@ static void sym_selectclock(hcb_p np, u_char scntl3)
}
if (sym_verbose >= 2)
- printf ("%s: enabling clock multiplier\n", sym_name(np));
+ device_printf(np->device, "enabling clock multiplier\n");
OUTB(nc_stest1, DBLEN); /* Enable clock multiplier */
/*
@@ -6855,8 +6855,8 @@ static void sym_selectclock(hcb_p np, u_char scntl3)
while (!(INB(nc_stest4) & LCKFRQ) && --i > 0)
UDELAY (20);
if (!i)
- printf("%s: the chip cannot lock the frequency\n",
- sym_name(np));
+ device_printf(np->device,
+ "the chip cannot lock the frequency\n");
} else
UDELAY (20);
OUTB(nc_stest3, HSC); /* Halt the scsi clock */
@@ -6911,8 +6911,8 @@ static unsigned getfreq (hcb_p np, int gen)
f = ms ? ((1 << gen) * 4340) / ms : 0;
if (sym_verbose >= 2)
- printf ("%s: Delay (GEN=%d): %u msec, %u KHz\n",
- sym_name(np), gen, ms, f);
+ device_printf(np->device, "Delay (GEN=%d): %u msec, %u KHz\n",
+ gen, ms, f);
return f;
}
@@ -6954,7 +6954,7 @@ static void sym_getclock (hcb_p np, int mult)
*/
if (mult > 1 && (stest1 & (DBLEN+DBLSEL)) == DBLEN+DBLSEL) {
if (sym_verbose >= 2)
- printf ("%s: clock multiplier found\n", sym_name(np));
+ device_printf(np->device, "clock multiplier found\n");
np->multiplier = mult;
}
@@ -6968,7 +6968,7 @@ static void sym_getclock (hcb_p np, int mult)
f1 = sym_getfreq (np);
if (sym_verbose)
- printf ("%s: chip clock is %uKHz\n", sym_name(np), f1);
+ device_printf(np->device, "chip clock is %uKHz\n", f1);
if (f1 < 45000) f1 = 40000;
else if (f1 < 55000) f1 = 50000;
@@ -6976,8 +6976,8 @@ static void sym_getclock (hcb_p np, int mult)
if (f1 < 80000 && mult > 1) {
if (sym_verbose >= 2)
- printf ("%s: clock multiplier assumed\n",
- sym_name(np));
+ device_printf(np->device,
+ "clock multiplier assumed\n");
np->multiplier = mult;
}
} else {
@@ -7146,7 +7146,7 @@ static void sym_complete_error (hcb_p np, ccb_p cp)
sense_returned;
else
csio->sense_resid = 0;
- bcopy(cp->sns_bbuf, &csio->sense_data,
+ memcpy(&csio->sense_data, cp->sns_bbuf,
MIN(csio->sense_len, sense_returned));
#if 0
/*
@@ -7631,7 +7631,7 @@ static int sym_setup_cdb(hcb_p np, struct ccb_scsiio *csio, ccb_p cp)
/* CDB is a pointer */
if (!(ccb_h->flags & CAM_CDB_PHYS)) {
/* CDB pointer is virtual */
- bcopy(csio->cdb_io.cdb_ptr, cp->cdb_buf, cmd_len);
+ memcpy(cp->cdb_buf, csio->cdb_io.cdb_ptr, cmd_len);
cmd_ba = CCB_BA (cp, cdb_buf[0]);
} else {
/* CDB pointer is physical */
@@ -7644,7 +7644,7 @@ static int sym_setup_cdb(hcb_p np, struct ccb_scsiio *csio, ccb_p cp)
}
} else {
/* CDB is in the CAM ccb (buffer) */
- bcopy(csio->cdb_io.cdb_bytes, cp->cdb_buf, cmd_len);
+ memcpy(cp->cdb_buf, csio->cdb_io.cdb_bytes, cmd_len);
cmd_ba = CCB_BA (cp, cdb_buf[0]);
}
@@ -7858,9 +7858,9 @@ sym_fast_scatter_sg_physical(hcb_p np, ccb_p cp,
data->addr = cpu_to_scr(psegs2->ds_addr);
data->size = cpu_to_scr(psegs2->ds_len);
if (DEBUG_FLAGS & DEBUG_SCATTER) {
- printf ("%s scatter: paddr=%lx len=%ld\n",
- sym_name(np), (long) psegs2->ds_addr,
- (long) psegs2->ds_len);
+ device_printf(np->device,
+ "scatter: paddr=%lx len=%ld\n",
+ (long)psegs2->ds_addr, (long)psegs2->ds_len);
}
if (psegs2 != psegs) {
--data;
@@ -7895,8 +7895,8 @@ sym_scatter_sg_physical(hcb_p np, ccb_p cp, bus_dma_segment_t *psegs, int nsegs)
pn = ps;
k = pe - pn;
if (DEBUG_FLAGS & DEBUG_SCATTER) {
- printf ("%s scatter: paddr=%lx len=%ld\n",
- sym_name(np), pn, k);
+ device_printf(np->device,
+ "scatter: paddr=%lx len=%ld\n", pn, k);
}
cp->phys.data[s].addr = cpu_to_scr(pn);
cp->phys.data[s].size = cpu_to_scr(k);
@@ -8232,6 +8232,7 @@ sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts)
static device_method_t sym_pci_methods[] = {
DEVMETHOD(device_probe, sym_pci_probe),
DEVMETHOD(device_attach, sym_pci_attach),
+ DEVMETHOD(device_detach, sym_pci_detach),
DEVMETHOD_END
};
@@ -8521,16 +8522,15 @@ sym_pci_attach(device_t dev)
* Alloc/get/map/retrieve the corresponding resources.
*/
if (np->features & (FE_RAM|FE_RAM8K)) {
- int regs_id = SYM_PCI_RAM;
+ i = SYM_PCI_RAM;
if (np->features & FE_64BIT)
- regs_id = SYM_PCI_RAM64;
- np->ram_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
- &regs_id, RF_ACTIVE);
+ i = SYM_PCI_RAM64;
+ np->ram_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i,
+ RF_ACTIVE);
if (!np->ram_res) {
device_printf(dev,"failed to allocate RAM resources\n");
goto attach_failed;
}
- np->ram_id = regs_id;
np->ram_ba = rman_get_start(np->ram_res);
}
@@ -8631,8 +8631,8 @@ sym_pci_attach(device_t dev)
/*
* Copy scripts to controller instance.
*/
- bcopy(fw->a_base, np->scripta0, np->scripta_sz);
- bcopy(fw->b_base, np->scriptb0, np->scriptb_sz);
+ memcpy(np->scripta0, fw->a_base, np->scripta_sz);
+ memcpy(np->scriptb0, fw->b_base, np->scriptb_sz);
/*
* Setup variable parts in scripts and compute
@@ -8735,21 +8735,25 @@ sym_pci_attach(device_t dev)
*/
attach_failed:
if (np)
- sym_pci_free(np);
+ sym_pci_detach(dev);
return ENXIO;
}
/*
- * Free everything that have been allocated for this device.
+ * Detach a device by freeing everything that has been allocated for it.
*/
-static void sym_pci_free(hcb_p np)
+static int
+sym_pci_detach(device_t dev)
{
+ hcb_p np;
SYM_QUEHEAD *qp;
ccb_p cp;
tcb_p tp;
lcb_p lp;
int target, lun;
+ np = device_get_softc(dev);
+
/*
* First free CAM resources.
*/
@@ -8761,16 +8765,15 @@ static void sym_pci_free(hcb_p np)
*/
if (np->ram_res)
bus_release_resource(np->device, SYS_RES_MEMORY,
- np->ram_id, np->ram_res);
+ rman_get_rid(np->ram_res), np->ram_res);
if (np->mmio_res)
bus_release_resource(np->device, SYS_RES_MEMORY,
- SYM_PCI_MMIO, np->mmio_res);
+ rman_get_rid(np->mmio_res), np->mmio_res);
if (np->io_res)
bus_release_resource(np->device, SYS_RES_IOPORT,
- SYM_PCI_IO, np->io_res);
+ rman_get_rid(np->io_res), np->io_res);
if (np->irq_res)
- bus_release_resource(np->device, SYS_RES_IRQ,
- 0, np->irq_res);
+ bus_release_resource(np->device, SYS_RES_IRQ, 0, np->irq_res);
if (np->scriptb0)
sym_mfree_dma(np->scriptb0, np->scriptb_sz, "SCRIPTB0");
@@ -8824,6 +8827,8 @@ static void sym_pci_free(hcb_p np)
SYM_LOCK_DESTROY();
device_set_softc(np->device, NULL);
sym_mfree_dma(np, sizeof(*np), "HCB");
+
+ return (0);
}
/*
@@ -8897,11 +8902,6 @@ static int sym_cam_attach(hcb_p np)
return 1;
fail:
- if (sim)
- cam_sim_free(sim, FALSE);
- if (devq)
- cam_simq_free(devq);
-
SYM_UNLOCK();
sym_cam_free(np);
@@ -8924,15 +8924,16 @@ static void sym_cam_free(hcb_p np)
SYM_LOCK();
+ if (np->path) {
+ xpt_async(AC_LOST_DEVICE, np->path, NULL);
+ xpt_free_path(np->path);
+ np->path = NULL;
+ }
if (np->sim) {
xpt_bus_deregister(cam_sim_path(np->sim));
cam_sim_free(np->sim, /*free_devq*/ TRUE);
np->sim = NULL;
}
- if (np->path) {
- xpt_free_path(np->path);
- np->path = NULL;
- }
SYM_UNLOCK();
}
@@ -9057,14 +9058,14 @@ static void sym_display_Symbios_nvram(hcb_p np, Symbios_nvram *nvram)
int i;
/* display Symbios nvram host data */
- printf("%s: HOST ID=%d%s%s%s%s%s%s\n",
- sym_name(np), nvram->host_id & 0x0f,
- (nvram->flags & SYMBIOS_SCAM_ENABLE) ? " SCAM" :"",
- (nvram->flags & SYMBIOS_PARITY_ENABLE) ? " PARITY" :"",
- (nvram->flags & SYMBIOS_VERBOSE_MSGS) ? " VERBOSE" :"",
- (nvram->flags & SYMBIOS_CHS_MAPPING) ? " CHS_ALT" :"",
- (nvram->flags2 & SYMBIOS_AVOID_BUS_RESET)?" NO_RESET" :"",
- (nvram->flags1 & SYMBIOS_SCAN_HI_LO) ? " HI_LO" :"");
+ device_printf(np->device, "HOST ID=%d%s%s%s%s%s%s\n",
+ nvram->host_id & 0x0f,
+ (nvram->flags & SYMBIOS_SCAM_ENABLE) ? " SCAM" : "",
+ (nvram->flags & SYMBIOS_PARITY_ENABLE) ? " PARITY" : "",
+ (nvram->flags & SYMBIOS_VERBOSE_MSGS) ? " VERBOSE" : "",
+ (nvram->flags & SYMBIOS_CHS_MAPPING) ? " CHS_ALT" : "",
+ (nvram->flags2 & SYMBIOS_AVOID_BUS_RESET) ? " NO_RESET" : "",
+ (nvram->flags1 & SYMBIOS_SCAN_HI_LO) ? " HI_LO" : "");
/* display Symbios nvram drive data */
for (i = 0 ; i < 15 ; i++) {
@@ -9102,17 +9103,18 @@ static void sym_display_Tekram_nvram(hcb_p np, Tekram_nvram *nvram)
case 2: rem = " REMOVABLE=all"; break;
}
- printf("%s: HOST ID=%d%s%s%s%s%s%s%s%s%s BOOT DELAY=%d tags=%d\n",
- sym_name(np), nvram->host_id & 0x0f,
- (nvram->flags1 & SYMBIOS_SCAM_ENABLE) ? " SCAM" :"",
- (nvram->flags & TEKRAM_MORE_THAN_2_DRIVES) ? " >2DRIVES" :"",
- (nvram->flags & TEKRAM_DRIVES_SUP_1GB) ? " >1GB" :"",
- (nvram->flags & TEKRAM_RESET_ON_POWER_ON) ? " RESET" :"",
- (nvram->flags & TEKRAM_ACTIVE_NEGATION) ? " ACT_NEG" :"",
- (nvram->flags & TEKRAM_IMMEDIATE_SEEK) ? " IMM_SEEK" :"",
- (nvram->flags & TEKRAM_SCAN_LUNS) ? " SCAN_LUNS" :"",
- (nvram->flags1 & TEKRAM_F2_F6_ENABLED) ? " F2_F6" :"",
- rem, boot_delay, tags);
+ device_printf(np->device,
+ "HOST ID=%d%s%s%s%s%s%s%s%s%s BOOT DELAY=%d tags=%d\n",
+ nvram->host_id & 0x0f,
+ (nvram->flags1 & SYMBIOS_SCAM_ENABLE) ? " SCAM" : "",
+ (nvram->flags & TEKRAM_MORE_THAN_2_DRIVES) ? " >2DRIVES" : "",
+ (nvram->flags & TEKRAM_DRIVES_SUP_1GB) ? " >1GB" : "",
+ (nvram->flags & TEKRAM_RESET_ON_POWER_ON) ? " RESET" : "",
+ (nvram->flags & TEKRAM_ACTIVE_NEGATION) ? " ACT_NEG" : "",
+ (nvram->flags & TEKRAM_IMMEDIATE_SEEK) ? " IMM_SEEK" : "",
+ (nvram->flags & TEKRAM_SCAN_LUNS) ? " SCAN_LUNS" : "",
+ (nvram->flags1 & TEKRAM_F2_F6_ENABLED) ? " F2_F6" : "",
+ rem, boot_delay, tags);
/* display Tekram nvram drive data */
for (i = 0; i <= 15; i++) {
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index e9d664f51a1f..1a2969d6f2d8 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -3987,10 +3987,10 @@ next_code:
break;
case SUSP:
- power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
break;
case STBY:
- power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_STANDBY);
break;
case DBG:
diff --git a/sys/dev/thunderbolt/tb_pcib.c b/sys/dev/thunderbolt/tb_pcib.c
index e6f0115364da..ffb85ebec9ae 100644
--- a/sys/dev/thunderbolt/tb_pcib.c
+++ b/sys/dev/thunderbolt/tb_pcib.c
@@ -119,6 +119,10 @@ tb_pcib_find_ident(device_t dev)
for (n = tb_pcib_identifiers; n->vendor != 0; n++) {
if ((n->vendor != v) || (n->device != d))
continue;
+ /* Only match actual PCI-PCI bridges to avoid conflict with NHI */
+ if (pci_get_class(dev) != PCIC_BRIDGE ||
+ pci_get_subclass(dev) != PCIS_BRIDGE_PCI)
+ continue;
if (((n->subvendor != 0xffff) && (n->subvendor != sv)) ||
((n->subdevice != 0xffff) && (n->subdevice != sd)))
continue;
diff --git a/sys/dev/tpm/tpm20.c b/sys/dev/tpm/tpm20.c
index 6c587818058d..c521ca9dda9d 100644
--- a/sys/dev/tpm/tpm20.c
+++ b/sys/dev/tpm/tpm20.c
@@ -45,6 +45,7 @@ static void tpm20_discard_buffer(void *arg);
#if defined TPM_HARVEST || defined RANDOM_ENABLE_TPM
static void tpm20_harvest(void *arg, int unused);
#endif
+static int tpm20_restart(device_t dev, bool clear);
static int tpm20_save_state(device_t dev, bool suspend);
static d_open_t tpm20_open;
@@ -243,8 +244,30 @@ tpm20_release(struct tpm_sc *sc)
}
int
+tpm20_resume(device_t dev)
+{
+
+ tpm20_restart(dev, false);
+
+#if defined TPM_HARVEST || defined RANDOM_ENABLE_TPM
+ struct tpm_sc *sc;
+
+ sc = device_get_softc(dev);
+ taskqueue_enqueue_timeout(taskqueue_thread, &sc->harvest_task,
+ hz * TPM_HARVEST_INTERVAL);
+#endif
+ return (0);
+}
+
+int
tpm20_suspend(device_t dev)
{
+#if defined TPM_HARVEST || defined RANDOM_ENABLE_TPM
+ struct tpm_sc *sc;
+
+ sc = device_get_softc(dev);
+ taskqueue_drain_timeout(taskqueue_thread, &sc->harvest_task);
+#endif
return (tpm20_save_state(dev, true));
}
@@ -308,6 +331,43 @@ tpm20_harvest(void *arg, int unused)
#endif /* TPM_HARVEST */
static int
+tpm20_restart(device_t dev, bool clear)
+{
+ struct tpm_sc *sc;
+ uint8_t startup_cmd[] = {
+ 0x80, 0x01, /* TPM_ST_NO_SESSIONS tag*/
+ 0x00, 0x00, 0x00, 0x0C, /* cmd length */
+ 0x00, 0x00, 0x01, 0x44, /* cmd TPM_CC_Startup */
+ 0x00, 0x01 /* TPM_SU_STATE */
+ };
+
+ sc = device_get_softc(dev);
+
+ /*
+ * Inform the TPM whether we are resetting or resuming.
+ */
+ if (clear)
+ startup_cmd[11] = 0; /* TPM_SU_CLEAR */
+
+ if (sc == NULL || sc->buf == NULL)
+ return (0);
+
+ sx_xlock(&sc->dev_lock);
+
+ MPASS(sc->pending_data_length == 0);
+ memcpy(sc->buf, startup_cmd, sizeof(startup_cmd));
+
+ /* XXX Ignoring both TPM_TRANSMIT return and tpm's response */
+ TPM_TRANSMIT(sc->dev, sizeof(startup_cmd));
+ sc->pending_data_length = 0;
+ sc->total_length = 0;
+
+ sx_xunlock(&sc->dev_lock);
+
+ return (0);
+}
+
+static int
tpm20_save_state(device_t dev, bool suspend)
{
struct tpm_sc *sc;
@@ -331,8 +391,13 @@ tpm20_save_state(device_t dev, bool suspend)
sx_xlock(&sc->dev_lock);
+ MPASS(sc->pending_data_length == 0);
memcpy(sc->buf, save_cmd, sizeof(save_cmd));
+
+ /* XXX Ignoring both TPM_TRANSMIT return and tpm's response */
TPM_TRANSMIT(sc->dev, sizeof(save_cmd));
+ sc->pending_data_length = 0;
+ sc->total_length = 0;
sx_xunlock(&sc->dev_lock);
diff --git a/sys/dev/tpm/tpm20.h b/sys/dev/tpm/tpm20.h
index b2cfcd4f25bd..96b2920283b6 100644
--- a/sys/dev/tpm/tpm20.h
+++ b/sys/dev/tpm/tpm20.h
@@ -136,6 +136,7 @@ struct tpm_sc {
};
int tpm20_suspend(device_t dev);
+int tpm20_resume(device_t dev);
int tpm20_shutdown(device_t dev);
int32_t tpm20_get_timeout(uint32_t command);
int tpm20_init(struct tpm_sc *sc);
diff --git a/sys/dev/tpm/tpm_crb.c b/sys/dev/tpm/tpm_crb.c
index 28b4f21eccfb..18414a6c799b 100644
--- a/sys/dev/tpm/tpm_crb.c
+++ b/sys/dev/tpm/tpm_crb.c
@@ -75,8 +75,52 @@
#define TPM_CRB_INT_ENABLE_BIT BIT(31)
+struct tpmcrb_sc;
+/* Attach */
+typedef bool (sm_attach_t)(struct tpmcrb_sc *, void *, size_t);
+/* State change notification (timeout == 0 for 'no timeout') */
+typedef bool (sm_statechange_t)(struct tpmcrb_sc *, int);
+
+struct tpmcrb_sm_cfg {
+ sm_attach_t *sm_attach;
+ sm_statechange_t *sm_statechange;
+ sm_statechange_t *sm_cmdready;
+};
+
+static sm_attach_t pluton_attach;
+static sm_statechange_t pluton_doorbell;
+
+static const struct tpmcrb_sm_cfg_map {
+ int acpi_sm;
+ const char *desc;
+ const struct tpmcrb_sm_cfg sm_cfg;
+} tpmcrb_sm_cfg_map[] = {
+ {
+ .acpi_sm = TPM2_START_METHOD_CRB,
+ .desc = "Trusted Platform Module 2.0, CRB mode",
+ .sm_cfg = { NULL }, /* No notifications required */
+ },
+ {
+ .acpi_sm = ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON,
+ .desc = "Trusted Platform Module 2.0, CRB mode (Pluton)",
+ .sm_cfg = {
+ .sm_attach = &pluton_attach,
+ .sm_statechange = &pluton_doorbell,
+ .sm_cmdready = &pluton_doorbell,
+ },
+ },
+};
+
struct tpmcrb_sc {
struct tpm_sc base;
+ const struct tpmcrb_sm_cfg *sm_cfg;
+ union {
+ /* StartMethod data */
+ struct {
+ uint64_t start_reg;
+ uint64_t reply_reg;
+ } pluton;
+ };
bus_size_t cmd_off;
bus_size_t rsp_off;
size_t cmd_buf_size;
@@ -99,23 +143,46 @@ static bool tpmcrb_cancel_cmd(struct tpm_sc *sc);
char *tpmcrb_ids[] = {"MSFT0101", NULL};
+static const struct tpmcrb_sm_cfg_map *
+tpmcrb_acpi_startmethod_cfg(int method)
+{
+ const struct tpmcrb_sm_cfg_map *entry;
+
+ for (size_t i = 0; i < nitems(tpmcrb_sm_cfg_map); i++) {
+ entry = &tpmcrb_sm_cfg_map[i];
+
+ if (method == entry->acpi_sm)
+ return (entry);
+ }
+
+ return (NULL);
+}
+
static int
tpmcrb_acpi_probe(device_t dev)
{
- int err;
+ int err, smethod;
+ const struct tpmcrb_sm_cfg_map *sm_cfg_map;
ACPI_TABLE_TPM23 *tbl;
ACPI_STATUS status;
+
err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmcrb_ids, NULL);
if (err > 0)
return (err);
/*Find TPM2 Header*/
status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) &tbl);
- if(ACPI_FAILURE(status) ||
- tbl->StartMethod != TPM2_START_METHOD_CRB)
+ if (ACPI_FAILURE(status))
+ return (ENXIO);
+
+ smethod = tbl->StartMethod;
+ AcpiPutTable((ACPI_TABLE_HEADER *)tbl);
+
+ sm_cfg_map = tpmcrb_acpi_startmethod_cfg(smethod);
+ if (sm_cfg_map == NULL)
return (ENXIO);
- device_set_desc(dev, "Trusted Platform Module 2.0, CRB mode");
- return (err);
+ device_set_desc(dev, sm_cfg_map->desc);
+ return (0);
}
static ACPI_STATUS
@@ -141,6 +208,40 @@ tpmcrb_fix_buff_offsets(ACPI_RESOURCE *res, void *arg)
return (AE_OK);
}
+static bool
+tpmcrb_attach_startmethod(struct tpmcrb_sc *crb_sc)
+{
+ const struct tpmcrb_sm_cfg_map *sm_cfg_map;
+ const struct tpmcrb_sm_cfg *sm_cfg;
+ ACPI_TABLE_TPM23 *tbl;
+ void *smdata;
+ ACPI_STATUS status;
+ bool ret;
+
+ /*
+ * Grab what we need from the StartMethod.
+ */
+ status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **)(void **)&tbl);
+ if (ACPI_FAILURE(status))
+ return (false);
+
+ sm_cfg_map = tpmcrb_acpi_startmethod_cfg(tbl->StartMethod);
+ MPASS(sm_cfg_map != NULL);
+ sm_cfg = &sm_cfg_map->sm_cfg;
+
+ crb_sc->sm_cfg = sm_cfg;
+ smdata = tbl + 1;
+ if (sm_cfg->sm_attach != NULL) {
+ ret = (*sm_cfg->sm_attach)(crb_sc, smdata,
+ tbl->Header.Length - sizeof(*tbl));
+ } else {
+ ret = true;
+ }
+
+ AcpiPutTable((ACPI_TABLE_HEADER *)tbl);
+ return (ret);
+}
+
static int
tpmcrb_attach(device_t dev)
{
@@ -166,6 +267,11 @@ tpmcrb_attach(device_t dev)
return (ENXIO);
}
+ if (!tpmcrb_attach_startmethod(crb_sc)) {
+ tpmcrb_detach(dev);
+ return (ENXIO);
+ }
+
if(!tpmcrb_request_locality(sc, 0)) {
tpmcrb_detach(dev);
return (ENXIO);
@@ -302,6 +408,30 @@ tpmcrb_cancel_cmd(struct tpm_sc *sc)
}
static bool
+tpmcrb_notify_cmdready(struct tpmcrb_sc *crb_sc, int timeout)
+{
+ sm_statechange_t *cmdready_fn;
+
+ cmdready_fn = crb_sc->sm_cfg->sm_cmdready;
+ if (cmdready_fn == NULL)
+ return (true);
+
+ return ((*cmdready_fn)(crb_sc, timeout));
+}
+
+static bool
+tpmcrb_notify_state_changing(struct tpmcrb_sc *crb_sc, int timeout)
+{
+ sm_statechange_t *statechange_fn;
+
+ statechange_fn = crb_sc->sm_cfg->sm_statechange;
+ if (statechange_fn == NULL)
+ return (true);
+
+ return ((*statechange_fn)(crb_sc, timeout));
+}
+
+static bool
tpmcrb_state_idle(struct tpmcrb_sc *crb_sc, bool wait)
{
struct tpm_sc *sc;
@@ -312,6 +442,9 @@ tpmcrb_state_idle(struct tpmcrb_sc *crb_sc, bool wait)
sc = &crb_sc->base;
OR4(sc, TPM_CRB_CTRL_REQ, TPM_CRB_CTRL_REQ_GO_IDLE);
+ if (!tpmcrb_notify_state_changing(crb_sc, timeout))
+ return (false);
+
if (timeout > 0) {
mask = TPM_CRB_CTRL_STS_IDLE_BIT;
if (!tpm_wait_for_u32(sc, TPM_CRB_CTRL_STS, mask, mask,
@@ -333,6 +466,9 @@ tpmcrb_state_ready(struct tpmcrb_sc *crb_sc, bool wait)
sc = &crb_sc->base;
OR4(sc, TPM_CRB_CTRL_REQ, TPM_CRB_CTRL_REQ_GO_READY);
+ if (!tpmcrb_notify_state_changing(crb_sc, timeout))
+ return (false);
+
if (timeout > 0) {
mask = TPM_CRB_CTRL_REQ_GO_READY;
if (!tpm_wait_for_u32(sc, TPM_CRB_CTRL_STS, mask, !mask,
@@ -406,6 +542,13 @@ tpmcrb_transmit(device_t dev, size_t length)
TPM_WRITE_4(dev, TPM_CRB_CTRL_START, TPM_CRB_CTRL_START_CMD);
TPM_WRITE_BARRIER(dev, TPM_CRB_CTRL_START, 4);
+ if (!tpmcrb_notify_cmdready(crb_sc, timeout)) {
+ device_printf(dev,
+ "Timeout while waiting for device to ready\n");
+ if (!tpmcrb_cancel_cmd(sc))
+ return (EIO);
+ }
+
mask = ~0;
if (!tpm_wait_for_u32(sc, TPM_CRB_CTRL_START, mask, ~mask, timeout)) {
device_printf(dev,
@@ -429,6 +572,10 @@ tpmcrb_transmit(device_t dev, size_t length)
bus_read_region_stream_1(sc->mem_res, crb_sc->rsp_off + TPM_HEADER_SIZE,
&sc->buf[TPM_HEADER_SIZE], bytes_available - TPM_HEADER_SIZE);
+ /*
+ * No need to wait for the transition to idle on the way out, we can
+ * relinquish locality right away.
+ */
if (!tpmcrb_state_idle(crb_sc, false)) {
device_printf(dev,
"Failed to transition to idle state post-send\n");
@@ -442,6 +589,61 @@ tpmcrb_transmit(device_t dev, size_t length)
return (0);
}
+/* StartMethod Implementation Details */
+
+/** Pluton **/
+struct tpmcrb_startmethod_pluton {
+ uint64_t sm_startaddr;
+ uint64_t sm_replyaddr;
+};
+
+static bool
+pluton_attach(struct tpmcrb_sc *crb_sc, void *smdataregion, size_t datasz)
+{
+ struct tpmcrb_startmethod_pluton *smdata;
+ struct tpm_sc *sc;
+ rman_res_t base_addr, end_addr;
+
+ if (datasz < sizeof(*smdata))
+ return (false);
+
+ smdata = smdataregion;
+ sc = &crb_sc->base;
+
+ base_addr = rman_get_start(sc->mem_res);
+ end_addr = rman_get_end(sc->mem_res);
+ /* Sanity check */
+ if (smdata->sm_startaddr < base_addr ||
+ smdata->sm_startaddr > end_addr ||
+ smdata->sm_replyaddr < base_addr ||
+ smdata->sm_replyaddr > end_addr)
+ return (false);
+
+ crb_sc->pluton.start_reg = smdata->sm_startaddr - base_addr;
+ crb_sc->pluton.reply_reg = smdata->sm_replyaddr - base_addr;
+ return (true);
+}
+
+static bool
+pluton_doorbell(struct tpmcrb_sc *crb_sc, int timeout)
+{
+ struct tpm_sc *sc;
+ device_t dev;
+
+ sc = &crb_sc->base;
+ dev = sc->dev;
+ TPM_WRITE_4(dev, crb_sc->pluton.start_reg, 1);
+ TPM_WRITE_BARRIER(dev, crb_sc->pluton.start_reg, 4);
+
+ if (timeout > 0) {
+ if (!tpm_wait_for_u32(sc, crb_sc->pluton.reply_reg, ~0U, 1,
+ timeout))
+ return (false);
+ }
+
+ return (true);
+}
+
/* ACPI Driver */
static device_method_t tpmcrb_methods[] = {
DEVMETHOD(device_probe, tpmcrb_acpi_probe),
@@ -449,6 +651,7 @@ static device_method_t tpmcrb_methods[] = {
DEVMETHOD(device_detach, tpmcrb_detach),
DEVMETHOD(device_shutdown, tpm20_shutdown),
DEVMETHOD(device_suspend, tpm20_suspend),
+ DEVMETHOD(device_resume, tpm20_resume),
DEVMETHOD(tpm_transmit, tpmcrb_transmit),
{0, 0}
};
diff --git a/sys/dev/tpm/tpm_tis_core.c b/sys/dev/tpm/tpm_tis_core.c
index 4159de4daf3b..34ecfcc283b1 100644
--- a/sys/dev/tpm/tpm_tis_core.c
+++ b/sys/dev/tpm/tpm_tis_core.c
@@ -487,6 +487,7 @@ static device_method_t tpmtis_methods[] = {
DEVMETHOD(device_detach, tpmtis_detach),
DEVMETHOD(device_shutdown, tpm20_shutdown),
DEVMETHOD(device_suspend, tpm20_suspend),
+ DEVMETHOD(device_resume, tpm20_resume),
DEVMETHOD(tpm_transmit, tpmtis_transmit),
DEVMETHOD_END
};
diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c
index d15d1d0c6ac2..7f0f730b3b6e 100644
--- a/sys/dev/uart/uart_tty.c
+++ b/sys/dev/uart/uart_tty.c
@@ -447,8 +447,9 @@ uart_tty_detach(struct uart_softc *sc)
tp = sc->sc_u.u_tty.tp;
- tty_lock(tp);
swi_remove(sc->sc_softih);
+
+ tty_lock(tp);
tty_rel_gone(tp);
return (0);
diff --git a/sys/dev/ufshci/ufshci_dev.c b/sys/dev/ufshci/ufshci_dev.c
index 406130c537a7..3167945b53b6 100644
--- a/sys/dev/ufshci/ufshci_dev.c
+++ b/sys/dev/ufshci/ufshci_dev.c
@@ -273,40 +273,31 @@ ufshci_dev_init_unipro(struct ufshci_controller *ctrlr)
uint32_t pa_granularity, peer_pa_granularity;
uint32_t t_activate, pear_t_activate;
- /*
- * Unipro Version:
- * - 7~15 = Above 2.0, 6 = 2.0, 5 = 1.8, 4 = 1.61, 3 = 1.6, 2 = 1.41,
- * 1 = 1.40, 0 = Reserved
- */
- if (ufshci_uic_send_dme_get(ctrlr, PA_LocalVerInfo,
- &ctrlr->unipro_version))
- return (ENXIO);
- if (ufshci_uic_send_dme_get(ctrlr, PA_RemoteVerInfo,
- &ctrlr->ufs_dev.unipro_version))
- return (ENXIO);
-
- /*
- * PA_Granularity: Granularity for PA_TActivate and PA_Hibern8Time
- * - 1=1us, 2=4us, 3=8us, 4=16us, 5=32us, 6=100us
- */
- if (ufshci_uic_send_dme_get(ctrlr, PA_Granularity, &pa_granularity))
- return (ENXIO);
- if (ufshci_uic_send_dme_peer_get(ctrlr, PA_Granularity,
- &peer_pa_granularity))
- return (ENXIO);
+ if (ctrlr->quirks & UFSHCI_QUIRK_LONG_PEER_PA_TACTIVATE) {
+ /*
+ * PA_Granularity: Granularity for PA_TActivate and
+ * PA_Hibern8Time
+ * - 1=1us, 2=4us, 3=8us, 4=16us, 5=32us, 6=100us
+ */
+ if (ufshci_uic_send_dme_get(ctrlr, PA_Granularity,
+ &pa_granularity))
+ return (ENXIO);
+ if (ufshci_uic_send_dme_peer_get(ctrlr, PA_Granularity,
+ &peer_pa_granularity))
+ return (ENXIO);
- /*
- * PA_TActivate: Time to wait before activating a burst in order to
- * wake-up peer M-RX
- * UniPro automatically sets timing information such as PA_TActivate
- * through the PACP_CAP_EXT1_ind command during Link Startup operation.
- */
- if (ufshci_uic_send_dme_get(ctrlr, PA_TActivate, &t_activate))
- return (ENXIO);
- if (ufshci_uic_send_dme_peer_get(ctrlr, PA_TActivate, &pear_t_activate))
- return (ENXIO);
+ /*
+ * PA_TActivate: Time to wait before activating a burst in order
+ * to wake-up peer M-RX UniPro automatically sets timing
+ * information such as PA_TActivate through the
+ * PACP_CAP_EXT1_ind command during Link Startup operation.
+ */
+ if (ufshci_uic_send_dme_get(ctrlr, PA_TActivate, &t_activate))
+ return (ENXIO);
+ if (ufshci_uic_send_dme_peer_get(ctrlr, PA_TActivate,
+ &pear_t_activate))
+ return (ENXIO);
- if (ctrlr->quirks & UFSHCI_QUIRK_LONG_PEER_PA_TACTIVATE) {
/*
* Intel Lake-field UFSHCI has a quirk. We need to add 200us to
* the PEER's PA_TActivate.
diff --git a/sys/dev/ufshci/ufshci_private.h b/sys/dev/ufshci/ufshci_private.h
index b57142bf58fc..1634cf51c9fb 100644
--- a/sys/dev/ufshci/ufshci_private.h
+++ b/sys/dev/ufshci/ufshci_private.h
@@ -278,8 +278,6 @@ struct ufshci_device {
struct ufshci_device_descriptor dev_desc;
struct ufshci_geometry_descriptor geo_desc;
- uint32_t unipro_version;
-
/* WriteBooster */
bool is_wb_enabled;
bool is_wb_flush_enabled;
@@ -398,7 +396,6 @@ struct ufshci_controller {
/* UFS Interconnect Layer (UIC) */
struct mtx uic_cmd_lock;
- uint32_t unipro_version;
uint8_t hs_gear;
uint32_t tx_lanes;
uint32_t rx_lanes;
diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c
index bee1fff858ff..404f3e99d1e2 100644
--- a/sys/dev/ufshci/ufshci_sim.c
+++ b/sys/dev/ufshci/ufshci_sim.c
@@ -494,7 +494,7 @@ ufshci_sim_send_ssu(struct ufshci_controller *ctrlr, bool start,
return ENOMEM;
}
- scsi_start_stop(&ccb->csio,
+ scsi_start_stop_pc(&ccb->csio,
/*retries*/ 4,
/*cbfcnp*/ NULL,
/*tag_action*/ MSG_SIMPLE_Q_TAG,
diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c
index c3f7b622d687..257051e6e379 100644
--- a/sys/dev/usb/net/if_ure.c
+++ b/sys/dev/usb/net/if_ure.c
@@ -24,6 +24,8 @@
* SUCH DAMAGE.
*/
+#include "opt_inet6.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -44,6 +46,10 @@
/* needed for checksum offload */
#include <netinet/in.h>
#include <netinet/ip.h>
+#ifdef INET6
+#include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
+#endif
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
@@ -62,8 +68,6 @@
#include "miibus_if.h"
-#include "opt_inet6.h"
-
#ifdef USB_DEBUG
static int ure_debug = 0;
@@ -1015,6 +1019,7 @@ ure_attach_post_sub(struct usb_ether *ue)
if_sethwassist(ifp, CSUM_IP|CSUM_IP_UDP|CSUM_IP_TCP);
#ifdef INET6
if_setcapabilitiesbit(ifp, IFCAP_HWCSUM_IPV6, 0);
+ if_sethwassistbits(ifp, CSUM_IP6_UDP|CSUM_IP6_TCP, 0);
#endif
if_setcapenable(ifp, if_getcapabilities(ifp));
@@ -1463,6 +1468,7 @@ ure_ioctl(if_t ifp, u_long cmd, caddr_t data)
if ((mask & IFCAP_TXCSUM) != 0 &&
(if_getcapabilities(ifp) & IFCAP_TXCSUM) != 0) {
if_togglecapenable(ifp, IFCAP_TXCSUM);
+ if_togglehwassist(ifp, CSUM_IP|CSUM_IP_UDP|CSUM_IP_TCP);
}
if ((mask & IFCAP_RXCSUM) != 0 &&
(if_getcapabilities(ifp) & IFCAP_RXCSUM) != 0) {
@@ -1471,6 +1477,7 @@ ure_ioctl(if_t ifp, u_long cmd, caddr_t data)
if ((mask & IFCAP_TXCSUM_IPV6) != 0 &&
(if_getcapabilities(ifp) & IFCAP_TXCSUM_IPV6) != 0) {
if_togglecapenable(ifp, IFCAP_TXCSUM_IPV6);
+ if_togglehwassist(ifp, CSUM_IP6_UDP|CSUM_IP6_TCP);
}
if ((mask & IFCAP_RXCSUM_IPV6) != 0 &&
(if_getcapabilities(ifp) & IFCAP_RXCSUM_IPV6) != 0) {
@@ -2124,41 +2131,33 @@ ure_rtl8152_nic_reset(struct ure_softc *sc)
static void
ure_rxcsum(int capenb, struct ure_rxpkt *rp, struct mbuf *m)
{
- int flags;
uint32_t csum, misc;
- int tcp, udp;
m->m_pkthdr.csum_flags = 0;
- if (!(capenb & IFCAP_RXCSUM))
- return;
-
csum = le32toh(rp->ure_csum);
misc = le32toh(rp->ure_misc);
- tcp = udp = 0;
-
- flags = 0;
- if (csum & URE_RXPKT_IPV4_CS)
- flags |= CSUM_IP_CHECKED;
- else if (csum & URE_RXPKT_IPV6_CS)
- flags = 0;
-
- tcp = rp->ure_csum & URE_RXPKT_TCP_CS;
- udp = rp->ure_csum & URE_RXPKT_UDP_CS;
+ if ((capenb & IFCAP_RXCSUM) == 0 &&
+ (csum & URE_RXPKT_IPV4_CS) != 0)
+ return;
+ if ((capenb & IFCAP_RXCSUM_IPV6) == 0 &&
+ (csum & URE_RXPKT_IPV6_CS) != 0)
+ return;
- if (__predict_true((flags & CSUM_IP_CHECKED) &&
- !(misc & URE_RXPKT_IP_F))) {
- flags |= CSUM_IP_VALID;
+ if ((csum & URE_RXPKT_IPV4_CS) != 0) {
+ m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED;
+ if (__predict_true((misc & URE_RXPKT_IP_F) == 0))
+ m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
}
if (__predict_true(
- (tcp && !(misc & URE_RXPKT_TCP_F)) ||
- (udp && !(misc & URE_RXPKT_UDP_F)))) {
- flags |= CSUM_DATA_VALID|CSUM_PSEUDO_HDR;
+ ((rp->ure_csum & URE_RXPKT_TCP_CS) != 0 &&
+ (misc & URE_RXPKT_TCP_F) == 0) ||
+ ((rp->ure_csum & URE_RXPKT_UDP_CS) != 0 &&
+ (misc & URE_RXPKT_UDP_F) == 0))) {
+ m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
m->m_pkthdr.csum_data = 0xFFFF;
}
-
- m->m_pkthdr.csum_flags = flags;
}
/*
@@ -2176,7 +2175,6 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)
struct ip ip;
struct ether_header *eh;
int flags;
- uint32_t data;
uint32_t reg;
int l3off, l4off;
uint16_t type;
@@ -2211,10 +2209,9 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)
if (flags & CSUM_IP)
reg |= URE_TXPKT_IPV4_CS;
- data = m->m_pkthdr.csum_data;
if (flags & (CSUM_IP_TCP | CSUM_IP_UDP)) {
m_copydata(m, l3off, sizeof ip, (caddr_t)&ip);
- l4off = l3off + (ip.ip_hl << 2) + data;
+ l4off = l3off + (ip.ip_hl << 2);
if (__predict_false(l4off > URE_L4_OFFSET_MAX))
return (1);
@@ -2227,7 +2224,9 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)
}
#ifdef INET6
else if (flags & (CSUM_IP6_TCP | CSUM_IP6_UDP)) {
- l4off = l3off + data;
+ l4off = ip6_lasthdr(m, l3off, IPPROTO_IPV6, NULL);
+ if (__predict_false(l4off < 0))
+ return (1);
if (__predict_false(l4off > URE_L4_OFFSET_MAX))
return (1);
diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h
index a6c3c8030c73..3e972f876c6a 100644
--- a/sys/dev/usb/usb.h
+++ b/sys/dev/usb/usb.h
@@ -541,7 +541,7 @@ struct usb_endpoint_descriptor {
#define UE_XFERTYPE 0x03
#define UE_CONTROL 0x00
#define UE_ISOCHRONOUS 0x01
-#define UE_BULK 0x02
+#define UE_BULK 0x02
#define UE_INTERRUPT 0x03
#define UE_BULK_INTR 0xfe /* for internal use only! */
#define UE_TYPE_ANY 0xff /* for internal use only! */
diff --git a/sys/dev/virtio/gpu/virtio_gpu.c b/sys/dev/virtio/gpu/virtio_gpu.c
index 668eb170304a..b95bae9fe286 100644
--- a/sys/dev/virtio/gpu/virtio_gpu.c
+++ b/sys/dev/virtio/gpu/virtio_gpu.c
@@ -445,21 +445,33 @@ vtgpu_alloc_virtqueue(struct vtgpu_softc *sc)
}
static int
-vtgpu_req_resp(struct vtgpu_softc *sc, void *req, size_t reqlen,
- void *resp, size_t resplen)
+vtgpu_req_resp2(struct vtgpu_softc *sc, void *req1, size_t req1len,
+ void *req2, size_t req2len, void *resp, size_t resplen)
{
struct sglist sg;
- struct sglist_seg segs[2];
- int error;
+ struct sglist_seg segs[3];
+ int error, rcount;
- sglist_init(&sg, 2, segs);
+ sglist_init(&sg, 3, segs);
- error = sglist_append(&sg, req, reqlen);
+ rcount = 1;
+ error = sglist_append(&sg, req1, req1len);
if (error != 0) {
device_printf(sc->vtgpu_dev,
- "Unable to append the request to the sglist: %d\n", error);
+ "Unable to append the request to the sglist: %d\n",
+ error);
return (error);
}
+ if (req2 != NULL) {
+ error = sglist_append(&sg, req2, req2len);
+ if (error != 0) {
+ device_printf(sc->vtgpu_dev,
+ "Unable to append the request to the sglist: %d\n",
+ error);
+ return (error);
+ }
+ rcount++;
+ }
error = sglist_append(&sg, resp, resplen);
if (error != 0) {
device_printf(sc->vtgpu_dev,
@@ -467,7 +479,7 @@ vtgpu_req_resp(struct vtgpu_softc *sc, void *req, size_t reqlen,
error);
return (error);
}
- error = virtqueue_enqueue(sc->vtgpu_ctrl_vq, resp, &sg, 1, 1);
+ error = virtqueue_enqueue(sc->vtgpu_ctrl_vq, resp, &sg, rcount, 1);
if (error != 0) {
device_printf(sc->vtgpu_dev, "Enqueue failed: %d\n", error);
return (error);
@@ -480,6 +492,13 @@ vtgpu_req_resp(struct vtgpu_softc *sc, void *req, size_t reqlen,
}
static int
+vtgpu_req_resp(struct vtgpu_softc *sc, void *req, size_t reqlen,
+ void *resp, size_t resplen)
+{
+ return (vtgpu_req_resp2(sc, req, reqlen, NULL, 0, resp, resplen));
+}
+
+static int
vtgpu_get_display_info(struct vtgpu_softc *sc)
{
struct {
@@ -559,9 +578,15 @@ static int
vtgpu_attach_backing(struct vtgpu_softc *sc)
{
struct {
+ /*
+ * Split the backing and mem request arguments as some
+ * hypervisors, e.g. Parallels Desktop, don't work when
+ * they are enqueued together.
+ */
struct {
struct virtio_gpu_resource_attach_backing backing;
- struct virtio_gpu_mem_entry mem[1];
+ char pad;
+ struct virtio_gpu_mem_entry mem;
} req;
char pad;
struct virtio_gpu_ctrl_hdr resp;
@@ -577,11 +602,11 @@ vtgpu_attach_backing(struct vtgpu_softc *sc)
s.req.backing.resource_id = htole32(VTGPU_RESOURCE_ID);
s.req.backing.nr_entries = htole32(1);
- s.req.mem[0].addr = htole64(sc->vtgpu_fb_info.fb_pbase);
- s.req.mem[0].length = htole32(sc->vtgpu_fb_info.fb_size);
+ s.req.mem.addr = htole64(sc->vtgpu_fb_info.fb_pbase);
+ s.req.mem.length = htole32(sc->vtgpu_fb_info.fb_size);
- error = vtgpu_req_resp(sc, &s.req, sizeof(s.req), &s.resp,
- sizeof(s.resp));
+ error = vtgpu_req_resp2(sc, &s.req.backing, sizeof(s.req.backing),
+ &s.req.mem, sizeof(s.req.mem), &s.resp, sizeof(s.resp));
if (error != 0)
return (error);
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index 19775416f8d4..da89dea03f87 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -2059,8 +2059,16 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m,
}
}
- m->m_pkthdr.flowid = rxq->vtnrx_id;
- M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
+ if (sc->vtnet_act_vq_pairs == 1) {
+ /*
+ * When RSS is not needed (one active rx queue), let the upper
+ * layer know and react.
+ */
+ M_HASHTYPE_CLEAR(m);
+ } else {
+ m->m_pkthdr.flowid = rxq->vtnrx_id;
+ M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
+ }
if (hdr->flags &
(VIRTIO_NET_HDR_F_NEEDS_CSUM | VIRTIO_NET_HDR_F_DATA_VALID)) {
diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c
index aa84d3970698..2b276a60aa9a 100644
--- a/sys/dev/virtio/p9fs/virtio_p9fs.c
+++ b/sys/dev/virtio/p9fs/virtio_p9fs.c
@@ -84,6 +84,8 @@ static struct virtio_feature_desc virtio_9p_feature_desc[] = {
{ 0, NULL }
};
+VIRTIO_SIMPLE_PNPINFO(virtio_p9fs, VIRTIO_ID_9P, "VirtIO 9P Transport");
+
/* We don't currently allow canceling of virtio requests */
static int
vt9p_cancel(void *handle, struct p9_req_t *req)
@@ -257,13 +259,7 @@ vt9p_alloc_virtqueue(struct vt9p_softc *sc)
static int
vt9p_probe(device_t dev)
{
-
- /* If the virtio device type is a 9P device, then we claim and attach it */
- if (virtio_get_device_type(dev) != VIRTIO_ID_9P)
- return (ENXIO);
- device_set_desc(dev, "VirtIO 9P Transport");
-
- return (BUS_PROBE_DEFAULT);
+ return (VIRTIO_SIMPLE_PROBE(dev, virtio_p9fs));
}
static void
diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c
index a5322f05d28f..09fd3a9048bd 100644
--- a/sys/dev/vmm/vmm_dev.c
+++ b/sys/dev/vmm/vmm_dev.c
@@ -876,8 +876,7 @@ vmmdev_destroy(struct vmmdev_softc *sc)
free(dsc, M_VMMDEV);
}
- if (sc->vm != NULL)
- vm_destroy(sc->vm);
+ vm_destroy(sc->vm);
chgvmmcnt(sc->ucred->cr_ruidinfo, -1, 0);
crfree(sc->ucred);
@@ -990,9 +989,15 @@ vmmdev_create(const char *name, uint32_t flags, struct ucred *cred)
return (EEXIST);
}
+ if (!chgvmmcnt(cred->cr_ruidinfo, 1, vm_maxvmms)) {
+ sx_xunlock(&vmmdev_mtx);
+ return (ENOMEM);
+ }
+
error = vm_create(name, &vm);
if (error != 0) {
sx_xunlock(&vmmdev_mtx);
+ (void)chgvmmcnt(cred->cr_ruidinfo, -1, 0);
return (error);
}
sc = vmmdev_alloc(vm, cred);
@@ -1015,12 +1020,6 @@ vmmdev_create(const char *name, uint32_t flags, struct ucred *cred)
vmmdev_destroy(sc);
return (error);
}
- if (!chgvmmcnt(cred->cr_ruidinfo, 1, vm_maxvmms)) {
- sx_xunlock(&vmmdev_mtx);
- destroy_dev(cdev);
- vmmdev_destroy(sc);
- return (ENOMEM);
- }
sc->cdev = cdev;
sx_xunlock(&vmmdev_mtx);
return (0);
@@ -1228,9 +1227,11 @@ vmm_handler(module_t mod, int what, void *arg)
if (error == 0)
vmm_initialized = true;
else {
- error = vmmdev_cleanup();
- KASSERT(error == 0,
- ("%s: vmmdev_cleanup failed: %d", __func__, error));
+ int error1 __diagused;
+
+ error1 = vmmdev_cleanup();
+ KASSERT(error1 == 0,
+ ("%s: vmmdev_cleanup failed: %d", __func__, error1));
}
break;
case MOD_UNLOAD:
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index a6a5f0eeff9d..b9159a73ad79 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -804,11 +804,11 @@ vt_machine_kbdevent(struct vt_device *vd, int c)
return (1);
case SPCLKEY | STBY: /* XXX Not present in kbdcontrol parser. */
/* Put machine into Stand-By mode. */
- power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_STANDBY);
return (1);
case SPCLKEY | SUSP: /* kbdmap(5) keyword `susp`. */
/* Suspend machine. */
- power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
return (1);
}
@@ -952,6 +952,9 @@ vt_processkey(keyboard_t *kbd, struct vt_device *vd, int c)
VT_UNLOCK(vd);
break;
}
+ case BKEY | BTAB: /* Back tab (usually, shift+tab). */
+ terminal_input_special(vw->vw_terminal, TKEY_BTAB);
+ break;
case FKEY | F(1): case FKEY | F(2): case FKEY | F(3):
case FKEY | F(4): case FKEY | F(5): case FKEY | F(6):
case FKEY | F(7): case FKEY | F(8): case FKEY | F(9):
@@ -1964,6 +1967,9 @@ vtterm_cngetc(struct terminal *tm)
VTBUF_SLCK_DISABLE(&vw->vw_buf);
}
break;
+ case SPCLKEY | BTAB: /* Back tab (usually, shift+tab). */
+ vw->vw_kbdsq = "\x1b[Z";
+ break;
/* XXX: KDB can handle history. */
case SPCLKEY | FKEY | F(50): /* Arrow up. */
vw->vw_kbdsq = "\x1b[A";
diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c
index 17aedee0e6b0..611314883643 100644
--- a/sys/dev/wg/if_wg.c
+++ b/sys/dev/wg/if_wg.c
@@ -3033,8 +3033,8 @@ wg_clone_create(struct if_clone *ifc, char *name, size_t len,
if_attach(ifp);
bpfattach(ifp, DLT_NULL, sizeof(uint32_t));
#ifdef INET6
- ND_IFINFO(ifp)->flags &= ~ND6_IFF_AUTO_LINKLOCAL;
- ND_IFINFO(ifp)->flags |= ND6_IFF_NO_DAD;
+ if_getinet6(ifp)->nd_flags &= ~ND6_IFF_AUTO_LINKLOCAL;
+ if_getinet6(ifp)->nd_flags |= ND6_IFF_NO_DAD;
#endif
sx_xlock(&wg_sx);
LIST_INSERT_HEAD(&wg_list, sc, sc_entry);