driver-bitforce.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. /*
  2. * Copyright 2012 Luke Dashjr
  3. * Copyright 2012 Con Kolivas
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the Free
  7. * Software Foundation; either version 3 of the License, or (at your option)
  8. * any later version. See COPYING for more details.
  9. */
  10. #include <limits.h>
  11. #include <pthread.h>
  12. #include <stdio.h>
  13. #include <strings.h>
  14. #include <sys/time.h>
  15. #include <unistd.h>
  16. #include "config.h"
  17. #include "compat.h"
  18. #include "fpgautils.h"
  19. #include "miner.h"
  20. #define BITFORCE_SLEEP_MS 500
  21. #define BITFORCE_TIMEOUT_S 7
  22. #define BITFORCE_TIMEOUT_MS (BITFORCE_TIMEOUT_S * 1000)
  23. #define BITFORCE_LONG_TIMEOUT_S 15
  24. #define BITFORCE_LONG_TIMEOUT_MS (BITFORCE_LONG_TIMEOUT_S * 1000)
  25. #define BITFORCE_CHECK_INTERVAL_MS 10
  26. #define WORK_CHECK_INTERVAL_MS 50
  27. #define MAX_START_DELAY_US 100000
  28. #define tv_to_ms(tval) (tval.tv_sec * 1000 + tval.tv_usec / 1000)
  29. #define TIME_AVG_CONSTANT 8
  30. #define KNAME_WORK "full work"
  31. #define KNAME_RANGE "nonce range"
  32. struct device_api bitforce_api;
  33. // Code must deal with a timeout
  34. #define BFopen(devpath) serial_open(devpath, 0, 1, true)
  35. static void BFgets(char *buf, size_t bufLen, int fd)
  36. {
  37. do {
  38. buf[0] = '\0';
  39. --bufLen;
  40. } while (likely(bufLen && read(fd, buf, 1) == 1 && (buf++)[0] != '\n'));
  41. buf[0] = '\0';
  42. }
  43. static ssize_t BFwrite(int fd, const void *buf, ssize_t bufLen)
  44. {
  45. if ((bufLen) != write(fd, buf, bufLen))
  46. return 0;
  47. else
  48. return bufLen;
  49. }
  50. #define BFclose(fd) close(fd)
  51. static bool bitforce_detect_one(const char *devpath)
  52. {
  53. int fdDev = BFopen(devpath);
  54. struct cgpu_info *bitforce;
  55. char pdevbuf[0x100];
  56. char *s;
  57. applog(LOG_DEBUG, "BFL: Attempting to open %s", devpath);
  58. if (unlikely(fdDev == -1)) {
  59. applog(LOG_ERR, "BFL: Failed to open %s", devpath);
  60. return false;
  61. }
  62. BFwrite(fdDev, "ZGX", 3);
  63. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  64. if (unlikely(!pdevbuf[0])) {
  65. applog(LOG_ERR, "BFL: Error reading/timeout (ZGX)");
  66. return 0;
  67. }
  68. BFclose(fdDev);
  69. if (unlikely(!strstr(pdevbuf, "SHA256"))) {
  70. applog(LOG_ERR, "BFL: Didn't recognise BitForce on %s", devpath);
  71. return false;
  72. }
  73. // We have a real BitForce!
  74. bitforce = calloc(1, sizeof(*bitforce));
  75. bitforce->api = &bitforce_api;
  76. bitforce->device_path = strdup(devpath);
  77. bitforce->deven = DEV_ENABLED;
  78. bitforce->threads = 1;
  79. /* Initially enable support for nonce range and disable it later if it
  80. * fails */
  81. if (opt_bfl_noncerange) {
  82. bitforce->nonce_range = true;
  83. bitforce->sleep_ms = BITFORCE_SLEEP_MS;
  84. bitforce->kname = KNAME_RANGE;
  85. } else {
  86. bitforce->sleep_ms = BITFORCE_SLEEP_MS * 5;
  87. bitforce->kname = KNAME_WORK;
  88. }
  89. if (likely((!memcmp(pdevbuf, ">>>ID: ", 7)) && (s = strstr(pdevbuf + 3, ">>>")))) {
  90. s[0] = '\0';
  91. bitforce->name = strdup(pdevbuf + 7);
  92. }
  93. mutex_init(&bitforce->device_mutex);
  94. return add_cgpu(bitforce);
  95. }
  96. static char bitforce_detect_auto()
  97. {
  98. return (serial_autodetect_udev (bitforce_detect_one, "BitFORCE*SHA256") ?:
  99. serial_autodetect_devserial(bitforce_detect_one, "BitFORCE_SHA256") ?:
  100. 0);
  101. }
  102. static void bitforce_detect()
  103. {
  104. serial_detect_auto(bitforce_api.dname, bitforce_detect_one, bitforce_detect_auto);
  105. }
  106. static void get_bitforce_statline_before(char *buf, struct cgpu_info *bitforce)
  107. {
  108. float gt = bitforce->temp;
  109. if (gt > 0)
  110. tailsprintf(buf, "%5.1fC ", gt);
  111. else
  112. tailsprintf(buf, " ", gt);
  113. tailsprintf(buf, " | ");
  114. }
  115. static bool bitforce_thread_prepare(struct thr_info *thr)
  116. {
  117. struct cgpu_info *bitforce = thr->cgpu;
  118. int fdDev = BFopen(bitforce->device_path);
  119. struct timeval now;
  120. if (unlikely(fdDev == -1)) {
  121. applog(LOG_ERR, "BFL%i: Failed to open %s", bitforce->device_id, bitforce->device_path);
  122. return false;
  123. }
  124. bitforce->device_fd = fdDev;
  125. applog(LOG_INFO, "BFL%i: Opened %s", bitforce->device_id, bitforce->device_path);
  126. gettimeofday(&now, NULL);
  127. get_datestamp(bitforce->init, &now);
  128. return true;
  129. }
  130. static void biforce_clear_buffer(struct cgpu_info *bitforce)
  131. {
  132. int fdDev = bitforce->device_fd;
  133. char pdevbuf[0x100];
  134. int count = 0;
  135. if (!fdDev)
  136. return;
  137. applog(LOG_DEBUG, "BFL%i: Clearing read buffer", bitforce->device_id);
  138. mutex_lock(&bitforce->device_mutex);
  139. do {
  140. pdevbuf[0] = '\0';
  141. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  142. } while (pdevbuf[0] && (++count < 10));
  143. mutex_unlock(&bitforce->device_mutex);
  144. }
  145. void bitforce_init(struct cgpu_info *bitforce)
  146. {
  147. char *devpath = bitforce->device_path;
  148. int fdDev = bitforce->device_fd, retries = 0;
  149. char pdevbuf[0x100];
  150. char *s;
  151. applog(LOG_WARNING, "BFL%i: Re-initialising", bitforce->device_id);
  152. biforce_clear_buffer(bitforce);
  153. mutex_lock(&bitforce->device_mutex);
  154. if (fdDev) {
  155. BFclose(fdDev);
  156. sleep(5);
  157. }
  158. bitforce->device_fd = 0;
  159. fdDev = BFopen(devpath);
  160. if (unlikely(fdDev == -1)) {
  161. mutex_unlock(&bitforce->device_mutex);
  162. applog(LOG_ERR, "BFL%i: Failed to open %s", bitforce->device_id, devpath);
  163. return;
  164. }
  165. do {
  166. BFwrite(fdDev, "ZGX", 3);
  167. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  168. if (unlikely(!pdevbuf[0])) {
  169. mutex_unlock(&bitforce->device_mutex);
  170. applog(LOG_ERR, "BFL%i: Error reading/timeout (ZGX)", bitforce->device_id);
  171. return;
  172. }
  173. if (retries++)
  174. nmsleep(10);
  175. } while (!strstr(pdevbuf, "BUSY") && (retries * 10 < BITFORCE_TIMEOUT_MS));
  176. if (unlikely(!strstr(pdevbuf, "SHA256"))) {
  177. mutex_unlock(&bitforce->device_mutex);
  178. applog(LOG_ERR, "BFL%i: Didn't recognise BitForce on %s returned: %s", bitforce->device_id, devpath, pdevbuf);
  179. return;
  180. }
  181. if (likely((!memcmp(pdevbuf, ">>>ID: ", 7)) && (s = strstr(pdevbuf + 3, ">>>")))) {
  182. s[0] = '\0';
  183. bitforce->name = strdup(pdevbuf + 7);
  184. }
  185. bitforce->device_fd = fdDev;
  186. bitforce->sleep_ms = BITFORCE_SLEEP_MS;
  187. mutex_unlock(&bitforce->device_mutex);
  188. }
  189. static bool bitforce_get_temp(struct cgpu_info *bitforce)
  190. {
  191. int fdDev = bitforce->device_fd;
  192. char pdevbuf[0x100];
  193. char *s;
  194. if (!fdDev)
  195. return false;
  196. mutex_lock(&bitforce->device_mutex);
  197. BFwrite(fdDev, "ZLX", 3);
  198. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  199. mutex_unlock(&bitforce->device_mutex);
  200. if (unlikely(!pdevbuf[0])) {
  201. applog(LOG_ERR, "BFL%i: Error: Get temp returned empty string/timed out", bitforce->device_id);
  202. bitforce->temp = 0;
  203. return false;
  204. }
  205. if ((!strncasecmp(pdevbuf, "TEMP", 4)) && (s = strchr(pdevbuf + 4, ':'))) {
  206. float temp = strtof(s + 1, NULL);
  207. if (temp > 0) {
  208. bitforce->temp = temp;
  209. if (unlikely(bitforce->cutofftemp > 0 && temp > bitforce->cutofftemp)) {
  210. if (bitforce->deven == DEV_ENABLED) {
  211. applog(LOG_WARNING, "BFL%i: Hit thermal cutoff limit, disabling!", bitforce->device_id);
  212. bitforce->deven = DEV_RECOVER;
  213. ++bitforce->dev_thermal_cutoff_count;
  214. }
  215. bitforce->device_last_not_well = time(NULL);
  216. bitforce->device_not_well_reason = REASON_DEV_THERMAL_CUTOFF;
  217. }
  218. }
  219. }
  220. return true;
  221. }
  222. static bool bitforce_send_work(struct thr_info *thr, struct work *work)
  223. {
  224. struct cgpu_info *bitforce = thr->cgpu;
  225. int fdDev = bitforce->device_fd;
  226. unsigned char ob[70];
  227. char pdevbuf[0x100];
  228. char *s;
  229. if (!fdDev)
  230. return false;
  231. re_send:
  232. mutex_lock(&bitforce->device_mutex);
  233. if (bitforce->nonce_range)
  234. BFwrite(fdDev, "ZPX", 3);
  235. else
  236. BFwrite(fdDev, "ZDX", 3);
  237. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  238. if (!pdevbuf[0] || !strncasecmp(pdevbuf, "B", 1)) {
  239. mutex_unlock(&bitforce->device_mutex);
  240. nmsleep(WORK_CHECK_INTERVAL_MS);
  241. goto re_send;
  242. } else if (unlikely(strncasecmp(pdevbuf, "OK", 2))) {
  243. mutex_unlock(&bitforce->device_mutex);
  244. if (bitforce->nonce_range) {
  245. applog(LOG_WARNING, "BFL%i: Does not support nonce range, disabling", bitforce->device_id);
  246. bitforce->nonce_range = false;
  247. bitforce->sleep_ms *= 5;
  248. bitforce->kname = KNAME_WORK;
  249. goto re_send;
  250. }
  251. applog(LOG_ERR, "BFL%i: Error: Send work reports: %s", bitforce->device_id, pdevbuf);
  252. return false;
  253. }
  254. sprintf((char *)ob, ">>>>>>>>");
  255. memcpy(ob + 8, work->midstate, 32);
  256. memcpy(ob + 8 + 32, work->data + 64, 12);
  257. if (!bitforce->nonce_range) {
  258. sprintf((char *)ob + 8 + 32 + 12, ">>>>>>>>");
  259. work->blk.nonce = bitforce->nonces = 0xffffffff;
  260. BFwrite(fdDev, ob, 60);
  261. } else {
  262. uint32_t *nonce;
  263. nonce = (uint32_t *)(ob + 8 + 32 + 12);
  264. *nonce = htobe32(work->blk.nonce);
  265. nonce = (uint32_t *)(ob + 8 + 32 + 12 + 4);
  266. /* Split work up into 1/5th nonce ranges */
  267. bitforce->nonces = 0x33333332;
  268. *nonce = htobe32(work->blk.nonce + bitforce->nonces);
  269. work->blk.nonce += bitforce->nonces + 1;
  270. sprintf((char *)ob + 8 + 32 + 12 + 8, ">>>>>>>>");
  271. BFwrite(fdDev, ob, 68);
  272. }
  273. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  274. mutex_unlock(&bitforce->device_mutex);
  275. if (opt_debug) {
  276. s = bin2hex(ob + 8, 44);
  277. applog(LOG_DEBUG, "BFL%i: block data: %s", bitforce->device_id, s);
  278. free(s);
  279. }
  280. if (unlikely(!pdevbuf[0])) {
  281. applog(LOG_ERR, "BFL%i: Error: Send block data returned empty string/timed out", bitforce->device_id);
  282. return false;
  283. }
  284. if (unlikely(strncasecmp(pdevbuf, "OK", 2))) {
  285. applog(LOG_ERR, "BFL%i: Error: Send block data reports: %s", bitforce->device_id, pdevbuf);
  286. return false;
  287. }
  288. gettimeofday(&bitforce->work_start_tv, NULL);
  289. return true;
  290. }
  291. static int64_t bitforce_get_result(struct thr_info *thr, struct work *work)
  292. {
  293. struct cgpu_info *bitforce = thr->cgpu;
  294. int fdDev = bitforce->device_fd;
  295. unsigned int delay_time_ms;
  296. struct timeval elapsed;
  297. struct timeval now;
  298. char pdevbuf[0x100];
  299. char *pnoncebuf;
  300. uint32_t nonce;
  301. if (!fdDev)
  302. return -1;
  303. while (1) {
  304. if (unlikely(thr->work_restart))
  305. return 0;
  306. mutex_lock(&bitforce->device_mutex);
  307. BFwrite(fdDev, "ZFX", 3);
  308. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  309. mutex_unlock(&bitforce->device_mutex);
  310. gettimeofday(&now, NULL);
  311. timersub(&now, &bitforce->work_start_tv, &elapsed);
  312. if (elapsed.tv_sec >= BITFORCE_LONG_TIMEOUT_S) {
  313. applog(LOG_ERR, "BFL%i: took %dms - longer than %dms", bitforce->device_id,
  314. tv_to_ms(elapsed), BITFORCE_LONG_TIMEOUT_MS);
  315. return 0;
  316. }
  317. if (pdevbuf[0] && strncasecmp(pdevbuf, "B", 1)) /* BFL does not respond during throttling */
  318. break;
  319. /* if BFL is throttling, no point checking so quickly */
  320. delay_time_ms = (pdevbuf[0] ? BITFORCE_CHECK_INTERVAL_MS : 2 * WORK_CHECK_INTERVAL_MS);
  321. nmsleep(delay_time_ms);
  322. bitforce->wait_ms += delay_time_ms;
  323. }
  324. if (elapsed.tv_sec > BITFORCE_TIMEOUT_S) {
  325. applog(LOG_ERR, "BFL%i: took %dms - longer than %dms", bitforce->device_id,
  326. tv_to_ms(elapsed), BITFORCE_TIMEOUT_MS);
  327. bitforce->device_last_not_well = time(NULL);
  328. bitforce->device_not_well_reason = REASON_DEV_OVER_HEAT;
  329. bitforce->dev_over_heat_count++;
  330. if (!pdevbuf[0]) /* Only return if we got nothing after timeout - there still may be results */
  331. return 0;
  332. } else if (!strncasecmp(pdevbuf, "N", 1)) {/* Hashing complete (NONCE-FOUND or NO-NONCE) */
  333. /* Simple timing adjustment. Allow a few polls to cope with
  334. * OS timer delays being variably reliable. wait_ms will
  335. * always equal sleep_ms when we've waited greater than or
  336. * equal to the result return time.*/
  337. delay_time_ms = bitforce->sleep_ms;
  338. if (bitforce->wait_ms > bitforce->sleep_ms + (WORK_CHECK_INTERVAL_MS * 2))
  339. bitforce->sleep_ms += (bitforce->wait_ms - bitforce->sleep_ms) / 2;
  340. else if (bitforce->wait_ms == bitforce->sleep_ms) {
  341. if (bitforce->sleep_ms > WORK_CHECK_INTERVAL_MS)
  342. bitforce->sleep_ms -= WORK_CHECK_INTERVAL_MS;
  343. else if (bitforce->sleep_ms > BITFORCE_CHECK_INTERVAL_MS)
  344. bitforce->sleep_ms -= BITFORCE_CHECK_INTERVAL_MS;
  345. }
  346. if (delay_time_ms != bitforce->sleep_ms)
  347. applog(LOG_DEBUG, "BFL%i: Wait time changed to: %d, waited %u", bitforce->device_id, bitforce->sleep_ms, bitforce->wait_ms);
  348. /* Work out the average time taken. Float for calculation, uint for display */
  349. bitforce->avg_wait_f += (tv_to_ms(elapsed) - bitforce->avg_wait_f) / TIME_AVG_CONSTANT;
  350. bitforce->avg_wait_d = (unsigned int) (bitforce->avg_wait_f + 0.5);
  351. }
  352. applog(LOG_DEBUG, "BFL%i: waited %dms until %s", bitforce->device_id, bitforce->wait_ms, pdevbuf);
  353. if (!strncasecmp(&pdevbuf[2], "-", 1))
  354. return bitforce->nonces; /* No valid nonce found */
  355. else if (!strncasecmp(pdevbuf, "I", 1))
  356. return 0; /* Device idle */
  357. else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
  358. applog(LOG_WARNING, "BFL%i: Error: Get result reports: %s", bitforce->device_id, pdevbuf);
  359. return 0;
  360. }
  361. pnoncebuf = &pdevbuf[12];
  362. while (1) {
  363. hex2bin((void*)&nonce, pnoncebuf, 4);
  364. #ifndef __BIG_ENDIAN__
  365. nonce = swab32(nonce);
  366. #endif
  367. if (unlikely(bitforce->nonce_range && (nonce >= work->blk.nonce ||
  368. (work->blk.nonce > 0 && nonce < work->blk.nonce - bitforce->nonces - 1)))) {
  369. applog(LOG_WARNING, "BFL%i: Disabling broken nonce range support", bitforce->device_id);
  370. bitforce->nonce_range = false;
  371. work->blk.nonce = 0xffffffff;
  372. bitforce->sleep_ms *= 5;
  373. bitforce->kname = KNAME_WORK;
  374. }
  375. submit_nonce(thr, work, nonce);
  376. if (strncmp(&pnoncebuf[8], ",", 1))
  377. break;
  378. pnoncebuf += 9;
  379. }
  380. return bitforce->nonces;
  381. }
  382. static void bitforce_shutdown(struct thr_info *thr)
  383. {
  384. struct cgpu_info *bitforce = thr->cgpu;
  385. BFclose(bitforce->device_fd);
  386. bitforce->device_fd = 0;
  387. }
  388. static void biforce_thread_enable(struct thr_info *thr)
  389. {
  390. struct cgpu_info *bitforce = thr->cgpu;
  391. bitforce_init(bitforce);
  392. }
  393. static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_t __maybe_unused max_nonce)
  394. {
  395. struct cgpu_info *bitforce = thr->cgpu;
  396. unsigned int sleep_time;
  397. bool send_ret;
  398. int64_t ret;
  399. send_ret = bitforce_send_work(thr, work);
  400. if (!bitforce->nonce_range) {
  401. /* Initially wait 2/3 of the average cycle time so we can request more
  402. work before full scan is up */
  403. sleep_time = (2 * bitforce->sleep_ms) / 3;
  404. if (!restart_wait(sleep_time))
  405. return 0;
  406. bitforce->wait_ms = sleep_time;
  407. queue_request(thr, false);
  408. /* Now wait athe final 1/3rd; no bitforce should be finished by now */
  409. sleep_time = bitforce->sleep_ms - sleep_time;
  410. if (!restart_wait(sleep_time))
  411. return 0;
  412. bitforce->wait_ms += sleep_time;
  413. } else {
  414. sleep_time = bitforce->sleep_ms;
  415. if (!restart_wait(sleep_time))
  416. return 0;
  417. bitforce->wait_ms = sleep_time;
  418. }
  419. if (send_ret)
  420. ret = bitforce_get_result(thr, work);
  421. else
  422. ret = -1;
  423. if (ret == -1) {
  424. ret = 0;
  425. applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id);
  426. bitforce->device_last_not_well = time(NULL);
  427. bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR;
  428. bitforce->dev_comms_error_count++;
  429. /* empty read buffer */
  430. biforce_clear_buffer(bitforce);
  431. }
  432. return ret;
  433. }
  434. static bool bitforce_get_stats(struct cgpu_info *bitforce)
  435. {
  436. return bitforce_get_temp(bitforce);
  437. }
  438. static bool bitforce_thread_init(struct thr_info *thr)
  439. {
  440. struct cgpu_info *bitforce = thr->cgpu;
  441. unsigned int wait;
  442. /* Pause each new thread at least 100ms between initialising
  443. * so the devices aren't making calls all at the same time. */
  444. wait = thr->id * MAX_START_DELAY_US;
  445. applog(LOG_DEBUG, "BFL%i: Delaying start by %dms", bitforce->device_id, wait / 1000);
  446. usleep(wait);
  447. return true;
  448. }
  449. static struct api_data *bitforce_api_stats(struct cgpu_info *cgpu)
  450. {
  451. struct api_data *root = NULL;
  452. // Warning, access to these is not locked - but we don't really
  453. // care since hashing performance is way more important than
  454. // locking access to displaying API debug 'stats'
  455. // If locking becomes an issue for any of them, use copy_data=true also
  456. root = api_add_uint(root, "Sleep Time", &(cgpu->sleep_ms), false);
  457. root = api_add_uint(root, "Avg Wait", &(cgpu->avg_wait_d), false);
  458. return root;
  459. }
  460. struct device_api bitforce_api = {
  461. .dname = "bitforce",
  462. .name = "BFL",
  463. .api_detect = bitforce_detect,
  464. .get_api_stats = bitforce_api_stats,
  465. .reinit_device = bitforce_init,
  466. .get_statline_before = get_bitforce_statline_before,
  467. .get_stats = bitforce_get_stats,
  468. .thread_prepare = bitforce_thread_prepare,
  469. .thread_init = bitforce_thread_init,
  470. .scanhash = bitforce_scanhash,
  471. .thread_shutdown = bitforce_shutdown,
  472. .thread_enable = biforce_thread_enable
  473. };