Browse Source

Merge branch 'opt_sha256d' into bfgminer

Luke Dashjr 11 years ago
parent
commit
b23fbe8e0c
18 changed files with 450 additions and 764 deletions
  1. 18 18
      70-bfgminer.rules.in
  2. 42 35
      Makefile.am
  3. 16 13
      README
  4. 30 32
      api.c
  5. 185 567
      configure.ac
  6. 2 0
      deviceapi.c
  7. 19 18
      driver-cpu.c
  8. 13 1
      driver-cpu.h
  9. 2 0
      driver-dualminer.c
  10. 21 32
      driver-opencl.c
  11. 4 3
      driver-opencl.h
  12. 2 2
      findnonce.c
  13. 3 2
      findnonce.h
  14. 59 33
      miner.c
  15. 5 1
      miner.h
  16. 24 5
      ocl.c
  17. 1 2
      ocl.h
  18. 4 0
      util.c

+ 18 - 18
70-bfgminer.rules.in

@@ -5,32 +5,32 @@ GOTO="bfgminer_end"
 LABEL="bfgminer_start"
 
 @USE_BIFURY_TRUE@ENV{ID_MODEL}=="*bi•fury*", GOTO="bfgminer_add"
-@HAS_BIGPIC_TRUE@ENV{ID_MODEL}=="*Bitfury*BF1*", GOTO="bfgminer_add"
-@HAS_BITFORCE_TRUE@ENV{ID_MODEL}=="*BitFORCE*SHA256*", GOTO="bfgminer_add"
+@USE_BIGPIC_TRUE@ENV{ID_MODEL}=="*Bitfury*BF1*", GOTO="bfgminer_add"
+@USE_BITFORCE_TRUE@ENV{ID_MODEL}=="*BitFORCE*SHA256*", GOTO="bfgminer_add"
 @USE_COINTERRA_TRUE@ENV{ID_MODEL}=="*GoldStrike*", GOTO="bfgminer_add"
 @USE_DRILLBIT_TRUE@ENV{manufacturer}=="*Drillbit*", GOTO="bfgminer_add"
-@HAS_ICARUS_TRUE@ENV{ID_MODEL}=="*Cairnsmore1*", GOTO="bfgminer_add"
-@HAS_ICARUS_TRUE@ENV{ID_MODEL}=="*Block*Erupter*", GOTO="bfgminer_add"
+@USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Cairnsmore1*", GOTO="bfgminer_add"
+@USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Block*Erupter*", GOTO="bfgminer_add"
 @USE_HASHBUSTER_TRUE@ENV{ID_MODEL}=="*HashBuster*", GOTO="bfgminer_add"
 @USE_HASHBUSTERUSB_TRUE@ENV{ID_MODEL}=="*HashBuster*", GOTO="bfgminer_add"
 @USE_HASHFAST_TRUE@ENV{idVendor}=="297c", ENV{manufacturer}=="*HashFast*", GOTO="bfgminer_add"
 @USE_HASHFAST_TRUE@ENV{ID_MODEL}=="*GoldenNonce*", GOTO="bfgminer_add"
-@HAS_KLONDIKE_TRUE@ENV{idVendor}=="04d8", ENV{idProduct}=="f60a", ENV{manufacturer}=="*Klondike*", GOTO="bfgminer_add"
-@HAS_KLONDIKE_TRUE@ENV{idVendor}=="fa05", ENV{idProduct}=="0001", ENV{manufacturer}=="*HashBuster*", GOTO="bfgminer_add"
-@HAS_LITTLEFURY_TRUE@ENV{ID_MODEL}=="*LittleFury*", GOTO="bfgminer_add"
-@HAS_MODMINER_TRUE@ENV{ID_MODEL}=="*ModMiner*", GOTO="bfgminer_add"
-@HAS_NANOFURY_TRUE@ENV{idVendor}=="04d8", ENV{idProduct}=="00de", ENV{ID_MODEL}=="*NanoFury*", GOTO="bfgminer_add"
+@USE_KLONDIKE_TRUE@ENV{idVendor}=="04d8", ENV{idProduct}=="f60a", ENV{manufacturer}=="*Klondike*", GOTO="bfgminer_add"
+@USE_KLONDIKE_TRUE@ENV{idVendor}=="fa05", ENV{idProduct}=="0001", ENV{manufacturer}=="*HashBuster*", GOTO="bfgminer_add"
+@USE_LITTLEFURY_TRUE@ENV{ID_MODEL}=="*LittleFury*", GOTO="bfgminer_add"
+@USE_MODMINER_TRUE@ENV{ID_MODEL}=="*ModMiner*", GOTO="bfgminer_add"
+@USE_NANOFURY_TRUE@ENV{idVendor}=="04d8", ENV{idProduct}=="00de", ENV{ID_MODEL}=="*NanoFury*", GOTO="bfgminer_add"
 @USE_ROCKMINER_TRUE@ENV{ID_MODEL}=="*R-BOX miner*", GOTO="bfgminer_add"
 @USE_ROCKMINER_TRUE@ENV{ID_MODEL}=="*RX-BOX miner*", GOTO="bfgminer_add"
-@HAS_TWINFURY_TRUE@ENV{ID_MODEL}=="*Twinfury*", GOTO="bfgminer_add"
-@HAS_X6500_TRUE@ENV{idVendor}=="0403", ENV{idProduct}=="6001", ENV{ID_MODEL}=="*X6500 FPGA Miner*", GOTO="bfgminer_add"
-@HAS_ZTEX_TRUE@ENV{ID_MODEL}=="*btcminer for ZTEX*", GOTO="bfgminer_add"
+@USE_TWINFURY_TRUE@ENV{ID_MODEL}=="*Twinfury*", GOTO="bfgminer_add"
+@USE_X6500_TRUE@ENV{idVendor}=="0403", ENV{idProduct}=="6001", ENV{ID_MODEL}=="*X6500 FPGA Miner*", GOTO="bfgminer_add"
+@USE_ZTEX_TRUE@ENV{ID_MODEL}=="*btcminer for ZTEX*", GOTO="bfgminer_add"
 
 # The below are broad udev rules that may match devices other than the miners expected.
 # You can uncomment them with the --enable-broad-udevrules configure option.
 
 # Avalon1
-@BROAD_UDEVRULES_TRUE@@HAS_AVALON_TRUE@ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GOTO="bfgminer_add"
+@BROAD_UDEVRULES_TRUE@@USE_AVALON_TRUE@ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GOTO="bfgminer_add"
 # AvalonMM
 @BROAD_UDEVRULES_TRUE@@USE_AVALONMM_TRUE@ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GOTO="bfgminer_add"
 # DualMiner
@@ -38,16 +38,16 @@ LABEL="bfgminer_start"
 # GridSeed
 @BROAD_UDEVRULES_TRUE@@USE_GRIDSEED_TRUE@ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", GOTO="bfgminer_add"
 # Icarus
-@BROAD_UDEVRULES_TRUE@@HAS_ICARUS_TRUE@ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GOTO="bfgminer_add"
+@BROAD_UDEVRULES_TRUE@@USE_ICARUS_TRUE@ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GOTO="bfgminer_add"
 # Cairnsmore1
-@BROAD_UDEVRULES_TRUE@@HAS_ICARUS_TRUE@ATTRS{idVendor}=="067b", ATTRS{idProduct}=="0230", GOTO="bfgminer_add"
-@BROAD_UDEVRULES_TRUE@@HAS_ICARUS_TRUE@ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8350", GOTO="bfgminer_add"
+@BROAD_UDEVRULES_TRUE@@USE_ICARUS_TRUE@ATTRS{idVendor}=="067b", ATTRS{idProduct}=="0230", GOTO="bfgminer_add"
+@BROAD_UDEVRULES_TRUE@@USE_ICARUS_TRUE@ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8350", GOTO="bfgminer_add"
 # Block Erupter and Antminer U*
-@BROAD_UDEVRULES_TRUE@@HAS_ICARUS_TRUE@ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GOTO="bfgminer_add"
+@BROAD_UDEVRULES_TRUE@@USE_ICARUS_TRUE@ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GOTO="bfgminer_add"
 # ZeusMiner
 @BROAD_UDEVRULES_TRUE@@USE_ZEUSMINER_TRUE@ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GOTO="bfgminer_add"
 # Possibly unprogrammed ZTEX
-@BROAD_UDEVRULES_TRUE@@HAS_ZTEX_TRUE@ATTRS{idVendor}=="221a", ATTRS{idProduct}=="0100", GOTO="bfgminer_add"
+@BROAD_UDEVRULES_TRUE@@USE_ZTEX_TRUE@ATTRS{idVendor}=="221a", ATTRS{idProduct}=="0100", GOTO="bfgminer_add"
 # BFx2
 @BROAD_UDEVRULES_TRUE@@USE_BFX_TRUE@ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", GOTO="bfgminer_add"
 # RockMiner

