modminer: Make log messages more consistent in format
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
diff --git a/README b/README
index 5a58dc4..fac8e6f 100644
--- a/README
+++ b/README
@@ -55,6 +55,7 @@ CGMiner specific configuration options:
--disable-adl Override detection and disable building with adl
--enable-bitforce Compile support for BitForce FPGAs(default disabled)
--enable-icarus Compile support for Icarus Board(default disabled)
+ --enable-modminer Compile support for ModMiner FPGAs(default disabled)
--enable-ztex Compile support for Ztex Board(default disabled)
Basic *nix build instructions:
@@ -194,7 +195,7 @@ GPU only options:
--worksize|-w <arg> Override detected optimal worksize - one value or comma separated list
-FPGA mining boards(BitForce, Icarus, Ztex) only options:
+FPGA mining boards(BitForce, Icarus, ModMiner, Ztex) only options:
--scan-serial|-S <arg> Serial port to probe for FPGA mining device
@@ -797,7 +798,7 @@ working in the logs?
A: http://us.php.net/manual/en/sockets.installation.php
Q: What is a PGA?
-A: At the moment, cgminer supports 3 FPGA's: Icarus, Ztex and BitForce.
+A: At the moment, cgminer supports 4 FPGAs: BitForce, Icarus, ModMiner, and Ztex.
They are Field-Programmable Gate Arrays that have been programmed to do Bitcoin
mining. Since the acronym needs to be only 3 characters, the "Field-" part has
been skipped.
diff --git a/driver-modminer.c b/driver-modminer.c
index 29015dc..617b237 100644
--- a/driver-modminer.c
+++ b/driver-modminer.c
@@ -51,7 +51,7 @@ modminer_detect_one(const char *devpath)
size_t len;
// Sending 45 noops, just in case the device was left in "start job" reading
- write(fd, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", 45) ?:0;
+ (void)(write(fd, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", 45) ?:0);
while (serial_read(fd, buf, sizeof(buf)) > 0)
;
@@ -142,9 +142,9 @@ get_modminer_statline_before(char *buf, struct cgpu_info *modminer)
FD_SET(fd, &fds); \
select(fd+1, &fds, NULL, NULL, NULL); \
if (1 != read(fd, buf, 1)) \
- bailout2(LOG_ERR, "Error programming ModMiner %s (" eng ")", modminer->device_path); \
+ bailout2(LOG_ERR, "%s %u: Error programming %s (" eng ")", modminer->api->name, modminer->device_id, modminer->device_path); \
if (buf[0] != 1) \
- bailout2(LOG_ERR, "Wrong " eng " programming ModMiner %s", modminer->device_path); \
+ bailout2(LOG_ERR, "%s %u: Wrong " eng " programming %s", modminer->api->name, modminer->device_id, modminer->device_path); \
} while(0)
static bool
@@ -198,7 +198,7 @@ fd_set fds;
int fd = modminer->device_fd;
- applog(LOG_WARNING, "Programming %s... DO NOT EXIT CGMINER UNTIL COMPLETE", modminer->device_path, fpgaid);
+ applog(LOG_WARNING, "%s %u: Programming %s... DO NOT EXIT CGMINER UNTIL COMPLETE", modminer->api->name, modminer->device_id, modminer->device_path);
buf[0] = '\x05'; // Program Bitstream
buf[1] = fpgaid;
buf[2] = (len >> 0) & 0xff;
@@ -206,20 +206,20 @@ fd_set fds;
buf[4] = (len >> 16) & 0xff;
buf[5] = (len >> 24) & 0xff;
if (6 != write(fd, buf, 6))
- bailout2(LOG_ERR, "Error programming ModMiner %s (cmd)", modminer->device_path);
+ bailout2(LOG_ERR, "%s %u: Error programming %s (cmd)", modminer->api->name, modminer->device_id, modminer->device_path);
status_read("cmd reply");
size_t buflen;
while (len) {
buflen = len < 32 ? len : 32;
if (fread(buf, buflen, 1, f) != 1)
- bailout2(LOG_ERR, "File underrun programming ModMiner %s (%d bytes left)", modminer->device_path, len);
+ bailout2(LOG_ERR, "%s %u: File underrun programming %s (%d bytes left)", modminer->api->name, modminer->device_id, modminer->device_path, len);
if (write(fd, buf, buflen) != buflen)
- bailout2(LOG_ERR, "Error programming ModMiner %s (data)");
+ bailout2(LOG_ERR, "%s %u: Error programming %s (data)", modminer->api->name, modminer->device_id, modminer->device_path);
status_read("status");
len -= buflen;
}
status_read("final status");
- applog(LOG_WARNING, "Done programming %s", modminer->device_path);
+ applog(LOG_WARNING, "%s %u: Done programming %s", modminer->api->name, modminer->device_id, modminer->device_path);
return true;
}
@@ -229,10 +229,10 @@ modminer_device_prepare(struct cgpu_info *modminer)
{
int fd = serial_open(modminer->device_path, 0, /*FIXME=-1*/3000, true);
if (unlikely(-1 == fd))
- bailout(LOG_ERR, "Failed to open ModMiner on %s", modminer->device_path);
+ bailout(LOG_ERR, "%s %u: Failed to open %s", modminer->api->name, modminer->device_id, modminer->device_path);
modminer->device_fd = fd;
- applog(LOG_INFO, "Opened ModMiner on %s", modminer->device_path);
+ applog(LOG_INFO, "%s %u: Opened %s", modminer->api->name, modminer->device_id, modminer->device_path);
struct timeval now;
gettimeofday(&now, NULL);
@@ -294,13 +294,13 @@ modminer_reduce_clock(struct thr_info*thr, bool needlock)
if (needlock)
mutex_lock(&modminer->device_mutex);
if (6 != write(fd, cmd, 6))
- bailout2(LOG_ERR, "Error writing to ModMiner (set clock speed)");
+ bailout2(LOG_ERR, "%s %u.%u: Error writing (set clock speed)", modminer->api->name, modminer->device_id, fpgaid);
if (serial_read(fd, &buf, 1) != 1)
- bailout2(LOG_ERR, "Error reading from ModMiner (set clock speed)");
+ bailout2(LOG_ERR, "%s %u.%u: Error reading (set clock speed)", modminer->api->name, modminer->device_id, fpgaid);
if (needlock)
mutex_unlock(&modminer->device_mutex);
- applog(LOG_WARNING, "ModMiner: Setting clock speed of %s %d (FPGA #%u) to %u", modminer->api->name, modminer->device_id, fpgaid, state->clock);
+ applog(LOG_WARNING, "%s %u.%u: Setting clock speed to %u", modminer->api->name, modminer->device_id, fpgaid, state->clock);
return true;
}
@@ -326,17 +326,17 @@ modminer_fpga_init(struct thr_info *thr)
cmd[0] = '\x04'; // Read USER code (bitstream id)
cmd[1] = fpgaid;
if (write(fd, cmd, 2) != 2)
- bailout2(LOG_ERR, "Error writing to ModMiner (read USER code)");
+ bailout2(LOG_ERR, "%s %u.%u: Error writing (read USER code)", modminer->api->name, modminer->device_id, fpgaid);
if (serial_read(fd, buf, 4) != 4)
- bailout2(LOG_ERR, "Error reading from ModMiner (read USER code)");
+ bailout2(LOG_ERR, "%s %u.%u: Error reading (read USER code)", modminer->api->name, modminer->device_id, fpgaid);
if (memcmp(buf, BISTREAM_USER_ID, 4)) {
- applog(LOG_ERR, "FPGA #%d not programmed", fpgaid);
+ applog(LOG_ERR, "%s %u.%u: FPGA not programmed", modminer->api->name, modminer->device_id, fpgaid);
if (!modminer_fpga_upload_bitstream(modminer))
return false;
}
else
- applog(LOG_DEBUG, "FPGA #%d is already programmed :)", fpgaid);
+ applog(LOG_DEBUG, "%s %u.%u: FPGA is already programmed :)", modminer->api->name, modminer->device_id, fpgaid);
state->clock = 212; // Will be reduced to 210 by modminer_reduce_clock
modminer_reduce_clock(thr, false);
@@ -364,13 +364,14 @@ modminer_start_work(struct thr_info*thr)
fd_set fds;
struct cgpu_info*modminer = thr->cgpu;
struct modminer_fpga_state *state = thr->cgpu_data;
+ char fpgaid = thr->device_thread;
int fd = modminer->device_fd;
char buf[1];
mutex_lock(&modminer->device_mutex);
if (46 != write(fd, state->next_work_cmd, 46))
- bailout2(LOG_ERR, "Error writing to ModMiner (start work)");
+ bailout2(LOG_ERR, "%s %u.%u: Error writing (start work)", modminer->api->name, modminer->device_id, fpgaid);
gettimeofday(&state->tv_workstart, NULL);
state->hashes = 0;
status_read("start work");
@@ -403,7 +404,7 @@ modminer_process_results(struct thr_info*thr)
modminer->temp = (float)temperature;
if (temperature > modminer->cutofftemp - 2) {
if (temperature > modminer->cutofftemp) {
- applog(LOG_WARNING, "Hit thermal cutoff limit on %s %d, disabling!", modminer->api->name, modminer->device_id);
+ applog(LOG_WARNING, "%s %u.%u: Hit thermal cutoff limit, disabling device!", modminer->api->name, modminer->device_id, fpgaid);
modminer->deven = DEV_RECOVER;
modminer->device_last_not_well = time(NULL);
@@ -423,7 +424,7 @@ modminer_process_results(struct thr_info*thr)
iter = 200;
while (1) {
if (write(fd, cmd, 2) != 2)
- bailout2(LOG_ERR, "Error reading from ModMiner (get nonce)");
+ bailout2(LOG_ERR, "%s %u.%u: Error reading (get nonce)", modminer->api->name, modminer->device_id, fpgaid);
serial_read(fd, &nonce, 4);
mutex_unlock(&modminer->device_mutex);
if (memcmp(&nonce, "\xff\xff\xff\xff", 4)) {