Browse Source

Merge to master

nfactor-troky
Con Kolivas 11 years ago
parent
commit
8dbe1a68db
  1. 2
      cgminer.c
  2. 8
      driver-bflsc.c
  3. 20
      driver-icarus.c

2
cgminer.c

@ -5988,6 +5988,7 @@ struct work *get_work(struct thr_info *thr, const int thr_id)
work->thr_id = thr_id; work->thr_id = thr_id;
thread_reportin(thr); thread_reportin(thr);
work->mined = true; work->mined = true;
work->device_diff = MIN(thr->cgpu->drv->max_diff, work->work_difficulty);
return work; return work;
} }
@ -6341,7 +6342,6 @@ static void fill_queue(struct thr_info *mythr, struct cgpu_info *cgpu, struct de
if (need_work) { if (need_work) {
struct work *work = get_work(mythr, thr_id); struct work *work = get_work(mythr, thr_id);
work->device_diff = MIN(drv->max_diff, work->work_difficulty);
wr_lock(&cgpu->qlock); wr_lock(&cgpu->qlock);
HASH_ADD_INT(cgpu->queued_work, id, work); HASH_ADD_INT(cgpu->queued_work, id, work);
wr_unlock(&cgpu->qlock); wr_unlock(&cgpu->qlock);

8
driver-bflsc.c

@ -645,11 +645,15 @@ static bool getinfo(struct cgpu_info *bflsc, int dev)
else if (strstr(firstname, BFLSC_DI_XLINKPRESENT)) else if (strstr(firstname, BFLSC_DI_XLINKPRESENT))
sc_dev.xlink_present = strdup(fields[0]); sc_dev.xlink_present = strdup(fields[0]);
else if (strstr(firstname, BFLSC_DI_DEVICESINCHAIN)) { else if (strstr(firstname, BFLSC_DI_DEVICESINCHAIN)) {
sc_info->sc_count = atoi(fields[0]); if (fields[0][0] == '0' ||
(fields[0][0] == ' ' && fields[0][1] == '0'))
sc_info->sc_count = 1;
else
sc_info->sc_count = atoi(fields[0]);
if (sc_info->sc_count < 1 || sc_info->sc_count > 30) { if (sc_info->sc_count < 1 || sc_info->sc_count > 30) {
tmp = str_text(items[i]); tmp = str_text(items[i]);
applogsiz(LOG_WARNING, BFLSC_APPLOGSIZ, applogsiz(LOG_WARNING, BFLSC_APPLOGSIZ,
"%s detect (%s) invalid s-link count: '%s'", "%s detect (%s) invalid x-link count: '%s'",
bflsc->drv->dname, bflsc->device_path, tmp); bflsc->drv->dname, bflsc->device_path, tmp);
free(tmp); free(tmp);
goto mata; goto mata;

20
driver-icarus.c

@ -1116,8 +1116,7 @@ static void cmr2_commands(struct cgpu_info *icarus)
} }
} }
static int64_t icarus_scanhash(struct thr_info *thr, struct work *work, static int64_t icarus_scanwork(struct thr_info *thr)
__maybe_unused int64_t max_nonce)
{ {
struct cgpu_info *icarus = thr->cgpu; struct cgpu_info *icarus = thr->cgpu;
struct ICARUS_INFO *info = (struct ICARUS_INFO *)(icarus->device_data); struct ICARUS_INFO *info = (struct ICARUS_INFO *)(icarus->device_data);
@ -1126,12 +1125,13 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
struct ICARUS_WORK workdata; struct ICARUS_WORK workdata;
char *ob_hex; char *ob_hex;
uint32_t nonce; uint32_t nonce;
int64_t hash_count; int64_t hash_count = 0;
struct timeval tv_start, tv_finish, elapsed; struct timeval tv_start, tv_finish, elapsed;
struct timeval tv_history_start, tv_history_finish; struct timeval tv_history_start, tv_history_finish;
double Ti, Xi; double Ti, Xi;
int curr_hw_errors, i; int curr_hw_errors, i;
bool was_hw_error; bool was_hw_error;
struct work *work;
struct ICARUS_HISTORY *history0, *history; struct ICARUS_HISTORY *history0, *history;
int count; int count;
@ -1148,6 +1148,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
elapsed.tv_sec = elapsed.tv_usec = 0; elapsed.tv_sec = elapsed.tv_usec = 0;
work = get_work(thr, thr->id);
memset((void *)(&workdata), 0, sizeof(workdata)); memset((void *)(&workdata), 0, sizeof(workdata));
memcpy(&(workdata.midstate), work->midstate, ICARUS_MIDSTATE_SIZE); memcpy(&(workdata.midstate), work->midstate, ICARUS_MIDSTATE_SIZE);
memcpy(&(workdata.work), work->data + ICARUS_WORK_DATA_OFFSET, ICARUS_WORK_SIZE); memcpy(&(workdata.work), work->data + ICARUS_WORK_DATA_OFFSET, ICARUS_WORK_SIZE);
@ -1166,7 +1167,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
icarus->drv->name, icarus->device_id, err, amount); icarus->drv->name, icarus->device_id, err, amount);
dev_error(icarus, REASON_DEV_COMMS_ERROR); dev_error(icarus, REASON_DEV_COMMS_ERROR);
icarus_initialise(icarus, info->baud); icarus_initialise(icarus, info->baud);
return 0; goto out;
} }
if (opt_debug) { if (opt_debug) {
@ -1180,7 +1181,7 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
memset(nonce_bin, 0, sizeof(nonce_bin)); memset(nonce_bin, 0, sizeof(nonce_bin));
ret = icarus_get_nonce(icarus, nonce_bin, &tv_start, &tv_finish, thr, info->read_time); ret = icarus_get_nonce(icarus, nonce_bin, &tv_start, &tv_finish, thr, info->read_time);
if (ret == ICA_NONCE_ERROR) if (ret == ICA_NONCE_ERROR)
return 0; goto out;
work->blk.nonce = 0xffffffff; work->blk.nonce = 0xffffffff;
@ -1203,7 +1204,8 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
(long unsigned int)estimate_hashes, (long unsigned int)estimate_hashes,
elapsed.tv_sec, elapsed.tv_usec); elapsed.tv_sec, elapsed.tv_usec);
return estimate_hashes; hash_count = estimate_hashes;
goto out;
} }
memcpy((char *)&nonce, nonce_bin, sizeof(nonce_bin)); memcpy((char *)&nonce, nonce_bin, sizeof(nonce_bin));
@ -1343,7 +1345,8 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
timersub(&tv_history_finish, &tv_history_start, &tv_history_finish); timersub(&tv_history_finish, &tv_history_start, &tv_history_finish);
timeradd(&tv_history_finish, &(info->history_time), &(info->history_time)); timeradd(&tv_history_finish, &(info->history_time), &(info->history_time));
} }
out:
free_work(work);
return hash_count; return hash_count;
} }
@ -1447,11 +1450,12 @@ struct device_drv icarus_drv = {
.dname = "Icarus", .dname = "Icarus",
.name = "ICA", .name = "ICA",
.drv_detect = icarus_detect, .drv_detect = icarus_detect,
.hash_work = &hash_driver_work,
.get_api_stats = icarus_api_stats, .get_api_stats = icarus_api_stats,
.get_statline_before = icarus_statline_before, .get_statline_before = icarus_statline_before,
.set_device = icarus_set, .set_device = icarus_set,
.identify_device = icarus_identify, .identify_device = icarus_identify,
.thread_prepare = icarus_prepare, .thread_prepare = icarus_prepare,
.scanhash = icarus_scanhash, .scanwork = icarus_scanwork,
.thread_shutdown = icarus_shutdown, .thread_shutdown = icarus_shutdown,
}; };

Loading…
Cancel
Save