+ 42 - 35
Makefile.am

@@ -131,17 +131,13 @@ bfgminer_CPPFLAGS += $(libevent_CFLAGS)
 endif
 
 
-if HAVE_OPENCL
+if USE_OPENCL
 bfgminer_SOURCES += driver-opencl.h driver-opencl.c
 bfgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
 bfgminer_SOURCES += adl.c adl.h adl_functions.h
 
 kernelsdir = $(pkgdatadir)/opencl
-dist_kernels_DATA = \
-	$(top_srcdir)/opencl/diablo.cl  \
-	$(top_srcdir)/opencl/diakgcn.cl  \
-	$(top_srcdir)/opencl/phatk.cl  \
-	$(top_srcdir)/opencl/poclbm.cl
+dist_kernels_DATA =
 
 dist_doc_DATA += README.GPU
 
@@ -152,29 +148,22 @@ endif
 endif
 
 
-if HAS_SCRYPT
-bfgminer_SOURCES += scrypt.c scrypt.h
-dist_doc_DATA += README.scrypt
-
-if HAVE_OPENCL
+if USE_SHA256D
+if USE_OPENCL
 dist_kernels_DATA += \
-	$(top_srcdir)/opencl/psw.cl  \
-	$(top_srcdir)/opencl/scrypt.cl  \
-	$(top_srcdir)/opencl/zuikkis.cl
-endif
+	$(top_srcdir)/opencl/diablo.cl  \
+	$(top_srcdir)/opencl/diakgcn.cl  \
+	$(top_srcdir)/opencl/phatk.cl  \
+	$(top_srcdir)/opencl/poclbm.cl
 endif
 
-if HAS_CPUMINE
-dist_doc_DATA += README.CPU
+if USE_CPUMINING
 bfgminer_SOURCES	+= \
 		  sha256_generic.c sha256_via.c	\
 		  sha256_cryptopp.c sha256_sse2_amd64.c		\
 		  sha256_sse4_amd64.c 	\
 		  sha256_altivec_4way.c
 
-# the CPU portion extracted from original main.c
-bfgminer_SOURCES += driver-cpu.h driver-cpu.c
-
 if HAVE_SSE2
 bfgminer_LDADD  += libsse2cpuminer.a
 noinst_LIBRARIES = libsse2cpuminer.a
@@ -202,7 +191,25 @@ endif
 
 endif # HAVE_x86_64
 endif # HAS_YASM
-endif # HAS_CPUMINE
+endif # USE_CPUMINING
+endif # USE_SHA256D
+
+if USE_SCRYPT
+bfgminer_SOURCES += scrypt.c scrypt.h
+dist_doc_DATA += README.scrypt
+
+if USE_OPENCL
+dist_kernels_DATA += \
+	$(top_srcdir)/opencl/psw.cl  \
+	$(top_srcdir)/opencl/scrypt.cl  \
+	$(top_srcdir)/opencl/zuikkis.cl
+endif
+endif
+
+if USE_CPUMINING
+dist_doc_DATA += README.CPU
+bfgminer_SOURCES += driver-cpu.h driver-cpu.c
+endif # USE_CPUMINING
 
 if NEED_BFG_LOWL_VCOM
 bfgminer_SOURCES += lowl-vcom.c lowl-vcom.h
@@ -240,11 +247,11 @@ if HAS_ASIC
 dist_doc_DATA += README.ASIC
 endif
 
-if HAS_BITFORCE
+if USE_BITFORCE
 bfgminer_SOURCES += driver-bitforce.c
 endif
 
-if HAS_BIGPIC
+if USE_BIGPIC
 bfgminer_SOURCES += driver-bigpic.c driver-bigpic.h
 endif
 
@@ -252,11 +259,11 @@ if USE_DRILLBIT
 bfgminer_SOURCES += driver-drillbit.c
 endif
 
-if HAS_TWINFURY
+if USE_TWINFURY
 bfgminer_SOURCES += driver-twinfury.c driver-twinfury.h
 endif
 
-if HAS_ICARUS
+if USE_ICARUS
 bfgminer_SOURCES += driver-icarus.c driver-icarus.h
 bfgminer_SOURCES += driver-cairnsmore.c
 bfgminer_SOURCES += driver-erupter.c
@@ -279,7 +286,7 @@ if USE_ZEUSMINER
 bfgminer_SOURCES += driver-zeusminer.c
 endif
 
-if HAS_AVALON
+if USE_AVALON
 bfgminer_SOURCES += driver-avalon.c driver-avalon.h
 endif
 
@@ -295,11 +302,11 @@ if USE_KNCASIC
 bfgminer_SOURCES += driver-kncasic.c
 endif
 
-if HAS_KLONDIKE
+if USE_KLONDIKE
 bfgminer_SOURCES += driver-klondike.c driver-klondike.h driver-hashbusteravalon.c
 endif
 
-if HAS_MODMINER
+if USE_MODMINER
 bfgminer_SOURCES += driver-modminer.c
 endif
 
@@ -311,11 +318,11 @@ if NEED_KNC_ASIC
 bfgminer_SOURCES += knc-asic/knc-asic.c knc-asic/knc-spimux.c knc-asic/knc-transport-spimux.c knc-asic/include/knc-asic.h knc-asic/include/knc-transport.h
 endif
 
-if HAS_X6500
+if USE_X6500
 bfgminer_SOURCES += driver-x6500.c jtag.c jtag.h
 endif
 
-if HAS_ZTEX
+if USE_ZTEX
 bfgminer_SOURCES += driver-ztex.c libztex.c libztex.h
 endif
 
@@ -323,10 +330,10 @@ if USE_BIFURY
 bfgminer_SOURCES += driver-bifury.c
 endif
 
-if HAS_BITFURY
+if USE_BITFURY
 bfgminer_SOURCES += driver-bitfury.c driver-bitfury.h libbitfury.c libbitfury.h
 
-if HAS_BFSB
+if USE_BFSB
 bfgminer_SOURCES += driver-bfsb.c
 endif
 
@@ -334,15 +341,15 @@ if USE_BFX
 bfgminer_SOURCES += driver-bfx.c
 endif
 
-if HAS_METABANK
+if USE_METABANK
 bfgminer_SOURCES += driver-metabank.c tm_i2c.h tm_i2c.c
 endif
 
-if HAS_LITTLEFURY
+if USE_LITTLEFURY
 bfgminer_SOURCES += driver-littlefury.c
 endif
 
-if HAS_NANOFURY
+if USE_NANOFURY
 bfgminer_SOURCES += driver-nanofury.c mcp2210.c mcp2210.h
 endif
 

+ 16 - 13
README

@@ -143,44 +143,47 @@ BFGMiner driver configuration options:
 	                        Include udev rules for ambiguous devices which may
 	                        not be miners
 	--disable-avalon        Compile support for Avalon (default enabled)
+	--disable-avalonmm      Compile support for Avalon2/3 (default enabled)
 	--enable-bfsb           Compile support for BFSB (default disabled)
-	--disable-bfx           Compile support for BFx2 (default if libusb)
+	--disable-bfx           Compile support for BFx2 (default enabled)
 	--disable-bifury        Compile support for Bi*Fury (default enabled)
 	--disable-bigpic        Compile support for Big Picture Mining USB (default
 	                        enabled)
 	--disable-bitforce      Compile support for BitForce (default enabled)
 	--disable-bitfury       Compile support for Bitfury (default enabled)
-	--enable-cpumining      Build with CPU mining support (default disabled)
+	--disable-cointerra     Compile support for CoinTerra (default enabled)
+	--enable-cpumining      Compile support for CPU mining (default disabled)
 	--disable-drillbit      Compile support for DrillBit (default enabled)
 	--disable-dualminer     Compile support for DualMiner (default enabled)
-	--disable-gridseed      Compile support for GridSeed (default enabled with
-	                        scrypt)
+	--disable-gridseed      Compile support for GridSeed (default enabled)
 	--disable-hashbuster    Compile support for HashBuster Nano (default
 	                        enabled)
-	--disable-hashbusterusb Compile support for HashBuster Micro (default if
-	                        libusb)
+	--disable-hashbusterusb Compile support for HashBuster Micro (default
+	                        enabled)
 	--disable-hashfast      Compile support for HashFast (default enabled)
 	--disable-icarus        Compile support for Icarus (default enabled)
 	--enable-jingtian       Compile support for JingTian (default disabled)
 	--disable-klondike      Compile support for Klondike (default enabled)
 	--enable-knc            Compile support for KnC (default disabled)
+	--enable-kncasic        Compile support for KnC gen 2 (default disabled)
 	--disable-littlefury    Compile support for LittleFury (default enabled)
 	--enable-metabank       Compile support for Metabank (default disabled)
