updated firmware, IOC method
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
diff --git a/cgminer/driver-klondike.c b/cgminer/driver-klondike.c
index c6933ea..d8020ec 100644
--- a/cgminer/driver-klondike.c
+++ b/cgminer/driver-klondike.c
@@ -94,7 +94,9 @@ typedef struct device_info {
uint32_t noncecount;
uint32_t nextworkid;
uint16_t lasthashcount;
- uint64_t totalhashcount;
+ uint64_t totalhashcount;
+ uint32_t rangesize;
+ uint32_t *chipstats;
} DEVINFO;
struct klondike_info {
@@ -154,6 +156,31 @@ static char *SendCmdGetReply(struct cgpu_info *klncgpu, char Cmd, int device, in
}
return NULL;
}
+
+static bool klondike_get_stats(struct cgpu_info *klncgpu)
+{
+ struct klondike_info *klninfo = (struct klondike_info *)(klncgpu->device_data);
+ int slaves, dev;
+
+ if (klncgpu->usbinfo.nodev || klninfo->status == NULL)
+ return false;
+
+ applog(LOG_DEBUG, "Klondike getting status");
+ slaves = klninfo->status[0].slavecount;
+
+ // loop thru devices and get status for each
+ wr_lock(&(klninfo->stat_lock));
+ for(dev = 0; dev <= slaves; dev++) {
+ char *reply = SendCmdGetReply(klncgpu, 'S', dev, 0, NULL);
+ if(reply != NULL)
+ klninfo->status[dev] = *(WORKSTATUS *)(reply+2);
+ }
+ wr_unlock(&(klninfo->stat_lock));
+
+ // todo: detect slavecount change and realloc space
+
+ return true;
+}
static bool klondike_init(struct cgpu_info *klncgpu)
{
@@ -203,36 +230,16 @@ static bool klondike_init(struct cgpu_info *klncgpu)
(int)100*klninfo->cfg[dev].fantarget/256);
}
}
+ klondike_get_stats(klncgpu);
+ for(dev = 0; dev <= slaves; dev++) {
+ klninfo->devinfo[dev].rangesize = ((uint64_t)1<<32) / klninfo->status[dev].chipcount;
+ klninfo->devinfo[dev].chipstats = calloc(klninfo->status[dev].chipcount*2 , sizeof(uint32_t));
+ }
SendCmdGetReply(klncgpu, 'E', 0, 1, "1");
return true;
}
-
-static bool klondike_get_stats(struct cgpu_info *klncgpu)
-{
- struct klondike_info *klninfo = (struct klondike_info *)(klncgpu->device_data);
- int slaves, dev;
-
- if (klncgpu->usbinfo.nodev || klninfo->status == NULL)
- return false;
-
- applog(LOG_DEBUG, "Klondike getting status");
- slaves = klninfo->status[0].slavecount;
-
- // loop thru devices and get status for each
- wr_lock(&(klninfo->stat_lock));
- for(dev = 0; dev <= slaves; dev++) {
- char *reply = SendCmdGetReply(klncgpu, 'S', dev, 0, NULL);
- if(reply != NULL)
- klninfo->status[dev] = *(WORKSTATUS *)(reply+2);
- }
- wr_unlock(&(klninfo->stat_lock));
-
- // todo: detect slavecount change and realloc space
-
- return true;
-}
static bool klondike_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
{
@@ -314,12 +321,15 @@ static void klondike_check_nonce(struct cgpu_info *klncgpu, WORKRESULT *result)
result->nonce = le32toh(result->nonce - 0xC0);
applog(LOG_DEBUG, "Klondike SUBMIT NONCE (%02x:%08x)", result->workid, result->nonce);
- submit_nonce(klncgpu->thr[0], work, result->nonce);
+ bool ok = submit_nonce(klncgpu->thr[0], work, result->nonce);
+
+ applog(LOG_DEBUG, "Klondike chip stats %d, %08x, %d, %d", result->device, result->nonce, klninfo->devinfo[result->device].rangesize, klninfo->status[result->device].chipcount);
+ klninfo->devinfo[result->device].chipstats[(result->nonce / klninfo->devinfo[result->device].rangesize) + (ok ? 0 : klninfo->status[result->device].chipcount)]++;
return;
}
}
- applog(LOG_ERR, "%s%i:%d unknown work (%02x:%08x) - can't be processed - ignored",
+ applog(LOG_ERR, "%s%i:%d unknown work (%02x:%08x) - ignored",
klncgpu->drv->name, klncgpu->device_id, result->device, result->workid, result->nonce);
//inc_hw_errors(klncgpu->thr[0]);
}
@@ -458,7 +468,7 @@ static bool klondike_send_work(struct cgpu_info *klncgpu, int dev, struct work *
// remove old work
HASH_ITER(hh, klncgpu->queued_work, work, tmp) {
- if (work->queued && (work->subid == (dev*256 + data.workid-2*MAX_WORK_COUNT)))
+ if (work->queued && (work->subid == (dev*256 + ((klninfo->devinfo[dev].nextworkid-2*MAX_WORK_COUNT) & 0xFF))))
work_completed(klncgpu, work);
}
return true;
@@ -562,9 +572,27 @@ static struct api_data *klondike_api_stats(struct cgpu_info *klncgpu)
sprintf(buf, "Fan Percent %d", dev);
root = api_add_int(root, buf, &iFan, true);
- iFan = (unsigned int)TACH_FACTOR / klninfo->status[dev].fanspeed;
+ iFan = 0;
+ if(klninfo->status[dev].fanspeed > 0)
+ iFan = (unsigned int)TACH_FACTOR / klninfo->status[dev].fanspeed;
sprintf(buf, "Fan RPM %d", dev);
root = api_add_int(root, buf, &iFan, true);
+
+ if(klninfo->devinfo[dev].chipstats != NULL) {
+ char data[80];
+ int n;
+ sprintf(buf, "Nonces / Chip %d", dev);
+ for(n = 0; n < klninfo->status[dev].chipcount; n++)
+ sprintf(data+n*5, "%04d ", klninfo->devinfo[dev].chipstats[n]);
+ data[79] = 0;
+ root = api_add_string(root, buf, data, true);
+
+ sprintf(buf, "Errors / Chip %d", dev);
+ for(n = 0; n < klninfo->status[dev].chipcount; n++)
+ sprintf(data+n*5, "%04d ", klninfo->devinfo[dev].chipstats[n + klninfo->status[dev].chipcount]);
+ data[79] = 0;
+ root = api_add_string(root, buf, data, true);
+ }
}
rd_unlock(&(klninfo->stat_lock));