From 8ad5f160bf8427b4bcdd70e8dfbd5379e19de1d9 Mon Sep 17 00:00:00 2001 From: np Date: Fri, 16 Jan 2015 01:32:40 +0000 Subject: [PATCH] Allow cxgbe(4) to be built on i386. Driver attach will succeed only on a subset of i386 systems. --- sys/dev/cxgbe/t4_main.c | 8 ++++++++ sys/dev/cxgbe/t4_mp_ring.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index b51ecc5c2c59..dbd6334903ee 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -668,6 +668,14 @@ t4_attach(device_t dev) goto done; } +#if defined(__i386__) + if ((cpu_feature & CPUID_CX8) == 0) { + device_printf(dev, "64 bit atomics not available.\n"); + rc = ENOTSUP; + goto done; + } +#endif + /* Prepare the firmware for operation */ rc = prep_firmware(sc); if (rc != 0) diff --git a/sys/dev/cxgbe/t4_mp_ring.c b/sys/dev/cxgbe/t4_mp_ring.c index ef09f01b0df4..045a24b87f16 100644 --- a/sys/dev/cxgbe/t4_mp_ring.c +++ b/sys/dev/cxgbe/t4_mp_ring.c @@ -38,6 +38,11 @@ __FBSDID("$FreeBSD$"); #include "t4_mp_ring.h" +#if defined(__i386__) +#define atomic_cmpset_acq_64 atomic_cmpset_64 +#define atomic_cmpset_rel_64 atomic_cmpset_64 +#endif + union ring_state { struct { uint16_t pidx_head;