+	--enable-minergate      Compile support for Spondoolies minergate interface
+	                        (default disabled)
 	--disable-modminer      Compile support for ModMiner (default enabled)
 	--disable-nanofury      Compile support for NanoFury (default enabled)
 	--enable-opencl         Compile support for OpenCL (default disabled)
 	--disable-adl           Build without ADL monitoring (default enabled)
 	--disable-rockminer     Compile support for RockMiner (default enabled)
 	--enable-titan          Compile support for KnC Titan (default disabled)
-	--disable-twinfury      Compile support for Twinfury USB miner (default
-	                        enabled)
-	--disable-x6500         Compile support for X6500 (default if libusb)
-	--disable-zeusminer     Compile support for ZeusMiner (default enabled with
-	                        scrypt)
-	--disable-ztex          Compile support for ZTEX (default if libusb)
+	--disable-twinfury      Compile support for Twinfury (default enabled)
+	--disable-x6500         Compile support for X6500 (default enabled)
+	--disable-zeusminer     Compile support for ZeusMiner (default enabled)
+	--disable-ztex          Compile support for ZTEX (default enabled)
 
 BFGMiner algorithm configuration option:
-	--enable-scrypt         Compile support for scrypt mining (default disabled)
+	--disable-sha256d       Compile support for SHA256d (default enabled)
+	--enable-scrypt         Compile support for scrypt (default disabled)
 
 BFGMiner dependency configuration options:
 	--without-curses        Compile support for curses TUI (default enabled)

+ 30 - 32
api.c

@@ -75,7 +75,7 @@ static const char *ALIVE = "Alive";
 static const char *REJECTING = "Rejecting";
 static const char *UNKNOWN = "Unknown";
 #define _DYNAMIC "D"
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 static const char *DYNAMIC = _DYNAMIC;
 #endif
 
@@ -89,7 +89,9 @@ static const char *FALSESTR = "false";
 #ifdef USE_SCRYPT
 static const char *SCRYPTSTR = "scrypt";
 #endif
+#ifdef USE_SHA256D
 static const char *SHA256STR = "sha256";
+#endif
 
 static const char *OSINFO =
 #if defined(__linux)
@@ -124,7 +126,7 @@ static const char *OSINFO =
 #define _PGA		"PGA"
 #endif
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 #define _CPU		"CPU"
 #endif
 
@@ -164,7 +166,7 @@ static const char ISJSON = '{';
 #define JSON_PGA	JSON1 _PGA JSON2
 #endif
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 #define JSON_CPU	JSON1 _CPU JSON2
 #endif
 
@@ -201,7 +203,7 @@ static const char *JSON_PARAMETER = "parameter";
 #define MSG_MISID 15
 #define MSG_GPUDEV 17
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 #define MSG_CPUNON 16
 #define MSG_CPUDEV 18
 #define MSG_INVCPU 19
