|
@@ -37,6 +37,8 @@
|
|
|
#include "lowl-spi.h"
|
|
#include "lowl-spi.h"
|
|
|
#include "util.h"
|
|
#include "util.h"
|
|
|
|
|
|
|
|
|
|
+static const int chipgen_timeout_secs = 30;
|
|
|
|
|
+
|
|
|
BFG_REGISTER_DRIVER(bitfury_drv)
|
|
BFG_REGISTER_DRIVER(bitfury_drv)
|
|
|
const struct bfg_set_device_definition bitfury_set_device_funcs[];
|
|
const struct bfg_set_device_definition bitfury_set_device_funcs[];
|
|
|
|
|
|
|
@@ -541,9 +543,11 @@ void bitfury_do_io(struct thr_info * const master_thr)
|
|
|
copy_time(tvp_stat, &tv_now);
|
|
copy_time(tvp_stat, &tv_now);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int stat_elapsed_secs = timer_elapsed(tvp_stat, &tv_now);
|
|
|
|
|
+
|
|
|
if (c->osc6_max)
|
|
if (c->osc6_max)
|
|
|
{
|
|
{
|
|
|
- if (timer_elapsed(tvp_stat, &tv_now) >= 60)
|
|
|
|
|
|
|
+ if (stat_elapsed_secs >= 60)
|
|
|
{
|
|
{
|
|
|
double mh_diff, s_diff;
|
|
double mh_diff, s_diff;
|
|
|
const int osc = bitfury->osc6_bits;
|
|
const int osc = bitfury->osc6_bits;
|
|
@@ -588,22 +592,22 @@ void bitfury_do_io(struct thr_info * const master_thr)
|
|
|
nonce = bitfury_decnonce(newbuf[i]);
|
|
nonce = bitfury_decnonce(newbuf[i]);
|
|
|
if (unlikely(!bitfury->chipgen))
|
|
if (unlikely(!bitfury->chipgen))
|
|
|
{
|
|
{
|
|
|
- switch (nonce)
|
|
|
|
|
|
|
+ switch (nonce & 0xe03fffff)
|
|
|
{
|
|
{
|
|
|
- case 0x6cc054e0:
|
|
|
|
|
- if (++bitfury->chipgen_probe > 4)
|
|
|
|
|
|
|
+ case 0x40060f87:
|
|
|
|
|
+ case 0x600054e0:
|
|
|
|
|
+ case 0x80156423:
|
|
|
|
|
+ case 0x991abced:
|
|
|
|
|
+ case 0xa004b2a0:
|
|
|
|
|
+ if (++bitfury->chipgen_probe > 0x10)
|
|
|
bitfury->chipgen = 1;
|
|
bitfury->chipgen = 1;
|
|
|
break;
|
|
break;
|
|
|
- case 0xed7081a3:
|
|
|
|
|
- case 0xf883df88:
|
|
|
|
|
|
|
+ case 0xe03081a3:
|
|
|
|
|
+ case 0xe003df88:
|
|
|
bitfury->chipgen = 2;
|
|
bitfury->chipgen = 2;
|
|
|
}
|
|
}
|
|
|
if (bitfury->chipgen)
|
|
if (bitfury->chipgen)
|
|
|
- {
|
|
|
|
|
- applog(LOG_DEBUG, "%"PRIpreprv": Detected bitfury gen%d chip",
|
|
|
|
|
- proc->proc_repr, bitfury->chipgen);
|
|
|
|
|
- bitfury_payload_to_atrvec(bitfury->atrvec, &bitfury->payload);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ goto chipgen_detected;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
if (fudge_nonce(thr->work, &nonce))
|
|
if (fudge_nonce(thr->work, &nonce))
|
|
@@ -643,6 +647,16 @@ void bitfury_do_io(struct thr_info * const master_thr)
|
|
|
bitfury->sample_tot = bitfury->sample_hwe = 0;
|
|
bitfury->sample_tot = bitfury->sample_hwe = 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if ((!bitfury->chipgen) && stat_elapsed_secs >= chipgen_timeout_secs)
|
|
|
|
|
+ {
|
|
|
|
|
+ bitfury->chipgen = 1;
|
|
|
|
|
+ applog(LOG_WARNING, "%"PRIpreprv": Failed to detect chip generation in %d seconds, falling back to gen%d assumption",
|
|
|
|
|
+ proc->proc_repr, chipgen_timeout_secs, bitfury->chipgen);
|
|
|
|
|
+chipgen_detected:
|
|
|
|
|
+ applog(LOG_DEBUG, "%"PRIpreprv": Detected bitfury gen%d chip",
|
|
|
|
|
+ proc->proc_repr, bitfury->chipgen);
|
|
|
|
|
+ bitfury_payload_to_atrvec(bitfury->atrvec, &bitfury->payload);
|
|
|
|
|
+ }
|
|
|
bitfury->active = (bitfury->active + n) % 0x10;
|
|
bitfury->active = (bitfury->active + n) % 0x10;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -661,7 +675,7 @@ out:
|
|
|
bitfury->mhz_best = 0;
|
|
bitfury->mhz_best = 0;
|
|
|
bitfury->force_reinit = false;
|
|
bitfury->force_reinit = false;
|
|
|
}
|
|
}
|
|
|
- if (timer_elapsed(tvp_stat, &tv_now) >= 60)
|
|
|
|
|
|
|
+ if (stat_elapsed_secs >= 60)
|
|
|
copy_time(tvp_stat, &tv_now);
|
|
copy_time(tvp_stat, &tv_now);
|
|
|
}
|
|
}
|
|
|
|
|
|