mirror of
https://github.com/GOSTSec/sgminer
synced 2025-08-26 13:52:02 +00:00
Convert the bitfury driver to use the hash_driver_work version of hash_work.
This commit is contained in:
parent
58008a3742
commit
835ad82441
@ -5974,7 +5974,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
|
|||||||
cgtime(&work->tv_staged);
|
cgtime(&work->tv_staged);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct work *get_work(struct thr_info *thr, const int thr_id)
|
struct work *get_work(struct thr_info *thr, const int thr_id)
|
||||||
{
|
{
|
||||||
struct work *work = NULL;
|
struct work *work = NULL;
|
||||||
|
|
||||||
|
@ -220,18 +220,24 @@ static bool bitfury_checkresults(struct thr_info *thr, struct work *work, uint32
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
|
static int64_t bitfury_scanwork(struct thr_info *thr)
|
||||||
int64_t __maybe_unused max_nonce)
|
|
||||||
{
|
{
|
||||||
struct cgpu_info *bitfury = thr->cgpu;
|
struct cgpu_info *bitfury = thr->cgpu;
|
||||||
struct bitfury_info *info = bitfury->device_data;
|
struct bitfury_info *info = bitfury->device_data;
|
||||||
struct timeval tv_now;
|
struct timeval tv_now;
|
||||||
|
struct work *work;
|
||||||
double nonce_rate;
|
double nonce_rate;
|
||||||
int64_t ret = 0;
|
int64_t ret = 0;
|
||||||
int amount, i;
|
int amount, i;
|
||||||
char buf[45];
|
char buf[45];
|
||||||
int ms_diff;
|
int ms_diff;
|
||||||
|
|
||||||
|
work = get_work(thr, thr->id);
|
||||||
|
if (unlikely(thr->work_restart)) {
|
||||||
|
free_work(work);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
buf[0] = 'W';
|
buf[0] = 'W';
|
||||||
memcpy(buf + 1, work->midstate, 32);
|
memcpy(buf + 1, work->midstate, 32);
|
||||||
memcpy(buf + 33, work->data + 64, 12);
|
memcpy(buf + 33, work->data + 64, 12);
|
||||||
@ -298,8 +304,7 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
cascade:
|
cascade:
|
||||||
for (i = BF1ARRAY_SIZE; i > 0; i--)
|
for (i = BF1ARRAY_SIZE; i > 0; i--)
|
||||||
info->prevwork[i] = info->prevwork[i - 1];
|
info->prevwork[i] = info->prevwork[i - 1];
|
||||||
info->prevwork[0] = copy_work(work);
|
info->prevwork[0] = work;
|
||||||
work->blk.nonce = 0xffffffff;
|
|
||||||
|
|
||||||
info->cycles++;
|
info->cycles++;
|
||||||
info->total_nonces += info->nonces;
|
info->total_nonces += info->nonces;
|
||||||
@ -358,7 +363,8 @@ struct device_drv bitfury_drv = {
|
|||||||
.dname = "bitfury",
|
.dname = "bitfury",
|
||||||
.name = "BF1",
|
.name = "BF1",
|
||||||
.drv_detect = bitfury_detect,
|
.drv_detect = bitfury_detect,
|
||||||
.scanhash = bitfury_scanhash,
|
.hash_work = &hash_driver_work,
|
||||||
|
.scanwork = bitfury_scanwork,
|
||||||
.get_api_stats = bitfury_api_stats,
|
.get_api_stats = bitfury_api_stats,
|
||||||
.reinit_device = bitfury_init,
|
.reinit_device = bitfury_init,
|
||||||
.thread_shutdown = bitfury_shutdown,
|
.thread_shutdown = bitfury_shutdown,
|
||||||
|
1
miner.h
1
miner.h
@ -1384,6 +1384,7 @@ extern void submit_tested_work(struct thr_info *thr, struct work *work);
|
|||||||
extern bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
extern bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
||||||
extern bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,
|
extern bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,
|
||||||
int noffset);
|
int noffset);
|
||||||
|
extern struct work *get_work(struct thr_info *thr, const int thr_id);
|
||||||
extern struct work *get_queued(struct cgpu_info *cgpu);
|
extern struct work *get_queued(struct cgpu_info *cgpu);
|
||||||
extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
||||||
extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user