@@ -350,7 +352,7 @@ struct CODES {
 	const enum code_parameters params;
 	const char *description;
 } codes[] = {
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
  { SEVERITY_ERR,   MSG_INVGPU,	PARAM_GPUMAX,	"Invalid GPU id %d - range is 0 - %d" },
  { SEVERITY_INFO,  MSG_ALRENA,	PARAM_GPU,	"GPU %d already enabled" },
  { SEVERITY_INFO,  MSG_ALRDIS,	PARAM_GPU,	"GPU %d already disabled" },
@@ -369,13 +371,13 @@ struct CODES {
  },
 
  { SEVERITY_SUCC,  MSG_SUMM,	PARAM_NONE,	"Summary" },
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
  { SEVERITY_INFO,  MSG_GPUDIS,	PARAM_GPU,	"GPU %d set disable flag" },
  { SEVERITY_INFO,  MSG_GPUREI,	PARAM_GPU,	"GPU %d restart attempted" },
 #endif
  { SEVERITY_ERR,   MSG_INVCMD,	PARAM_NONE,	"Invalid command" },
  { SEVERITY_ERR,   MSG_MISID,	PARAM_NONE,	"Missing device id parameter" },
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
  { SEVERITY_SUCC,  MSG_GPUDEV,	PARAM_GPU,	"GPU%d" },
 #endif
 #ifdef HAVE_AN_FPGA
@@ -388,7 +390,7 @@ struct CODES {
  { SEVERITY_INFO,  MSG_PGADIS,	PARAM_PGA,	"PGA %d set disable flag" },
  { SEVERITY_ERR,   MSG_PGAUNW,	PARAM_PGA,	"PGA %d is not flagged WELL, cannot enable" },
 #endif
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
  { SEVERITY_ERR,   MSG_CPUNON,	PARAM_NONE,	"No CPUs" },
  { SEVERITY_SUCC,  MSG_CPUDEV,	PARAM_CPU,	"CPU%d" },
  { SEVERITY_ERR,   MSG_INVCPU,	PARAM_CPUMAX,	"Invalid CPU id %d - range is 0 - %d" },
@@ -414,7 +416,7 @@ struct CODES {
  { SEVERITY_ERR,   MSG_INVINT,	PARAM_STR,	"Invalid intensity (%s) - must be '" _DYNAMIC  "' or range -10 - 31" },
  { SEVERITY_INFO,  MSG_GPUINT,	PARAM_BOTH,	"GPU %d set new intensity to %s" },
  { SEVERITY_SUCC,  MSG_MINECONFIG,PARAM_NONE,	"BFGMiner config" },
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
  { SEVERITY_ERR,   MSG_GPUMERR,	PARAM_BOTH,	"Setting GPU %d memoryclock to (%s) reported failure" },
  { SEVERITY_SUCC,  MSG_GPUMEM,	PARAM_BOTH,	"Setting GPU %d memoryclock to (%s) reported success" },
  { SEVERITY_ERR,   MSG_GPUEERR,	PARAM_BOTH,	"Setting GPU %d clock to (%s) reported failure" },
@@ -1142,7 +1144,7 @@ static void message(struct io_data * const io_data, const int messageid2, const
 #ifdef HAVE_AN_FPGA
 	int pga;
 #endif
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 	int cpu;
 #endif
 	int i;
@@ -1181,7 +1183,7 @@ static void message(struct io_data * const io_data, const int messageid2, const
 				case PARAM_POOL:
 					sprintf(buf, codes[i].description, paramid, pools[paramid]->rpc_url);
 					break;
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 				case PARAM_GPUMAX:
 					sprintf(buf, codes[i].description, paramid, nDevs - 1);
 					break;
@@ -1192,7 +1194,7 @@ static void message(struct io_data * const io_data, const int messageid2, const
 					sprintf(buf, codes[i].description, paramid, pga - 1);
 					break;
 #endif
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 				case PARAM_CPUMAX:
 					if (opt_n_threads > 0)
 						cpu = num_processors;
@@ -1561,7 +1563,7 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 	io_add(io_data, buf);
 }
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 static void gpustatus(struct io_data *io_data, int gpu, bool isjson, bool precom)
 {
         if (gpu < 0 || gpu >= nDevs)
@@ -1580,7 +1582,7 @@ static void pgastatus(struct io_data *io_data, int pga, bool isjson, bool precom
 }
 #endif
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 static void cpustatus(struct io_data *io_data, int cpu, bool isjson, bool precom)
 {
         if (opt_n_threads <= 0 || cpu < 0 || cpu >= num_processors)
@@ -1626,7 +1628,7 @@ static void devstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __ma
 	return devinfo_internal(devstatus_an, MSG_DEVS, io_data, c, param, isjson, group);
 }
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 static void gpudev(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group)
 {
 	bool io_open = false;
@@ -1844,7 +1846,7 @@ static void pgaidentify(struct io_data *io_data, __maybe_unused SOCKETTYPE c, ch
 }
 #endif
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 static void cpudev(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group)
 {
 	bool io_open = false;
@@ -1987,12 +1989,6 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
 	bool io_open;
 	double utility, mhs, work_utility;
 
-#ifdef WANT_CPUMINE
-	char *algo = (char *)(algo_names[opt_algo]);
-	if (algo == NULL)
-		algo = (char *)NULLSTR;
-#endif
-
 	message(io_data, MSG_SUMM, 0, NULL, isjson);
 	io_open = io_add(io_data, isjson ? COMSTR JSON_SUMMARY : _SUMMARY COMSTR);
 
@@ -2004,9 +2000,9 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
 	work_utility = total_diff1 / ( total_secs ? total_secs : 1 ) * 60;
 
 	root = api_add_elapsed(root, "Elapsed", &(total_secs), true);
-#ifdef WANT_CPUMINE
+#if defined(USE_CPUMINING) && defined(USE_SHA256D)
 	if (opt_n_threads > 0)
-	root = api_add_string(root, "Algorithm", algo, false);
+		root = api_add_string(root, "Algorithm", (algo_names[opt_algo] ?: NULLSTR), false);
 #endif
 	root = api_add_mhs(root, "MHS av", &(mhs), false);
 	char mhsname[27];
@@ -2053,7 +2049,7 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
 		io_close(io_data);
 }
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 static void gpuenable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group)
 {
 	int id;
@@ -2158,7 +2154,7 @@ static void gpucount(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
 	bool io_open;
 	int numgpu = 0;
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	numgpu = nDevs;
 #endif
 
@@ -2195,7 +2191,7 @@ static void pgacount(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
 		io_close(io_data);
 }
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 static void cpuenable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group)
 {
 	int id;
@@ -2303,7 +2299,7 @@ static void cpucount(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
 	bool io_open;
 	int count = 0;
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 	count = opt_n_threads > 0 ? num_processors : 0;
 #endif
 
@@ -2626,7 +2622,7 @@ static void removepool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
 	rpc_url = NULL;
 }
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 static bool splitgpuvalue(struct io_data *io_data, char *param, int *gpu, char **value, bool isjson)
 {
 	int id;
@@ -3097,9 +3093,11 @@ static void minecoin(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
 				root = api_add_const(root, "Hash Method", SCRYPTSTR, false);
 				break;
 #endif
+#ifdef USE_SHA256D
 			case POW_SHA256D:
 				root = api_add_const(root, "Hash Method", SHA256STR, false);
 				break;
+#endif
 			default:
 				break;
 		}
@@ -3399,7 +3397,7 @@ struct CMDS {
 	{ "procs",		devstatus,	false,	true },
 	{ "pools",		poolstatus,	false,	true },
 	{ "summary",		summary,	false,	true },
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	{ "gpuenable",		gpuenable,	true,	false },
 	{ "gpudisable",		gpudisable,	true,	false },
 	{ "gpurestart",		gpurestart,	true,	false },
@@ -3416,7 +3414,7 @@ struct CMDS {
 	{ "procdisable",		pgadisable,	true,	false },
 	{ "procidentify",	pgaidentify,	true,	false },
 #endif
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 	{ "cpuenable",		cpuenable,	true,	false },
 	{ "cpudisable",		cpudisable,	true,	false },
 	{ "cpurestart",		cpurestart,	true,	false },
@@ -3433,7 +3431,7 @@ struct CMDS {
 	{ "enablepool",		enablepool,	true,	false },
 	{ "disablepool",	disablepool,	true,	false },
 	{ "removepool",		removepool,	true,	false },
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	{ "gpuintensity",	gpuintensity,	true,	false },
 	{ "gpumem",		gpumem,		true,	false },
 	{ "gpuengine",		gpuengine,	true,	false },

File diff suppressed because it is too large
+ 185 - 567
configure.ac


+ 2 - 0
deviceapi.c

@@ -94,8 +94,10 @@ float common_sha256d_and_scrypt_min_nonce_diff(struct cgpu_info * const proc, co
 		case POW_SCRYPT:
 			return 1./0x10000;
 #endif
+#ifdef USE_SHA256D
 		case POW_SHA256D:
 			return 1.;
+#endif
 		default:
 			return -1.;
 	}

+ 19 - 18
driver-cpu.c

@@ -98,10 +98,13 @@ extern bool scanhash_sse2_32(struct thr_info *, struct work *, uint32_t max_nonc
 extern bool scanhash_scrypt(struct thr_info *, struct work *, uint32_t max_nonce, uint32_t *last_nonce, uint32_t nonce);
 
 
-#ifdef WANT_CPUMINE
+#ifdef USE_SHA256D
 static size_t max_name_len = 0;
 static char *name_spaces_pad = NULL;
+#endif
+
 const char *algo_names[] = {
+#ifdef USE_SHA256D
 	[ALGO_C]		= "c",
 #ifdef WANT_SSE2_4WAY
 	[ALGO_4WAY]		= "4way",
@@ -125,13 +128,17 @@ const char *algo_names[] = {
 #ifdef WANT_ALTIVEC_4WAY
     [ALGO_ALTIVEC_4WAY] = "altivec_4way",
 #endif
+#endif
 #ifdef WANT_SCRYPT
     [ALGO_SCRYPT] = "scrypt",
 #endif
+#ifdef USE_SHA256D
 	[ALGO_FASTAUTO] = "fastauto",
 	[ALGO_AUTO] = "auto",
+#endif
 };
 
+#ifdef USE_SHA256D
 static const sha256_func sha256_funcs[] = {
 	[ALGO_C]		= (sha256_func)scanhash_c,
 #ifdef WANT_SSE2_4WAY
@@ -156,19 +163,16 @@ static const sha256_func sha256_funcs[] = {
 #ifdef WANT_X8664_SSE4
 	[ALGO_SSE4_64]		= (sha256_func)scanhash_sse4_64,
 #endif
-#ifdef WANT_SCRYPT
-	[ALGO_SCRYPT]		= (sha256_func)scanhash_scrypt
-#endif
 };
 #endif
 
-
-
-#ifdef WANT_CPUMINE
+#ifdef USE_SHA256D
 enum sha256_algos opt_algo = ALGO_FASTAUTO;
-static bool forced_n_threads;
 #endif
 
+static bool forced_n_threads;
+
+#ifdef USE_SHA256D
 const uint32_t hash1_init[] = {
 	0,0,0,0,0,0,0,0,
 	0x80000000,
@@ -177,9 +181,6 @@ const uint32_t hash1_init[] = {
 };
 
 
-
-
-#ifdef WANT_CPUMINE
 // Algo benchmark, crash-prone, system independent stage
 double bench_algo_stage3(
 	enum sha256_algos algo
@@ -635,17 +636,14 @@ void show_algo(char buf[OPT_SHOW_LEN], const enum sha256_algos *algo)
 {
 	strncpy(buf, algo_names[*algo], OPT_SHOW_LEN);
 }
-#endif
+#endif  /* USE_SHA256D */
 
-#ifdef WANT_CPUMINE
 char *force_nthreads_int(const char *arg, int *i)
 {
 	forced_n_threads = true;
 	return set_int_range(arg, i, 0, 9999);
 }
-#endif
 
-#ifdef WANT_CPUMINE
 static int cpu_autodetect()
 {
 	RUNONCE(0);
@@ -699,7 +697,9 @@ static int cpu_autodetect()
 		cgpu->drv = &cpu_drv;
 		cgpu->deven = DEV_ENABLED;
 		cgpu->threads = 1;
+#ifdef USE_SHA256D
 		cgpu->kname = algo_names[opt_algo];
+#endif
 		add_cgpu(cgpu);
 	}
 	return opt_n_threads;
@@ -732,6 +732,7 @@ static uint64_t cpu_can_limit_work(struct thr_info __maybe_unused *thr)
 static bool cpu_thread_init(struct thr_info *thr)
 {
 	const int thr_id = thr->id;
+#ifdef USE_SHA256D
 	struct cgpu_info *cgpu = thr->cgpu;
 
 	mutex_lock(&cpualgo_lock);
@@ -746,6 +747,7 @@ static bool cpu_thread_init(struct thr_info *thr)
 	mutex_unlock(&cpualgo_lock);
 
 	cgpu->kname = algo_names[opt_algo];
+#endif
 	
 	/* Set worker threads to nice 19 and then preferentially to SCHED_IDLE
 	 * and if that fails, then SCHED_BATCH. No need for this to be an
@@ -761,12 +763,10 @@ static bool cpu_thread_init(struct thr_info *thr)
 
 static int64_t cpu_scanhash(struct thr_info *thr, struct work *work, int64_t max_nonce)
 {
-	unsigned char hash1[64];
 	uint32_t first_nonce = work->blk.nonce;
 	uint32_t last_nonce;
 	bool rc;
 
-	memcpy(&hash1[0], &hash1_init[0], sizeof(hash1));
 CPUSearch:
 	last_nonce = first_nonce;
 	rc = false;
@@ -781,9 +781,11 @@ CPUSearch:
 				func = scanhash_scrypt;
 				break;
 #endif
+#ifdef USE_SHA256D
 			case POW_SHA256D:
 				func = sha256_funcs[opt_algo];
 				break;
+#endif
 		}
 		if (unlikely(!func))
 			applogr(0, LOG_ERR, "%"PRIpreprv": Unknown mining algorithm", thr->cgpu->proc_repr);
@@ -822,4 +824,3 @@ struct device_drv cpu_drv = {
 	.thread_init = cpu_thread_init,
 	.scanhash = cpu_scanhash,
 };
-#endif

+ 13 - 1
driver-cpu.h

@@ -22,6 +22,8 @@
 #define OPT_SHOW_LEN 80
 #endif
 
+#ifdef USE_SHA256D
+
 #if defined(__i386__) && defined(HAVE_SSE2)
 #define WANT_SSE2_4WAY 1
 #endif
@@ -46,11 +48,14 @@
 #define WANT_X8664_SSE4 1
 #endif
 
+#endif  /* USE_SHA256D */
+
 #ifdef USE_SCRYPT
 #define WANT_SCRYPT
 #endif
 
 enum sha256_algos {
+#ifdef USE_SHA256D
 	ALGO_C,			/* plain C */
 	ALGO_4WAY,		/* parallel SSE2 */
 	ALGO_VIA,		/* VIA padlock */
@@ -60,10 +65,17 @@ enum sha256_algos {
 	ALGO_SSE2_64,		/* SSE2 for x86_64 */
 	ALGO_SSE4_64,		/* SSE4 for x86_64 */
 	ALGO_ALTIVEC_4WAY,	/* parallel Altivec */
+#endif
+#ifdef USE_SCRYPT
 	ALGO_SCRYPT,		/* scrypt */
+#endif
 	
+#ifdef USE_SHA256D
 	ALGO_FASTAUTO,		/* fast autodetect */
-	ALGO_AUTO		/* autodetect */
+	ALGO_AUTO,		/* autodetect */
+#endif
+	
+	CUSTOM_CPU_MINING_ALGOS_COUNT,
 };
 
 extern const char *algo_names[];

+ 2 - 0
driver-dualminer.c

@@ -164,8 +164,10 @@ float dualminer_min_nonce_diff(struct cgpu_info * const proc, const struct minin
 		case POW_SCRYPT:
 			return ((!info) || dualminer_is_scrypt(info)) ? (1./0x10000) : -1.;
 #endif
+#ifdef USE_SHA256D
 		case POW_SHA256D:
 			return (info && dualminer_is_scrypt(info)) ? -1. : 1.;
+#endif
 		default:
 			return -1.;
 	}

+ 21 - 32
driver-opencl.c

@@ -50,7 +50,6 @@
 /* TODO: cleanup externals ********************/
 
 
-#ifdef HAVE_OPENCL
 /* Platform API */
 CL_API_ENTRY cl_int CL_API_CALL
 (*clGetPlatformIDs)(cl_uint          /* num_entries */,
@@ -257,7 +256,6 @@ load_opencl_symbols() {
 	
 	return true;
 }
-#endif
 
 
 struct opencl_kernel_interface {
@@ -371,7 +369,6 @@ const char *set_ ## PNAME(char *arg)  \
 #define _SET_INT_LIST(PNAME, VCHECK, FIELD)  \
 	_SET_INT_LIST2(PNAME, VCHECK, ((struct opencl_device_data *)cgpu->device_data)->FIELD)
 
-#ifdef HAVE_OPENCL
 _SET_INT_LIST(vector  , (v == 1 || v == 2 || v == 4), vwidth   )
 _SET_INT_LIST(worksize, (v >= 1 && v <= 9999)       , work_size)
 
@@ -411,10 +408,19 @@ bool _set_kernel(struct cgpu_info * const cgpu, const char *_val)
 		return false;
 	free(src);
 	
-	char **kfp = &data->kernel_file_sha256d;
+	char **kfp =
+#ifdef USE_SHA256D
+		&data->kernel_file_sha256d;
+#else
+		NULL;
+#endif
 #ifdef USE_SCRYPT
 	if (interface == KL_SCRYPT)
 		kfp = &data->kernel_file_scrypt;
+#endif
+#ifndef USE_SHA256D
+	if (!kfp)
+		return false;
 #endif
 	free(*kfp);
 	*kfp = strdup(_val);
@@ -426,7 +432,6 @@ const char *set_kernel(char *arg)
 {
 	return _set_list(arg, "Invalid value passed to set_kernel", _set_kernel);
 }
-#endif
 
 static
 const char *opencl_init_binary(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
@@ -653,7 +658,6 @@ const char *opencl_set_gpu_vddc(struct cgpu_info * const proc, const char * cons
 _SET_INT_LIST(temp_overheat, (v >=     0 && v <   200), adl.overtemp )
 #endif
 
-#ifdef HAVE_OPENCL
 double oclthreads_to_xintensity(const unsigned long oclthreads, const cl_uint max_compute_units)
 {
 	return (double)oclthreads / (double)max_compute_units / 64.;
@@ -751,7 +755,6 @@ const char *set_intensity(char *arg)
 }
 
 _SET_INT_LIST2(gpu_threads, (v >= 1 && v <= 10), cgpu->threads)
-#endif
 
 void write_config_opencl(FILE * const fcfg)
 {
@@ -762,7 +765,6 @@ void write_config_opencl(FILE * const fcfg)
 }
 
 
-#ifdef HAVE_OPENCL
 BFG_REGISTER_DRIVER(opencl_api)
 static const struct bfg_set_device_definition opencl_set_device_funcs_probe[];
 static const struct bfg_set_device_definition opencl_set_device_funcs[];
@@ -775,16 +777,12 @@ char *print_ndevs_and_exit(int *ndevs)
 	applog(LOG_INFO, "%i GPU devices max detected", *ndevs);
 	exit(*ndevs);
 }
-#endif
 
 
 struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
 struct cgpu_info *cpus;
 
 
-
-#ifdef HAVE_OPENCL
-
 /* In dynamic mode, only the first thread of each device will be in use.
  * This potentially could start a thread that was stopped with the start-stop
  * options if one were to disable dynamic from the menu on a paused GPU */
@@ -811,8 +809,6 @@ void pause_dynamic_threads(int gpu)
 
 struct device_drv opencl_api;
 
-#endif /* HAVE_OPENCL */
-
 float opencl_proc_get_intensity(struct cgpu_info * const proc, const char ** const iunit)
 {
 	struct opencl_device_data * const data = proc->device_data;
@@ -830,7 +826,7 @@ float opencl_proc_get_intensity(struct cgpu_info * const proc, const char ** con
 	return intensity;
 }
 
-#if defined(HAVE_OPENCL) && defined(HAVE_CURSES)
+#ifdef HAVE_CURSES
 static
 void opencl_wlogprint_status(struct cgpu_info *cgpu)
 {
@@ -983,20 +979,16 @@ const char *opencl_tui_handle_choice(struct cgpu_info *cgpu, int input)
 #endif
 
 
-#ifdef HAVE_OPENCL
-
 #define CL_SET_BLKARG(blkvar) status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->blkvar)
 #define CL_SET_ARG(var) status |= clSetKernelArg(*kernel, num++, sizeof(var), (void *)&var)
 #define CL_SET_VARG(args, var) status |= clSetKernelArg(*kernel, num++, args * sizeof(uint), (void *)var)
 
+#ifdef USE_SHA256D
 static
 void *_opencl_work_data_dup(struct work * const work)
 {
 	struct opencl_work_data *p = malloc(sizeof(*p));
 	memcpy(p, work->device_data, sizeof(*p));
-#ifdef USE_SCRYPT
-	p->work = work;
-#endif
 	return p;
 }
 
@@ -1235,6 +1227,7 @@ cl_int queue_diablo_kernel(const struct opencl_kernel_info * const kinfo, _clSta
 
 	return status;
 }
+#endif
 
 #ifdef USE_SCRYPT
 static
@@ -1260,23 +1253,23 @@ cl_int queue_scrypt_kernel(const struct opencl_kernel_info * const kinfo, _clSta
 	return status;
 }
 #endif
-#endif /* HAVE_OPENCL */
 
 
 static
 struct opencl_kernel_interface kernel_interfaces[] = {
 	{NULL},
+#ifdef USE_SHA256D
 	{"poclbm",  queue_poclbm_kernel },
 	{"phatk",   queue_phatk_kernel  },
 	{"diakgcn", queue_diakgcn_kernel},
 	{"diablo",  queue_diablo_kernel },
+#endif
 #ifdef USE_SCRYPT
 	{"scrypt",  queue_scrypt_kernel },
 #endif
 };
 
 
-#ifdef HAVE_OPENCL
 /* We have only one thread that ever re-initialises GPUs, thus if any GPU
  * init command fails due to a completely wedged GPU, the thread will never
  * return, unable to harm other GPUs. If it does return, it means we only had
@@ -1362,15 +1355,7 @@ select_cgpu:
 out:
 	return NULL;
 }
-#else
-void *reinit_gpu(__maybe_unused void *userdata)
-{
-	return NULL;
-}
-#endif
-
 
-#ifdef HAVE_OPENCL
 struct device_drv opencl_api;
 
 static int opencl_autodetect()
@@ -1680,7 +1665,7 @@ static bool opencl_thread_init(struct thr_info *thr)
 	return true;
 }
 
-
+#ifdef USE_SHA256D
 static bool opencl_prepare_work(struct thr_info __maybe_unused *thr, struct work *work)
 {
 	const struct mining_algorithm * const malgo = work_mining_algorithm(work);
@@ -1691,6 +1676,7 @@ static bool opencl_prepare_work(struct thr_info __maybe_unused *thr, struct work
 	}
 	return true;
 }
+#endif
 
 extern int opt_dynamic_interval;
 
@@ -1701,6 +1687,7 @@ const struct opencl_kernel_info *opencl_scanhash_get_kernel(struct cgpu_info * c
 	char *kernel_file;
 	switch (malgo->algo)
 	{
+#ifdef USE_SHA256D
 		case POW_SHA256D:
 			kernelinfo = &clState->kernel_sha256d;
 			if (!data->kernel_file_sha256d)
@@ -1738,6 +1725,7 @@ const struct opencl_kernel_info *opencl_scanhash_get_kernel(struct cgpu_info * c
 			}
 			kernel_file = data->kernel_file_sha256d;
 			break;
+#endif
 #ifdef USE_SCRYPT
 		case POW_SCRYPT:
 			kernelinfo = &clState->kernel_scrypt;
@@ -1968,8 +1956,9 @@ struct device_drv opencl_api = {
 	.get_api_extra_device_status = get_opencl_api_extra_device_status,
 	.thread_prepare = opencl_thread_prepare,
 	.thread_init = opencl_thread_init,
+#ifdef USE_SHA256D
 	.prepare_work = opencl_prepare_work,
+#endif
 	.scanhash = opencl_scanhash,
 	.thread_shutdown = opencl_thread_shutdown,
 };
-#endif

+ 4 - 3
driver-opencl.h

@@ -32,7 +32,9 @@ struct opencl_device_data {
 	
 	cl_uint vwidth;
 	size_t work_size;
+#ifdef USE_SHA256D
 	char *kernel_file_sha256d;
+#endif
 	cl_ulong max_alloc;
 	
 	enum opencl_binary_usage opt_opencl_binaries;
@@ -68,6 +70,7 @@ extern float opencl_proc_get_intensity(struct cgpu_info *, const char **iunit);
 extern unsigned long xintensity_to_oclthreads(double xintensity, cl_uint max_compute_units);
 extern bool opencl_set_intensity_from_str(struct cgpu_info *, const char *newvalue);
 
+#ifdef USE_SHA256D
 struct opencl_work_data {
 	cl_uint ctx_a; cl_uint ctx_b; cl_uint ctx_c; cl_uint ctx_d;
 	cl_uint ctx_e; cl_uint ctx_f; cl_uint ctx_g; cl_uint ctx_h;
@@ -91,10 +94,8 @@ struct opencl_work_data {
 	cl_uint B1addK6, PreVal0addK7, W16addK16, W17addK17;
 	cl_uint zeroA, zeroB;
 	cl_uint oneA, twoA, threeA, fourA, fiveA, sixA, sevenA;
-#ifdef USE_SCRYPT
-	struct work *work;
-#endif
 };
+#endif
 
 extern void opencl_early_init();
 extern char *print_ndevs_and_exit(int *ndevs);

+ 2 - 2
findnonce.c

@@ -10,7 +10,6 @@
  */
 
 #include "config.h"
-#ifdef HAVE_OPENCL
 
 #include <stdint.h>
 #include <stdio.h>
@@ -22,6 +21,7 @@
 #include "miner.h"
 #include "scrypt.h"
 
+#ifdef USE_SHA256D
 const uint32_t SHA256_K[64] = {
 	0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
 	0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
@@ -133,6 +133,7 @@ void precalc_hash(struct opencl_work_data *blk, uint32_t *state, uint32_t *data)
 	blk->sixA = blk->ctx_g + SHA256_K[6];
 	blk->sevenA = blk->ctx_h + SHA256_K[7];
 }
+#endif
 
 struct pc_data {
 	struct thr_info *thr;
@@ -205,4 +206,3 @@ void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res)
 		return;
 	}
 }
-#endif /* HAVE_OPENCL */

+ 3 - 2
findnonce.h

@@ -22,8 +22,9 @@
 #define OPENCL_MAX_BUFFERSIZE  BUFFERSIZE
 #endif
 
-#ifdef HAVE_OPENCL
+#ifdef USE_SHA256D
 extern void precalc_hash(struct opencl_work_data *blk, uint32_t *state, uint32_t *data);
+#endif
 extern void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res);
-#endif /* HAVE_OPENCL */
+
 #endif /*__FINDNONCE_H__*/

+ 59 - 33
miner.c

@@ -169,7 +169,7 @@ unsigned unittest_failures;
 unsigned long global_quota_gcd = 1;
 time_t last_getwork;
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 int opt_dynamic_interval = 7;
 int nDevs;
 int opt_g_threads = -1;
@@ -516,7 +516,11 @@ float drv_min_nonce_diff(const struct device_drv * const drv, struct cgpu_info *
 {
 	if (drv->drv_min_nonce_diff)
 		return drv->drv_min_nonce_diff(proc, malgo);
+#ifdef USE_SHA256D
 	return (malgo->algo == POW_SHA256D) ? 1. : -1.;
+#else
+	return -1.;
+#endif
 }
 
 char *devpath_to_devid(const char *devpath)
@@ -1030,7 +1034,7 @@ struct mining_algorithm *mining_algorithm_by_alias(const char * const alias)
 }
 
 
-#ifdef HAVE_OPENCL
+#if defined(USE_SHA256D) && defined(USE_OPENCL)
 static
 float opencl_oclthreads_to_intensity_sha256d(const unsigned long oclthreads)
 {
@@ -1044,6 +1048,7 @@ unsigned long opencl_intensity_to_oclthreads_sha256d(float intensity)
 }
 #endif
 
+#ifdef USE_SHA256D
 static struct mining_algorithm malgo_sha256d = {
 	.name = "SHA256d",
 	.aliases = "SHA256d|SHA256|SHA2",
@@ -1055,7 +1060,7 @@ static struct mining_algorithm malgo_sha256d = {
 	
 	.hash_data_f = hash_data,
 	
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	.opencl_nodefault = true,
 	.opencl_oclthreads_to_intensity = opencl_oclthreads_to_intensity_sha256d,
 	.opencl_intensity_to_oclthreads = opencl_intensity_to_oclthreads_sha256d,
@@ -1063,10 +1068,11 @@ static struct mining_algorithm malgo_sha256d = {
 	.opencl_max_oclthreads = 0x20000000,  // intensity  14
 #endif
 };
+#endif
 
 
 #ifdef USE_SCRYPT
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 static
 float opencl_oclthreads_to_intensity_scrypt(const unsigned long oclthreads)
 {
@@ -1090,7 +1096,7 @@ static struct mining_algorithm malgo_scrypt = {
 	
 	.hash_data_f = scrypt_hash_data,
 	
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	.opencl_oclthreads_to_intensity = opencl_oclthreads_to_intensity_scrypt,
 	.opencl_intensity_to_oclthreads = opencl_intensity_to_oclthreads_scrypt,
 	.opencl_min_oclthreads =      0x100,  // intensity   8
@@ -1111,7 +1117,9 @@ static
 __attribute__((constructor))
 void init_mining_goals(struct mining_goal_info * const goal, const struct mining_algorithm * const malgo)
 {
+#ifdef USE_SHA256D
 	LL_APPEND(mining_algorithms, (&malgo_sha256d));
+#endif
 #ifdef USE_SCRYPT
 	LL_APPEND(mining_algorithms, (&malgo_scrypt));
 #endif
@@ -1159,7 +1167,12 @@ struct mining_goal_info *get_mining_goal(const char * const name)
 			.blkchain = blkchain,
 			.current_diff = 0xFFFFFFFFFFFFFFFFULL,
 		};
+#ifdef HAVE_SHA256D
 		goal_set_malgo(goal, &malgo_sha256d);
+#else
+		// NOTE: Basically random default
+		goal_set_malgo(goal, mining_algorithms);
+#endif
 		HASH_ADD_STR(mining_goals, name, goal);
 		HASH_SORT(mining_goals, mining_goals_name_cmp);
 		
@@ -1322,6 +1335,14 @@ struct pool *current_pool(void)
 	return pool;
 }
 
+#if defined(USE_CPUMINING) && !defined(USE_SHA256D)
+static
+char *arg_ignored(const char * const arg)
+{
+	return NULL;
+}
+#endif
+
 static
 char *set_bool_ignore_arg(const char * const arg, bool * const b)
 {
@@ -2143,7 +2164,7 @@ char *set_temp_target(char *arg)
 	return NULL;
 }
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 static
 char *set_no_opencl_binaries(__maybe_unused void * const dummy)
 {
@@ -2294,7 +2315,8 @@ static char *set_null(const char __maybe_unused *arg)
 
 /* These options are available from config file or commandline */
 static struct opt_table opt_config_table[] = {
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
+#ifdef USE_SHA256D
 	OPT_WITH_ARG("--algo",
 		     set_algo, show_algo, &opt_algo,
 		     "Specify sha256 implementation for CPU mining:\n"
@@ -2327,7 +2349,11 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITH_ARG("-a",
 	             set_algo, show_algo, &opt_algo,
 	             opt_hidden),
-#endif
+#else
+	// NOTE: Silently ignoring option, since it is plausable a non-SHA256d miner was using it just to skip benchmarking
+	OPT_WITH_ARG("--algo|-a", arg_ignored, NULL, NULL, opt_hidden),
+#endif  /* USE_SHA256D */
+#endif  /* USE_CPUMINING */
 	OPT_WITH_ARG("--api-allow",
 		     set_api_allow, NULL, NULL,
 		     "Allow API access only to the given list of [G:]IP[/Prefix] addresses[/subnets]"),
@@ -2410,7 +2436,7 @@ static struct opt_table opt_config_table[] = {
 			opt_set_bool, &opt_compact,
 			"Use compact display without per device statistics"),
 #endif
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 	OPT_WITH_ARG("--cpu-threads",
 		     force_nthreads_int, opt_show_intval, &opt_n_threads,
 		     "Number of miner CPU threads"),
@@ -2466,7 +2492,7 @@ static struct opt_table opt_config_table[] = {
 	             set_generate_addr, NULL, NULL,
 	             opt_hidden),
 #endif
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	OPT_WITH_ARG("--gpu-dyninterval",
 		     set_int_1_to_65535, opt_show_intval, &opt_dynamic_interval,
 		     opt_hidden),
@@ -2511,7 +2537,7 @@ static struct opt_table opt_config_table[] = {
 	             set_intensity, NULL, NULL,
 	             opt_hidden),
 #endif
-#if defined(HAVE_OPENCL) || defined(USE_MODMINER) || defined(USE_X6500) || defined(USE_ZTEX)
+#if defined(USE_OPENCL) || defined(USE_MODMINER) || defined(USE_X6500) || defined(USE_ZTEX)
 	OPT_WITH_ARG("--kernel-path",
 		     opt_set_charp, opt_show_charp, &opt_kernel_path,
 	             "Specify a path to where bitstream and kernel files are"),
@@ -2519,7 +2545,7 @@ static struct opt_table opt_config_table[] = {
 	             opt_set_charp, opt_show_charp, &opt_kernel_path,
 	             opt_hidden),
 #endif
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	OPT_WITH_ARG("--kernel|-k",
 	             set_kernel, NULL, NULL,
 	             opt_hidden),
@@ -2623,7 +2649,7 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITHOUT_ARG("--no-submit-stale",
 			opt_set_invbool, &opt_submit_stale,
 		        "Don't submit shares if they are detected as stale"),
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	OPT_WITHOUT_ARG("--no-opencl-binaries",
 	                set_no_opencl_binaries, NULL,
 	                opt_hidden),
@@ -2726,7 +2752,7 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITH_ARG("--set-device|--set",
 			opt_string_elist_add, NULL, &opt_set_device_list,
 			"Set default parameters on devices; eg, NFY:osc6_bits=50"),
-#if defined(USE_SCRYPT) && defined(HAVE_OPENCL)
+#if defined(USE_SCRYPT) && defined(USE_OPENCL)
 	OPT_WITH_ARG("--shaders",
 		     set_shaders, NULL, NULL,
 	             opt_hidden),
@@ -2792,7 +2818,7 @@ static struct opt_table opt_config_table[] = {
 			opt_hidden
 #endif
 	),
-#if defined(USE_SCRYPT) && defined(HAVE_OPENCL)
+#if defined(USE_SCRYPT) && defined(USE_OPENCL)
 	OPT_WITH_ARG("--thread-concurrency",
 		     set_thread_concurrency, NULL, NULL,
 	             opt_hidden),
@@ -2808,7 +2834,7 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITH_ARG("--user|-u",
 		     set_user, NULL, NULL,
 		     "Username for bitcoin JSON-RPC server"),
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	OPT_WITH_ARG("--vectors|-v",
 	             set_vector, NULL, NULL,
 	             opt_hidden),
@@ -2822,7 +2848,7 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITHOUT_ARG("--weighed-stats",
 	                opt_set_bool, &opt_weighed_stats,
 	                "Display statistics weighed to difficulty 1"),
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	OPT_WITH_ARG("--worksize|-w",
 	             set_worksize, NULL, NULL,
 	             opt_hidden),
@@ -3058,7 +3084,7 @@ static struct opt_table opt_cmdline_table[] = {
 	OPT_WITHOUT_ARG("--help|-h",
 			opt_verusage_and_exit, NULL,
 			"Print this message"),
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	OPT_WITHOUT_ARG("--ndevs|-n",
 			print_ndevs_and_exit, &nDevs,
 			opt_hidden),
@@ -3716,7 +3742,7 @@ static int statusy;
 static int devsummaryYOffset;
 static int total_lines;
 #endif
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
 #endif
 struct cgpu_info *cpus;
@@ -7828,10 +7854,10 @@ void write_config(FILE *fcfg)
 	}
 	fputs("\n]\n", fcfg);
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	write_config_opencl(fcfg);
 #endif
-#ifdef WANT_CPUMINE
+#if defined(USE_CPUMINING) && defined(USE_SHA256D)
 	fprintf(fcfg, ",\n\"algo\" : \"%s\"", algo_names[opt_algo]);
 #endif
 
@@ -11617,7 +11643,7 @@ void bfg_watchdog(struct cgpu_info * const cgpu, struct timeval * const tvp_now)
 			else if (cgpu->status == LIFE_WAIT)
 				cgpu->status = LIFE_WELL;
 
-#ifdef WANT_CPUMINE
+#ifdef USE_CPUMINING
 			if (!strcmp(cgpu->drv->dname, "cpu"))
 				return;
 #endif
@@ -11683,7 +11709,7 @@ void print_summary(void)
 	applog(LOG_WARNING, "Started at %s", datestamp);
 	if (total_pools == 1)
 		applog(LOG_WARNING, "Pool: %s", pools[0]->rpc_url);
-#ifdef WANT_CPUMINE
+#if defined(USE_CPUMINING) && defined(USE_SHA256D)
 	if (opt_n_threads > 0)
 		applog(LOG_WARNING, "CPU hasher algorithm used: %s", algo_names[opt_algo]);
 #endif
@@ -11789,7 +11815,7 @@ void print_summary(void)
 
 void _bfg_clean_up(bool restarting)
 {
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	clear_adl(nDevs);
 #endif
 #ifdef HAVE_LIBUSB
@@ -11977,7 +12003,7 @@ out:
 }
 #endif
 
-#if BLKMAKER_VERSION > 1
+#if BLKMAKER_VERSION > 1 && defined(USE_SHA256D)
 static
 bool _add_local_gbt(const char * const filepath, void *userp)
 {
@@ -12214,7 +12240,7 @@ void enable_curses(void) {
 #endif
 
 /* TODO: fix need a dummy CPU device_drv even if no support for CPU mining */
-#ifndef WANT_CPUMINE
+#ifndef USE_CPUMINING
 struct device_drv cpu_drv;
 struct device_drv cpu_drv = {
 	.name = "CPU",
@@ -13172,7 +13198,7 @@ int main(int argc, char *argv[])
 
 	snprintf(packagename, sizeof(packagename), "%s %s", PACKAGE, VERSION);
 
-#ifdef WANT_CPUMINE
+#if defined(USE_CPUMINING) && defined(USE_SHA256D)
 	init_max_name_len();
 #endif
 
@@ -13198,7 +13224,7 @@ int main(int argc, char *argv[])
 	strcpy(cgminer_path, dirname(s));
 	free(s);
 	strcat(cgminer_path, "/");
-#if defined(WANT_CPUMINE) && defined(WIN32)
+#if defined(USE_CPUMINING) && defined(WIN32)
 	{
 		char buf[32];
 		int gev = GetEnvironmentVariable("BFGMINER_BENCH_ALGO", buf, sizeof(buf));
@@ -13249,7 +13275,7 @@ int main(int argc, char *argv[])
 
 	// Ensure at least the default goal is created
 	get_mining_goal("default");
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	opencl_early_init();
 #endif
 
@@ -13454,7 +13480,7 @@ int main(int argc, char *argv[])
 	switch_logsize();
 #endif
 
-#if BLKMAKER_VERSION > 1
+#if BLKMAKER_VERSION > 1 && defined(USE_SHA256D)
 	if (opt_load_bitcoin_conf && !(get_mining_goal("default")->malgo->algo != POW_SHA256D || opt_benchmark))
 		add_local_gbt(total_pools);
 #endif
@@ -13600,12 +13626,12 @@ begin_bench:
 		start_cgpu(cgpu);
 	}
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	for (i = 0; i < nDevs; i++)
 		pause_dynamic_threads(i);
 #endif
 
-#ifdef WANT_CPUMINE
+#if defined(USE_CPUMINING) && defined(USE_SHA256D)
 	if (opt_n_threads > 0)
 		applog(LOG_INFO, "%d cpu miner threads started, using '%s' algorithm.",
 		       opt_n_threads, algo_names[opt_algo]);
@@ -13635,7 +13661,7 @@ begin_bench:
 		quit(1, "watchdog thread create failed");
 	pthread_detach(thr->pth);
 
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	/* Create reinit gpu thread */
 	gpur_thr_id = 3;
 	thr = &control_thr[gpur_thr_id];

+ 5 - 1
miner.h

@@ -277,7 +277,9 @@ struct gpu_adl {
 #endif
 
 enum pow_algorithm {
+#ifdef USE_SHA256D
 	POW_SHA256D = 1,
+#endif
 #ifdef USE_SCRYPT
 	POW_SCRYPT  = 2,
 #endif
@@ -372,10 +374,12 @@ enum dev_enable {
 
 enum cl_kernels {
 	KL_NONE,
+#ifdef USE_SHA256D
 	KL_POCLBM,
 	KL_PHATK,
 	KL_DIAKGCN,
 	KL_DIABLO,
+#endif
 #ifdef USE_SCRYPT
 	KL_SCRYPT,
 #endif
@@ -1136,7 +1140,7 @@ struct mining_algorithm {
 	
 	struct mining_algorithm *next;
 	
-#ifdef HAVE_OPENCL
+#ifdef USE_OPENCL
 	bool opencl_nodefault;
 	float (*opencl_oclthreads_to_intensity)(unsigned long oclthreads);
 	unsigned long (*opencl_intensity_to_oclthreads)(float intensity);

+ 24 - 5
ocl.c

@@ -9,7 +9,6 @@
  */
 
 #include "config.h"
-#ifdef HAVE_OPENCL
 
 #include <ctype.h>
 #include <limits.h>
@@ -696,7 +695,10 @@ _clState *opencl_create_clState(unsigned int gpu, char *name, size_t nameSize)
 bool opencl_load_kernel(struct cgpu_info * const cgpu, _clState * const clState, const char * const name, struct opencl_kernel_info * const kernelinfo, const char * const kernel_file, __maybe_unused const struct mining_algorithm * const malgo)
 {
 	const int gpu = cgpu->device_id;
-	bool patchbfi = false, prog_built = false;
+#ifdef USE_SHA256D
+	bool patchbfi = false;
+#endif
+	bool prog_built = false;
 	struct opencl_device_data * const data = cgpu->device_data;
 	const char * const vbuff = clState->platform_ver_str;
 	char *s;
@@ -733,6 +735,7 @@ bool opencl_load_kernel(struct cgpu_info * const cgpu, _clState * const clState,
 			       cgpu->dev_repr, kernel_file);
 			free(source);
 			return false;
+#ifdef USE_SHA256D
 		case KL_PHATK:
 			if ((strstr(vbuff, "844.4") || strstr(vbuff, "851.4") ||
 			     strstr(vbuff, "831.4") || strstr(vbuff, "898.1") ||
@@ -743,6 +746,7 @@ bool opencl_load_kernel(struct cgpu_info * const cgpu, _clState * const clState,
 				applog(LOG_WARNING, "Downgrade your SDK and delete any .bin files before starting again.");
 				applog(LOG_WARNING, "Or allow BFGMiner to automatically choose a more suitable kernel.");
 			}
+#endif
 		default:
 			;
 	}
@@ -754,6 +758,7 @@ bool opencl_load_kernel(struct cgpu_info * const cgpu, _clState * const clState,
 		int kernel_goffset_support = 0;  // 0 = none; 1 = optional; 2 = required
 		switch (kernelinfo->interface)
 		{
+#ifdef USE_SHA256D
 			case KL_DIABLO:
 			case KL_DIAKGCN:
 			case KL_POCLBM:
@@ -762,6 +767,7 @@ bool opencl_load_kernel(struct cgpu_info * const cgpu, _clState * const clState,
 			case KL_PHATK:
 				kernel_goffset_support = 0;
 				break;
+#endif
 			case KL_NONE: case OPENCL_KERNEL_INTERFACE_COUNT:
 #ifdef USE_SCRYPT
 			case KL_SCRYPT:
@@ -937,6 +943,7 @@ build:
 	if (clState->hasBitAlign) {
 		strcat(CompilerOptions, " -D BITALIGN");
 		applog(LOG_DEBUG, "cl_amd_media_ops found, setting BITALIGN");
+#ifdef USE_SHA256D
 		if (strstr(name, "Cedar") ||
 		    strstr(name, "Redwood") ||
 		    strstr(name, "Juniper") ||
@@ -958,9 +965,21 @@ build:
 			if ((s = strstr(vbuff, "AMD-APP")) && (s = strchr(s, '(')) && atoi(&s[1]) < 1085)
 				patchbfi = true;
 		}
+#endif
 	} else
 		applog(LOG_DEBUG, "cl_amd_media_ops not found, will not set BITALIGN");
 
+#ifdef USE_SHA256D
+	switch (kernelinfo->interface)
+	{
+		case KL_DIABLO: case KL_DIAKGCN: case KL_PHATK: case KL_POCLBM:
+			// Okay, these actually use BFI_INT hacking
+			break;
+		default:
+			// Anything else has never needed it
+			patchbfi = false;
+			break;
+	}
 	if (patchbfi) {
 		if (data->opt_opencl_binaries == OBU_LOADSAVE)
 		{
@@ -974,6 +993,7 @@ build:
 		}
 	} else
 		applog(LOG_DEBUG, "BFI_INT patch requiring device not found, will not BFI_INT patch");
+#endif
 
 	if (kernelinfo->goffset)
 		strcat(CompilerOptions, " -D GOFFSET");
@@ -1026,6 +1046,7 @@ build:
 		return false;
 	}
 
+#ifdef USE_SHA256D
 	/* Patch the kernel if the hardware supports BFI_INT but it needs to
 	 * be hacked in */
 	if (patchbfi) {
@@ -1075,6 +1096,7 @@ build:
 		/* Program needs to be rebuilt */
 		prog_built = false;
 	}
+#endif
 
 	free(source);
 
@@ -1152,6 +1174,3 @@ built:
 	kernelinfo->loaded = true;
 	return true;
 }
-
-#endif /* HAVE_OPENCL */
-

+ 1 - 2
ocl.h

@@ -6,7 +6,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#ifdef HAVE_OPENCL
 #include "CL/cl.h"
 
 #include "miner.h"
@@ -58,5 +57,5 @@ extern char *opencl_kernel_source(const char *filename, int *out_sourcelen, enum
 extern int clDevicesNum(void);
 extern _clState *opencl_create_clState(unsigned int gpu, char *name, size_t nameSize);
 extern bool opencl_load_kernel(struct cgpu_info *, _clState *clState, const char *name, struct opencl_kernel_info *, const char *kernel_file, const struct mining_algorithm *);
-#endif /* HAVE_OPENCL */
+
 #endif /* __OCL_H__ */

+ 4 - 0
util.c

@@ -790,6 +790,7 @@ char *ucs2_to_utf8_dup(uint16_t * const in, size_t sz)
 	return out;
 }
 
+#ifdef USE_SHA256D
 void hash_data(void *out_hash, const void *data)
 {
 	unsigned char blkheader[80];
@@ -800,6 +801,7 @@ void hash_data(void *out_hash, const void *data)
 	// double-SHA256 to get the block hash
 	gen_hash(blkheader, out_hash, 80);
 }
+#endif
 
 // Example output: 0000000000000000000000000000000000000000000000000000ffff00000000 (bdiff 1)
 void real_block_target(unsigned char *target, const unsigned char *data)
@@ -2659,8 +2661,10 @@ static bool parse_diff(struct pool *pool, json_t *val)
 		diff = bdiff_to_pdiff(diff);
 	}
 	
+#ifdef USE_SHA256D
 	if (malgo->algo == POW_SHA256D && diff < 1 && diff > 0.999)
 		diff = 1;
+#endif
 	
 #ifdef USE_SCRYPT
 	// Broken Scrypt pools multiply difficulty by 0x10000

Some files were not shown because too many files changed in this diff