|
@@ -341,6 +341,7 @@ static bool knc_titan_init(struct thr_info * const thr)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
cgpu_set_defaults(cgpu);
|
|
cgpu_set_defaults(cgpu);
|
|
|
|
|
+ cgpu_setup_control_requests(cgpu);
|
|
|
if (0 >= total_cores)
|
|
if (0 >= total_cores)
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
@@ -358,6 +359,57 @@ static bool knc_titan_init(struct thr_info * const thr)
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static bool die_test_and_add(struct knc_titan_info * const knc, int asic, int die, char * const errbuf)
|
|
|
|
|
+{
|
|
|
|
|
+ struct knc_die_info die_info;
|
|
|
|
|
+ char repr[6];
|
|
|
|
|
+
|
|
|
|
|
+ snprintf(repr, sizeof(repr), "%s %d", knc_titan_drv.name, asic);
|
|
|
|
|
+ die_info.cores = KNC_TITAN_CORES_PER_DIE; /* core hint */
|
|
|
|
|
+ die_info.version = KNC_VERSION_TITAN;
|
|
|
|
|
+ if (!knc_titan_get_info(repr, knc->ctx, asic, die, &die_info))
|
|
|
|
|
+ die_info.cores = -1;
|
|
|
|
|
+ if (0 < die_info.cores) {
|
|
|
|
|
+ sprintf(errbuf, "Die[%d:%d] not detected", asic, die);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* TODO: add procs */
|
|
|
|
|
+ sprintf(errbuf, "Die[%d:%d] has %d cores; was not added (addition not implemented)", asic, die, die_info.cores);
|
|
|
|
|
+
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static bool die_enable(struct knc_titan_info * const knc, int asic, int die, char * const errbuf)
|
|
|
|
|
+{
|
|
|
|
|
+ bool res = true;
|
|
|
|
|
+
|
|
|
|
|
+ cgpu_request_control(knc->cgpu);
|
|
|
|
|
+ if (0 >= knc->dies[asic][die].cores)
|
|
|
|
|
+ res = die_test_and_add(knc, asic, die, errbuf);
|
|
|
|
|
+ if (res) {
|
|
|
|
|
+ knc_titan_clean_flush(knc->dies[asic][die].first_proc->device->dev_repr, knc->ctx, asic, die);
|
|
|
|
|
+ res = configure_one_die(knc, asic, die);
|
|
|
|
|
+ }
|
|
|
|
|
+ cgpu_release_control(knc->cgpu);
|
|
|
|
|
+
|
|
|
|
|
+ return res;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static bool die_disable(struct knc_titan_info * const knc, int asic, int die, char * const errbuf)
|
|
|
|
|
+{
|
|
|
|
|
+ cgpu_request_control(knc->cgpu);
|
|
|
|
|
+ /* TODO: delete procs */
|
|
|
|
|
+ cgpu_release_control(knc->cgpu);
|
|
|
|
|
+ sprintf(errbuf, "die_disable[%d:%d] not imnplemented", asic, die);
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static bool die_reconfigure(struct knc_titan_info * const knc, int asic, int die, char * const errbuf)
|
|
|
|
|
+{
|
|
|
|
|
+ return die_enable(knc, asic, die, errbuf);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static bool knc_titan_prepare_work(struct thr_info *thr, struct work *work)
|
|
static bool knc_titan_prepare_work(struct thr_info *thr, struct work *work)
|
|
|
{
|
|
{
|
|
|
struct cgpu_info * const cgpu = thr->cgpu;
|
|
struct cgpu_info * const cgpu = thr->cgpu;
|
|
@@ -599,8 +651,40 @@ static const char *knc_titan_set_clock(struct cgpu_info * const device, const ch
|
|
|
return NULL;
|
|
return NULL;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static const char *knc_titan_die_ena(struct cgpu_info * const device, const char * const option, const char * const setting, char * const replybuf, enum bfg_set_device_replytype * const success)
|
|
|
|
|
+{
|
|
|
|
|
+ int asic, die;
|
|
|
|
|
+ char str[256];
|
|
|
|
|
+
|
|
|
|
|
+ /* command format: ASIC:N;DIE:N;MODE:ENABLE|DISABLE|RECONFIGURE */
|
|
|
|
|
+ if (3 != sscanf(setting, "ASIC:%d;DIE:%d;MODE:%255s", &asic, &die, str)) {
|
|
|
|
|
+error_bad_params:
|
|
|
|
|
+ sprintf(replybuf, "Die setup failed, bad parameters");
|
|
|
|
|
+ return replybuf;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (0 == strncasecmp(str, "enable", sizeof(str) - 1)) {
|
|
|
|
|
+ if (!die_enable(device->device_data, asic, die, replybuf))
|
|
|
|
|
+ return replybuf;
|
|
|
|
|
+ } else if (0 == strncasecmp(str, "disable", sizeof(str) - 1)) {
|
|
|
|
|
+ if (!die_disable(device->device_data, asic, die, replybuf))
|
|
|
|
|
+ return replybuf;
|
|
|
|
|
+ } else if (0 == strncasecmp(str, "reconfigure", sizeof(str) - 1)) {
|
|
|
|
|
+ if (!die_reconfigure(device->device_data, asic, die, replybuf)) {
|
|
|
|
|
+ /* Do not return error on reconfigure command!
|
|
|
|
|
+ * (or the whole bfgminer will be restarted) */
|
|
|
|
|
+ *success = SDR_OK;
|
|
|
|
|
+ return replybuf;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else
|
|
|
|
|
+ goto error_bad_params;
|
|
|
|
|
+ sprintf(replybuf, "Die setup Ok; asic %d die %d cmd %s", asic, die, str);
|
|
|
|
|
+ *success = SDR_OK;
|
|
|
|
|
+ return replybuf;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static const struct bfg_set_device_definition knc_titan_set_device_funcs[] = {
|
|
static const struct bfg_set_device_definition knc_titan_set_device_funcs[] = {
|
|
|
{ "clock", knc_titan_set_clock, NULL },
|
|
{ "clock", knc_titan_set_clock, NULL },
|
|
|
|
|
+ { "die", knc_titan_die_ena, NULL },
|
|
|
{ NULL },
|
|
{ NULL },
|
|
|
};
|
|
};
|
|
|
|
|
|