|
@@ -337,19 +337,19 @@ void bitforce_init(struct cgpu_info *bitforce)
|
|
|
mutex_unlock(&bitforce->device_mutex);
|
|
mutex_unlock(&bitforce->device_mutex);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void bitforce_get_temp(struct cgpu_info *bitforce)
|
|
|
|
|
|
|
+static bool bitforce_get_temp(struct cgpu_info *bitforce)
|
|
|
{
|
|
{
|
|
|
int fdDev = bitforce->device_fd;
|
|
int fdDev = bitforce->device_fd;
|
|
|
char pdevbuf[0x100];
|
|
char pdevbuf[0x100];
|
|
|
char *s;
|
|
char *s;
|
|
|
|
|
|
|
|
if (!fdDev)
|
|
if (!fdDev)
|
|
|
- return;
|
|
|
|
|
|
|
+ return false;
|
|
|
|
|
|
|
|
/* It is not critical getting temperature so don't get stuck if we
|
|
/* It is not critical getting temperature so don't get stuck if we
|
|
|
* can't grab the mutex here */
|
|
* can't grab the mutex here */
|
|
|
if (mutex_trylock(&bitforce->device_mutex))
|
|
if (mutex_trylock(&bitforce->device_mutex))
|
|
|
- return;
|
|
|
|
|
|
|
+ return false;
|
|
|
|
|
|
|
|
BFwrite(fdDev, "ZLX", 3);
|
|
BFwrite(fdDev, "ZLX", 3);
|
|
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
|
@@ -358,7 +358,7 @@ static void bitforce_get_temp(struct cgpu_info *bitforce)
|
|
|
if (unlikely(!pdevbuf[0])) {
|
|
if (unlikely(!pdevbuf[0])) {
|
|
|
applog(LOG_ERR, "BFL%i: Error: Get temp returned empty string/timed out", bitforce->device_id);
|
|
applog(LOG_ERR, "BFL%i: Error: Get temp returned empty string/timed out", bitforce->device_id);
|
|
|
bitforce->hw_errors++;
|
|
bitforce->hw_errors++;
|
|
|
- return;
|
|
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ((!strncasecmp(pdevbuf, "TEMP", 4)) && (s = strchr(pdevbuf + 4, ':'))) {
|
|
if ((!strncasecmp(pdevbuf, "TEMP", 4)) && (s = strchr(pdevbuf + 4, ':'))) {
|
|
@@ -383,7 +383,10 @@ static void bitforce_get_temp(struct cgpu_info *bitforce)
|
|
|
/* Count throttling episodes as hardware errors */
|
|
/* Count throttling episodes as hardware errors */
|
|
|
bitforce->hw_errors++;
|
|
bitforce->hw_errors++;
|
|
|
bitforce_clear_buffer(bitforce);
|
|
bitforce_clear_buffer(bitforce);
|
|
|
|
|
+ return false;;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static bool bitforce_send_work(struct thr_info *thr, struct work *work)
|
|
static bool bitforce_send_work(struct thr_info *thr, struct work *work)
|
|
@@ -614,11 +617,6 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
|
|
|
goto commerr;
|
|
goto commerr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /* A convenient time to ask for the temperature without risk of
|
|
|
|
|
- * interleaved responses */
|
|
|
|
|
- if (send_ret && !work->blk.nonce)
|
|
|
|
|
- bitforce_get_temp(bitforce);
|
|
|
|
|
-
|
|
|
|
|
if (!bitforce->nonce_range) {
|
|
if (!bitforce->nonce_range) {
|
|
|
/* Initially wait 2/3 of the average cycle time so we can request more
|
|
/* Initially wait 2/3 of the average cycle time so we can request more
|
|
|
work before full scan is up */
|
|
work before full scan is up */
|
|
@@ -629,7 +627,7 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
|
|
|
bitforce->wait_ms = sleep_time;
|
|
bitforce->wait_ms = sleep_time;
|
|
|
queue_request(thr, false);
|
|
queue_request(thr, false);
|
|
|
|
|
|
|
|
- /* Now wait the final 1/3rd; no bitforce should be finished by now */
|
|
|
|
|
|
|
+ /* Now wait athe final 1/3rd; no bitforce should be finished by now */
|
|
|
sleep_time = bitforce->sleep_ms - sleep_time;
|
|
sleep_time = bitforce->sleep_ms - sleep_time;
|
|
|
if (noisy_stale_wait(sleep_time, work, true))
|
|
if (noisy_stale_wait(sleep_time, work, true))
|
|
|
return 0;
|
|
return 0;
|
|
@@ -665,6 +663,11 @@ commerr:
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static bool bitforce_get_stats(struct cgpu_info *bitforce)
|
|
|
|
|
+{
|
|
|
|
|
+ return bitforce_get_temp(bitforce);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static bool bitforce_thread_init(struct thr_info *thr)
|
|
static bool bitforce_thread_init(struct thr_info *thr)
|
|
|
{
|
|
{
|
|
|
struct cgpu_info *bitforce = thr->cgpu;
|
|
struct cgpu_info *bitforce = thr->cgpu;
|
|
@@ -700,6 +703,7 @@ struct device_api bitforce_api = {
|
|
|
.get_api_stats = bitforce_api_stats,
|
|
.get_api_stats = bitforce_api_stats,
|
|
|
.reinit_device = bitforce_init,
|
|
.reinit_device = bitforce_init,
|
|
|
.get_statline_before = get_bitforce_statline_before,
|
|
.get_statline_before = get_bitforce_statline_before,
|
|
|
|
|
+ .get_stats = bitforce_get_stats,
|
|
|
.thread_prepare = bitforce_thread_prepare,
|
|
.thread_prepare = bitforce_thread_prepare,
|
|
|
.thread_init = bitforce_thread_init,
|
|
.thread_init = bitforce_thread_init,
|
|
|
.scanhash = bitforce_scanhash,
|
|
.scanhash = bitforce_scanhash,
|