driver-minion.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*
  2. * Copyright 2014 Luke Dashjr
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the Free
  6. * Software Foundation; either version 3 of the License, or (at your option)
  7. * any later version. See COPYING for more details.
  8. */
  9. #include "config.h"
  10. #include <stdbool.h>
  11. #include <stddef.h>
  12. #include <stdint.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <linux/spi/spidev.h>
  16. #include <utlist.h>
  17. #include "deviceapi.h"
  18. #include "logging.h"
  19. #include "lowl-spi.h"
  20. #include "miner.h"
  21. #include "util.h"
  22. static const uint8_t minion_max_chipid = 0x1f;
  23. static const uint8_t minion_chip_signature[] = {0x44, 0x8a, 0xac, 0xb1};
  24. static const unsigned minion_max_queued = 0x10;
  25. static const unsigned minion_poll_us = 10000;
  26. static const unsigned minion_min_clock = 800;
  27. static const unsigned minion_max_clock = 1999;
  28. enum minion_register {
  29. MRA_SIGNATURE = 0x00,
  30. MRA_STATUS = 0x01,
  31. MRA_PLL_CFG = 0x04,
  32. MRA_MISC_CTL = 0x06,
  33. MRA_RESET = 0x07,
  34. MRA_FIFO_STATUS = 0x0b,
  35. MRA_CORE_EN_ = 0x10,
  36. MRA_RESULT = 0x20,
  37. MRA_TASK = 0x30,
  38. MRA_NONCE_START = 0x70,
  39. MRA_NONCE_INC = 0x71,
  40. };
  41. struct minion_chip {
  42. uint8_t chipid;
  43. uint8_t core_count;
  44. uint8_t core_enabled_count;
  45. uint16_t next_taskid;
  46. struct cgpu_info *first_proc;
  47. unsigned queue_count;
  48. uint32_t core_nonce_inc;
  49. uint32_t pllcfg_asserted;
  50. uint32_t pllcfg_desired;
  51. };
  52. struct minion_bus {
  53. struct spi_port *spi;
  54. };
  55. static const uint8_t minion_crystal_mhz = 12;
  56. static
  57. uint32_t minion_freq_to_pllcfg(unsigned freq)
  58. {
  59. uint32_t rv;
  60. uint8_t * const pllcfg = (void*)&rv;
  61. uint8_t best_rem = 12, pll_dm = 1;
  62. for (uint8_t try_dm = 1; try_dm <= 8; ++try_dm)
  63. {
  64. const unsigned x = freq * try_dm;
  65. if (x > 0x100 * minion_crystal_mhz)
  66. // We'd overflow pll_dn to continue
  67. break;
  68. const uint8_t rem = x % minion_crystal_mhz;
  69. if (rem > best_rem)
  70. continue;
  71. best_rem = rem;
  72. pll_dm = try_dm;
  73. if (!rem)
  74. break;
  75. }
  76. const unsigned pll_dn = freq * pll_dm / minion_crystal_mhz;
  77. freq = pll_dn * minion_crystal_mhz / pll_dm;
  78. const uint8_t pll_cont = ((freq - 800) / 300); // 2 bits
  79. static const uint8_t pll_dp = 0; // 3 bits
  80. static const uint8_t pll_byp = 0; // 1 bit
  81. static const uint8_t pll_div2 = 0; // 1 bit
  82. static const uint8_t sys_div = 1; // 3 bits
  83. pllcfg[0] = pll_dn - 1;
  84. pllcfg[1] = (pll_dm - 1) | (pll_dp << 4);
  85. pllcfg[2] = pll_cont | (pll_byp << 2) | (pll_div2 << 4) | (sys_div << 5);
  86. pllcfg[3] = 0;
  87. return rv;
  88. }
  89. static
  90. unsigned minion_pllcfg_to_freq(const uint32_t in_pllcfg)
  91. {
  92. const uint8_t * const pllcfg = (void*)&in_pllcfg;
  93. const unsigned pll_dn = (unsigned)pllcfg[0] + 1;
  94. const uint8_t pll_dm = (pllcfg[1] & 0xf) + 1;
  95. const unsigned freq = pll_dn * minion_crystal_mhz / pll_dm;
  96. // FIXME: How to interpret the rest of the pll cfg?
  97. if (minion_freq_to_pllcfg(freq) != in_pllcfg)
  98. return 0;
  99. return freq;
  100. }
  101. static
  102. void minion_get(struct spi_port * const spi, const uint8_t chipid, const uint8_t addr, void * const buf, const size_t bufsz)
  103. {
  104. const uint8_t header[] = {chipid, addr | 0x80, bufsz & 0xff, bufsz >> 8};
  105. spi_clear_buf(spi);
  106. spi_emit_buf(spi, header, sizeof(header));
  107. uint8_t dummy[bufsz];
  108. memset(dummy, 0xff, bufsz);
  109. spi_emit_buf(spi, dummy, bufsz);
  110. spi_txrx(spi);
  111. uint8_t * const rdbuf = spi_getrxbuf(spi);
  112. memcpy(buf, &rdbuf[sizeof(header)], bufsz);
  113. }
  114. static
  115. void minion_set(struct spi_port * const spi, const uint8_t chipid, const uint8_t addr, const void * const buf, const size_t bufsz)
  116. {
  117. const uint8_t header[] = {chipid, addr, bufsz & 0xff, bufsz >> 8};
  118. spi_clear_buf(spi);
  119. spi_emit_buf(spi, header, sizeof(header));
  120. spi_emit_buf(spi, buf, bufsz);
  121. spi_txrx(spi);
  122. }
  123. static
  124. unsigned minion_count_cores(struct spi_port * const spi)
  125. {
  126. uint8_t buf[max(4, sizeof(minion_chip_signature))];
  127. unsigned total_core_count = 0;
  128. for (unsigned chipid = 0; chipid <= minion_max_chipid; ++chipid)
  129. {
  130. minion_get(spi, chipid, MRA_SIGNATURE, buf, sizeof(minion_chip_signature));
  131. if (memcmp(buf, minion_chip_signature, sizeof(minion_chip_signature)))
  132. {
  133. for (unsigned i = 0; i < sizeof(minion_chip_signature); ++i)
  134. {
  135. if (buf[i] != 0xff)
  136. {
  137. char hex[(sizeof(minion_chip_signature) * 2) + 1];
  138. bin2hex(hex, buf, sizeof(minion_chip_signature));
  139. applog(LOG_DEBUG, "%s: chipid %u: Bad signature (%s)", spi->repr, chipid, hex);
  140. break;
  141. }
  142. }
  143. continue;
  144. }
  145. minion_get(spi, chipid, MRA_STATUS, buf, 4);
  146. const uint8_t core_count = buf[2];
  147. applog(LOG_DEBUG, "%s: chipid %u: Found %u cores", spi->repr, chipid, core_count);
  148. total_core_count += core_count;
  149. }
  150. return total_core_count;
  151. }
  152. static inline
  153. void minion_config_pll(struct spi_port * const spi, struct minion_chip * const chip)
  154. {
  155. if (chip->pllcfg_asserted == chip->pllcfg_desired)
  156. return;
  157. const uint8_t chipid = chip->chipid;
  158. minion_set(spi, chipid, MRA_PLL_CFG, &chip->pllcfg_desired, 4);
  159. chip->pllcfg_asserted = chip->pllcfg_desired;
  160. }
  161. static inline
  162. void minion_core_enable_register_position(const uint8_t coreid, uint8_t * const corereg, uint8_t * const corebyte, uint8_t * const corebit)
  163. {
  164. *corereg = MRA_CORE_EN_ + (coreid >> 5);
  165. *corebyte = (coreid >> 3) % 4;
  166. *corebit = 1 << (coreid % 8);
  167. }
  168. static
  169. bool minion_init(struct thr_info * const thr)
  170. {
  171. struct cgpu_info * const dev = thr->cgpu, *proc = dev;
  172. struct minion_bus * const mbus = dev->device_data;
  173. struct spi_port * const spi = mbus->spi;
  174. uint8_t buf[max(4, sizeof(minion_chip_signature))];
  175. struct minion_chip * const chips = malloc(sizeof(*chips) * ((size_t)minion_max_chipid + 1));
  176. for (unsigned chipid = 0; proc; ++chipid)
  177. {
  178. struct minion_chip * const chip = &chips[chipid];
  179. spi->repr = proc->proc_repr;
  180. minion_get(spi, chipid, MRA_SIGNATURE, buf, sizeof(minion_chip_signature));
  181. if (memcmp(buf, minion_chip_signature, sizeof(minion_chip_signature)))
  182. continue;
  183. minion_get(spi, chipid, MRA_STATUS, buf, 4);
  184. if (!buf[2])
  185. continue;
  186. static const uint8_t resetcmd[4] = {0xff, 0xff, 0xa5, 0xf5};
  187. minion_set(spi, chipid, MRA_RESET, resetcmd, sizeof(resetcmd));
  188. *chip = (struct minion_chip){
  189. .chipid = chipid,
  190. .core_count = buf[2],
  191. .first_proc = proc,
  192. .pllcfg_desired = minion_freq_to_pllcfg(900),
  193. };
  194. minion_set(spi, chipid, MRA_NONCE_START, "\0\0\0\0", 4);
  195. chip->core_nonce_inc = 0xffffffff / chip->core_count;
  196. pk_u32le(buf, 0, chip->core_nonce_inc);
  197. minion_set(spi, chipid, MRA_NONCE_INC, buf, 4);
  198. minion_get(spi, chipid, MRA_PLL_CFG, &chip->pllcfg_asserted, 4);
  199. minion_get(spi, chipid, MRA_MISC_CTL, buf, 4);
  200. buf[0] &= ~(1 << 4); // Unpause cores
  201. buf[0] &= ~(1 << 3); // Unpause queue
  202. buf[0] |= 1 << 2; // Enable "no nonce" result reports
  203. buf[0] &= ~(1 << 1); // Disable test mode
  204. minion_set(spi, chipid, MRA_MISC_CTL, buf, 4);
  205. timer_set_delay_from_now(&proc->thr[0]->tv_poll, minion_poll_us);
  206. for (unsigned coreid = 0; coreid < chip->core_count; ++coreid)
  207. {
  208. struct thr_info * const thr = proc->thr[0];
  209. uint8_t corereg, corebyte, corebit;
  210. minion_core_enable_register_position(coreid, &corereg, &corebyte, &corebit);
  211. if (coreid % 0x20 == 0)
  212. {
  213. spi->repr = proc->proc_repr;
  214. minion_get(spi, chipid, corereg, buf, 4);
  215. }
  216. if (buf[corebyte] & corebit)
  217. ++chip->core_enabled_count;
  218. else
  219. proc->deven = DEV_DISABLED;
  220. thr->cgpu_data = chip;
  221. proc = proc->next_proc;
  222. }
  223. }
  224. return true;
  225. }
  226. static
  227. bool minion_queue_full(struct minion_chip * const chip)
  228. {
  229. struct cgpu_info *proc = chip->first_proc;
  230. struct thr_info *thr = proc->thr[0];
  231. const bool full = (chip->queue_count >= minion_max_queued);
  232. if (full != thr->queue_full)
  233. {
  234. for (unsigned i = 0; i < chip->core_count; (proc = proc->next_proc), ++i)
  235. {
  236. thr = proc->thr[0];
  237. thr->queue_full = full;
  238. }
  239. }
  240. return full;
  241. }
  242. static
  243. void minion_core_enabledisable(struct thr_info * const thr, const bool enable)
  244. {
  245. struct cgpu_info * const proc = thr->cgpu;
  246. struct minion_bus * const mbus = proc->device_data;
  247. struct minion_chip * const chip = thr->cgpu_data;
  248. struct spi_port * const spi = mbus->spi;
  249. const uint8_t chipid = chip->chipid;
  250. uint8_t coreid = 0;
  251. for (struct cgpu_info *p = chip->first_proc; p != proc; p = p->next_proc)
  252. ++coreid;
  253. uint8_t corereg, corebyte, corebit;
  254. minion_core_enable_register_position(coreid, &corereg, &corebyte, &corebit);
  255. uint8_t buf[4];
  256. minion_get(spi, chipid, corereg, buf, 4);
  257. const uint8_t oldbyte = buf[corebyte];
  258. if (enable)
  259. buf[corebyte] |= corebit;
  260. else
  261. buf[corebyte] &= ~corebit;
  262. if (buf[corebyte] != oldbyte)
  263. {
  264. minion_set(spi, chipid, corereg, buf, 4);
  265. chip->core_enabled_count += enable ? 1 : -1;
  266. }
  267. }
  268. static
  269. void minion_core_disable(struct thr_info * const thr)
  270. {
  271. minion_core_enabledisable(thr, false);
  272. }
  273. static
  274. void minion_core_enable(struct thr_info * const thr)
  275. {
  276. minion_core_enabledisable(thr, true);
  277. }
  278. static
  279. bool minion_queue_append(struct thr_info *thr, struct work * const work)
  280. {
  281. struct cgpu_info *proc = thr->cgpu;
  282. struct minion_bus * const mbus = proc->device_data;
  283. struct minion_chip * const chip = thr->cgpu_data;
  284. proc = chip->first_proc;
  285. thr = proc->thr[0];
  286. if (minion_queue_full(chip))
  287. return false;
  288. struct spi_port * const spi = mbus->spi;
  289. const uint8_t chipid = chip->chipid;
  290. uint8_t taskdata[0x30];
  291. spi->repr = proc->proc_repr;
  292. work->device_id = ++chip->next_taskid;
  293. work->tv_stamp.tv_sec = 1;
  294. work->blk.nonce = 0;
  295. pk_u16be(taskdata, 0, work->device_id);
  296. memset(&taskdata[2], 0, 2);
  297. memcpy(&taskdata[4], work->midstate, 0x20);
  298. memcpy(&taskdata[0x24], &work->data[0x40], 0xc);
  299. minion_config_pll(spi, chip);
  300. minion_set(spi, chipid, MRA_TASK, taskdata, sizeof(taskdata));
  301. DL_APPEND(thr->work_list, work);
  302. ++chip->queue_count;
  303. minion_queue_full(chip);
  304. return true;
  305. }
  306. static
  307. void minion_queue_flush(struct thr_info * const thr)
  308. {
  309. struct cgpu_info * const proc = thr->cgpu;
  310. struct minion_bus * const mbus = proc->device_data;
  311. struct minion_chip * const chip = thr->cgpu_data;
  312. if (proc != chip->first_proc)
  313. // Redundant, all queues flush at the same time
  314. return;
  315. const uint8_t chipid = chip->chipid;
  316. struct spi_port * const spi = mbus->spi;
  317. static const uint8_t flushcmd[4] = {0xfb, 0xff, 0xff, 0xff};
  318. minion_set(spi, chipid, MRA_RESET, flushcmd, sizeof(flushcmd));
  319. struct work *work;
  320. DL_FOREACH(thr->work_list, work)
  321. {
  322. work->tv_stamp.tv_sec = 0;
  323. }
  324. chip->queue_count = 0;
  325. minion_queue_full(chip);
  326. }
  327. static
  328. void minion_hashes_done(struct cgpu_info *proc, const uint8_t core_count, const uint64_t hashes)
  329. {
  330. for (int j = 0; j < core_count; (proc = proc->next_proc), ++j)
  331. {
  332. if (proc->deven != DEV_ENABLED)
  333. continue;
  334. struct thr_info * const thr = proc->thr[0];
  335. hashes_done2(thr, hashes, NULL);
  336. }
  337. }
  338. static
  339. void minion_poll(struct thr_info * const chip_thr)
  340. {
  341. struct cgpu_info * const first_proc = chip_thr->cgpu;
  342. struct minion_bus * const mbus = first_proc->device_data;
  343. struct minion_chip * const chip = chip_thr->cgpu_data;
  344. struct spi_port * const spi = mbus->spi;
  345. const uint8_t chipid = chip->chipid;
  346. spi->repr = first_proc->proc_repr;
  347. uint8_t buf[4];
  348. minion_get(spi, chipid, MRA_FIFO_STATUS, buf, 4);
  349. const uint8_t res_fifo_len = buf[0];
  350. if (res_fifo_len)
  351. {
  352. static const size_t resbuf_i_len = 8;
  353. const size_t resbuf_len = (size_t)res_fifo_len * resbuf_i_len;
  354. uint8_t resbuf[resbuf_len], *resbuf_i = resbuf;
  355. minion_get(spi, chipid, MRA_RESULT, resbuf, resbuf_len);
  356. for (unsigned i = 0; i < res_fifo_len; (resbuf_i += resbuf_i_len), ++i)
  357. {
  358. const uint8_t coreid = resbuf_i[2];
  359. work_device_id_t taskid = upk_u16be(resbuf_i, 0);
  360. const bool have_nonce = !(resbuf_i[3] & 0x80);
  361. struct cgpu_info *proc;
  362. struct thr_info *core_thr;
  363. bool clean = false;
  364. if (likely(coreid < chip->core_count))
  365. {
  366. proc = first_proc;
  367. for (int j = 0; j < coreid; ++j)
  368. proc = proc->next_proc;
  369. core_thr = proc->thr[0];
  370. }
  371. else
  372. {
  373. proc = first_proc;
  374. core_thr = proc->thr[0];
  375. inc_hw_errors_only(core_thr);
  376. applog(LOG_ERR, "%"PRIpreprv": Core id out of range (%u >= %u)", proc->proc_repr, coreid, chip->core_count);
  377. }
  378. struct work *work;
  379. DL_SEARCH_SCALAR(chip_thr->work_list, work, device_id, taskid);
  380. if (unlikely(!work))
  381. {
  382. inc_hw_errors_only(core_thr);
  383. applog(LOG_ERR, "%"PRIpreprv": Unknown task %"PRIwdi, proc->proc_repr, taskid);
  384. continue;
  385. }
  386. if (have_nonce)
  387. {
  388. const uint32_t nonce = upk_u32le(resbuf_i, 4);
  389. if (submit_nonce(core_thr, work, nonce))
  390. {
  391. clean = (coreid < chip->core_count);
  392. // It's only 0xffffffff if we prematurely considered it complete
  393. if (likely(work->blk.nonce != 0xffffffff))
  394. {
  395. uint32_t hashes = (nonce % chip->core_nonce_inc);
  396. if (hashes > work->blk.nonce)
  397. {
  398. hashes -= work->blk.nonce - 1;
  399. minion_hashes_done(first_proc, chip->core_count, hashes);
  400. work->blk.nonce = hashes + 1;
  401. }
  402. }
  403. }
  404. }
  405. else
  406. {
  407. const uint32_t hashes = chip->core_nonce_inc - work->blk.nonce;
  408. minion_hashes_done(first_proc, chip->core_count, hashes);
  409. work->blk.nonce = 0xffffffff;
  410. }
  411. // Flag previous work(s) as done, and delete them when we are sure
  412. struct work *work_tmp;
  413. DL_FOREACH_SAFE(chip_thr->work_list, work, work_tmp)
  414. {
  415. if (work->device_id == taskid)
  416. break;
  417. if (work->blk.nonce && work->blk.nonce != 0xffffffff)
  418. {
  419. // At least one nonce was found, assume the job completed
  420. const uint32_t hashes = chip->core_nonce_inc - work->blk.nonce;
  421. minion_hashes_done(first_proc, chip->core_count, hashes);
  422. work->blk.nonce = 0xffffffff;
  423. }
  424. if (work->tv_stamp.tv_sec)
  425. {
  426. --chip->queue_count;
  427. work->tv_stamp.tv_sec = 0;
  428. }
  429. if (clean)
  430. {
  431. DL_DELETE(chip_thr->work_list, work);
  432. free_work(work);
  433. }
  434. }
  435. }
  436. minion_queue_full(chip);
  437. }
  438. minion_config_pll(spi, chip);
  439. timer_set_delay_from_now(&chip_thr->tv_poll, minion_poll_us);
  440. }
  441. static
  442. struct api_data *minion_get_api_extra_device_status(struct cgpu_info * const proc)
  443. {
  444. struct thr_info * const thr = proc->thr[0];
  445. struct minion_chip * const chip = thr->cgpu_data;
  446. struct api_data *root = NULL;
  447. double d;
  448. d = minion_pllcfg_to_freq(chip->pllcfg_asserted);
  449. if (d > 0)
  450. root = api_add_freq(root, "Frequency", &d, true);
  451. return root;
  452. }
  453. static
  454. const char *minion_set_clock(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
  455. {
  456. struct thr_info * const thr = proc->thr[0];
  457. struct minion_chip * const chip = thr->cgpu_data;
  458. const int nv = atoi(newvalue);
  459. if (nv < minion_min_clock || nv > minion_max_clock)
  460. {
  461. sprintf(replybuf, "Clock frequency must be within range of %u-%u MHz", minion_min_clock, minion_max_clock);
  462. return replybuf;
  463. }
  464. const uint32_t pllcfg = minion_freq_to_pllcfg(nv);
  465. chip->pllcfg_desired = pllcfg;
  466. return NULL;
  467. }
  468. static const struct bfg_set_device_definition minion_set_device_funcs[] = {
  469. {"clock", minion_set_clock, "clock frequency"},
  470. {NULL},
  471. };
  472. BFG_REGISTER_DRIVER(minion_drv)
  473. static
  474. bool minion_detect_one(const char * const devpath)
  475. {
  476. spi_init();
  477. struct spi_port *spi = malloc(sizeof(*spi));
  478. // Be careful, read lowl-spi.h comments for warnings
  479. memset(spi, 0, sizeof(*spi));
  480. spi->speed = 50000000;
  481. spi->mode = SPI_MODE_0;
  482. spi->bits = 8;
  483. spi->txrx = linux_spi_txrx2;
  484. if (spi_open(spi, devpath) < 0)
  485. {
  486. free(spi);
  487. applogr(false, LOG_ERR, "%s: Failed to open %s", minion_drv.dname, devpath);
  488. }
  489. spi->repr = minion_drv.dname;
  490. spi->logprio = LOG_WARNING;
  491. const unsigned total_core_count = minion_count_cores(spi);
  492. struct minion_bus * const mbus = malloc(sizeof(*mbus));
  493. *mbus = (struct minion_bus){
  494. .spi = spi,
  495. };
  496. struct cgpu_info * const cgpu = malloc(sizeof(*cgpu));
  497. *cgpu = (struct cgpu_info){
  498. .drv = &minion_drv,
  499. .device_path = strdup(devpath),
  500. .device_data = mbus,
  501. .set_device_funcs = minion_set_device_funcs,
  502. .deven = DEV_ENABLED,
  503. .procs = total_core_count,
  504. .threads = 1,
  505. };
  506. return add_cgpu(cgpu);
  507. }
  508. static
  509. int minion_detect_auto(void)
  510. {
  511. return minion_detect_one("/dev/spidev0.0") ? 1 : 0;
  512. }
  513. static
  514. void minion_detect(void)
  515. {
  516. generic_detect(&minion_drv, minion_detect_one, minion_detect_auto, GDF_REQUIRE_DNAME | GDF_DEFAULT_NOAUTO);
  517. }
  518. struct device_drv minion_drv = {
  519. .dname = "minion",
  520. .name = "MNN",
  521. .drv_detect = minion_detect,
  522. .thread_init = minion_init,
  523. .minerloop = minerloop_queue,
  524. .thread_disable = minion_core_disable,
  525. .thread_enable = minion_core_enable,
  526. .queue_append = minion_queue_append,
  527. .queue_flush = minion_queue_flush,
  528. .poll = minion_poll,
  529. .get_api_extra_device_status = minion_get_api_extra_device_status,
  530. };