Commit a0f9a7e9e78988cfe3fda41342e48c27f0c61084

Con Kolivas 2014-01-25T20:49:51

Support the variable HFA naming throughout the driver notices.

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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 223a4cc..3c27872 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -132,7 +132,7 @@ static bool hfa_send_frame(struct cgpu_info *hashfast, uint8_t opcode, uint16_t 
 	if (unlikely(hashfast->usbinfo.nodev))
 		return false;
 
-	applog(LOG_DEBUG, "HFA %d: Sending %s frame", hashfast->device_id, hfa_cmds[opcode].cmd_name);
+	applog(LOG_DEBUG, "%s %d: Sending %s frame", hashfast->drv->name, hashfast->device_id, hfa_cmds[opcode].cmd_name);
 retry:
 	ret = usb_write(hashfast, (char *)packet, tx_length, &amount,
 			hfa_cmds[opcode].usb_cmd);
@@ -140,18 +140,18 @@ retry:
 		if (hashfast->usbinfo.nodev)
 			return false;
 		if (!retried) {
-			applog(LOG_ERR, "HFA %d: hfa_send_frame: USB Send error, ret %d amount %d vs. tx_length %d, retrying",
-			       id, ret, amount, tx_length);
+			applog(LOG_ERR, "%s %d: hfa_send_frame: USB Send error, ret %d amount %d vs. tx_length %d, retrying",
+			       hashfast->drv->name, id, ret, amount, tx_length);
 			retried = true;
 			goto retry;
 		}
-		applog(LOG_ERR, "HFA %d: hfa_send_frame: USB Send error, ret %d amount %d vs. tx_length %d",
-		       id, ret, amount, tx_length);
+		applog(LOG_ERR, "%s %d: hfa_send_frame: USB Send error, ret %d amount %d vs. tx_length %d",
+		       hashfast->drv->name, id, ret, amount, tx_length);
 		return false;
 	}
 
 	if (retried)
-		applog(LOG_ERR, "HFA %d: hfa_send_frame: recovered OK", id);
+		applog(LOG_ERR, "%s %d: hfa_send_frame: recovered OK", hashfast->drv->name, id);
 
 	return true;
 }
@@ -169,8 +169,8 @@ static bool hfa_send_packet(struct cgpu_info *hashfast, struct hf_header *h, int
 	len = sizeof(*h) + h->data_length * 4;
 	ret = usb_write(hashfast, (char *)h, len, &amount, hfa_cmds[cmd].usb_cmd);
 	if (ret < 0 || amount != len) {
-		applog(LOG_WARNING, "HFA%d: send_packet: %s USB Send error, ret %d amount %d vs. length %d",
-		       hashfast->device_id, hfa_cmds[cmd].cmd_name, ret, amount, len);
+		applog(LOG_WARNING, "%s %d: send_packet: %s USB Send error, ret %d amount %d vs. length %d",
+		       hashfast->drv->name, hashfast->device_id, hfa_cmds[cmd].cmd_name, ret, amount, len);
 		return false;
 	}
 	return true;
@@ -234,8 +234,8 @@ static bool hfa_get_data(struct cgpu_info *hashfast, char *buf, int len4)
 	if (ret)
 		return false;
 	if (amount != len) {
-		applog(LOG_WARNING, "HFA %d: get_data: Strange amount returned %d vs. expected %d",
-		       hashfast->device_id, amount, len);
+		applog(LOG_WARNING, "%s %d: get_data: Strange amount returned %d vs. expected %d",
+		       hashfast->drv->name, hashfast->device_id, amount, len);
 		return false;
 	}
 	return true;
@@ -299,8 +299,8 @@ static bool hfa_reset(struct cgpu_info *hashfast, struct hashfast_info *info)
 		hu->data_length = sizeof(*ho) / 4;
 	}
 	hu->crc8 = hfa_crc8((uint8_t *)hu);
-	applog(LOG_INFO, "HFA%d: Sending OP_USB_INIT with GWQ protocol specified",
-	       hashfast->device_id);
+	applog(LOG_INFO, "%s %d: Sending OP_USB_INIT with GWQ protocol specified",
+	       hashfast->drv->name, hashfast->device_id);
 resend:
 	if (unlikely(hashfast->usbinfo.nodev))
 		return false;
@@ -322,27 +322,27 @@ tryagain:
 	if (!ret) {
 		if (retries++ < 3)
 			goto resend;
-		applog(LOG_WARNING, "HFA %d: OP_USB_INIT failed!", hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: OP_USB_INIT failed!", hashfast->drv->name, hashfast->device_id);
 		return false;
 	}
 	if (h->crc8 != hcrc) {
-		applog(LOG_WARNING, "HFA %d: OP_USB_INIT failed! CRC mismatch", hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: OP_USB_INIT failed! CRC mismatch", hashfast->drv->name, hashfast->device_id);
 		return false;
 	}
 	if (h->operation_code != OP_USB_INIT) {
 		// This can happen if valid packet(s) were in transit *before* the OP_USB_INIT arrived
 		// at the device, so we just toss the packets and keep looking for the response.
-		applog(LOG_WARNING, "HFA %d: OP_USB_INIT: Tossing packet, valid but unexpected type %d",
-                        hashfast->device_id, h->operation_code);
+		applog(LOG_WARNING, "%s %d: OP_USB_INIT: Tossing packet, valid but unexpected type %d",
+                       hashfast->drv->name, hashfast->device_id, h->operation_code);
 		hfa_get_data(hashfast, buf, h->data_length);
 		if (retries++ < 3)
 			goto tryagain;
 		return false;
 	}
 
-	applog(LOG_DEBUG, "HFA %d: Good reply to OP_USB_INIT", hashfast->device_id);
-	applog(LOG_DEBUG, "HFA %d: OP_USB_INIT: %d die in chain, %d cores, device_type %d, refclk %d Mhz",
-	       hashfast->device_id, h->chip_address, h->core_address, h->hdata & 0xff, (h->hdata >> 8) & 0xff);
+	applog(LOG_DEBUG, "%s %d: Good reply to OP_USB_INIT", hashfast->drv->name, hashfast->device_id);
+	applog(LOG_DEBUG, "%s %d: OP_USB_INIT: %d die in chain, %d cores, device_type %d, refclk %d Mhz",
+	       hashfast->drv->name, hashfast->device_id, h->chip_address, h->core_address, h->hdata & 0xff, (h->hdata >> 8) & 0xff);
 
 	// Save device configuration
 	info->asic_count = h->chip_address;
@@ -363,29 +363,29 @@ tryagain:
 
 	// Get the usb_init_base structure
 	if (!hfa_get_data(hashfast, (char *)&info->usb_init_base, U32SIZE(info->usb_init_base))) {
-		applog(LOG_WARNING, "HFA %d: OP_USB_INIT failed! Failure to get usb_init_base data",
-		       hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: OP_USB_INIT failed! Failure to get usb_init_base data",
+		       hashfast->drv->name, hashfast->device_id);
 		return false;
 	}
 	db = &info->usb_init_base;
-	applog(LOG_INFO, "HFA %d:      firmware_rev:    %d.%d", hashfast->device_id,
+	applog(LOG_INFO, "%s %d:      firmware_rev:    %d.%d", hashfast->drv->name, hashfast->device_id,
 	       (db->firmware_rev >> 8) & 0xff, db->firmware_rev & 0xff);
-	applog(LOG_INFO, "HFA %d:      hardware_rev:    %d.%d", hashfast->device_id,
+	applog(LOG_INFO, "%s %d:      hardware_rev:    %d.%d", hashfast->drv->name, hashfast->device_id,
 	       (db->hardware_rev >> 8) & 0xff, db->hardware_rev & 0xff);
-	applog(LOG_INFO, "HFA %d:      serial number:   %d", hashfast->device_id,
+	applog(LOG_INFO, "%s %d:      serial number:   %d", hashfast->drv->name, hashfast->device_id,
 	       db->serial_number);
-	applog(LOG_INFO, "HFA %d:      hash clockrate:  %d Mhz", hashfast->device_id,
+	applog(LOG_INFO, "%s %d:      hash clockrate:  %d Mhz", hashfast->drv->name, hashfast->device_id,
 	       db->hash_clockrate);
-	applog(LOG_INFO, "HFA %d:      inflight_target: %d", hashfast->device_id,
+	applog(LOG_INFO, "%s %d:      inflight_target: %d", hashfast->drv->name, hashfast->device_id,
 	       db->inflight_target);
-	applog(LOG_INFO, "HFA %d:      sequence_modulus: %d", hashfast->device_id,
+	applog(LOG_INFO, "%s %d:      sequence_modulus: %d", hashfast->drv->name, hashfast->device_id,
 	       db->sequence_modulus);
 	info->num_sequence = db->sequence_modulus;
 
 	// Now a copy of the config data used
 	if (!hfa_get_data(hashfast, (char *)&info->config_data, U32SIZE(info->config_data))) {
-		applog(LOG_WARNING, "HFA %d: OP_USB_INIT failed! Failure to get config_data",
-		       hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: OP_USB_INIT failed! Failure to get config_data",
+		       hashfast->drv->name, hashfast->device_id);
 		return false;
 	}
 
@@ -394,14 +394,14 @@ tryagain:
 	if (!info->core_bitmap)
 		quit(1, "Failed to malloc info core bitmap in hfa_reset");
 	if (!hfa_get_data(hashfast, (char *)info->core_bitmap, info->core_bitmap_size / 4)) {
-		applog(LOG_WARNING, "HFA %d: OP_USB_INIT failed! Failure to get core_bitmap", hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: OP_USB_INIT failed! Failure to get core_bitmap", hashfast->drv->name, hashfast->device_id);
 		return false;
 	}
 
 	// See if the initialization suceeded
 	if (db->operation_status) {
-		applog(LOG_WARNING, "HFA %d: OP_USB_INIT failed! Operation status %d (%s)",
-			hashfast->device_id, db->operation_status,
+		applog(LOG_WARNING, "%s %d: OP_USB_INIT failed! Operation status %d (%s)",
+		       hashfast->drv->name, hashfast->device_id, db->operation_status,
 			(db->operation_status < sizeof(hf_usb_init_errors)/sizeof(hf_usb_init_errors[0])) ?
 			hf_usb_init_errors[db->operation_status] : "Unknown error code");
 		return false;
@@ -491,8 +491,8 @@ static bool hfa_initialise(struct cgpu_info *hashfast)
 					7, C_ATMEL_INIT);
 	}
 	if (err < 0) {
-		applog(LOG_INFO, "HFA %d: Failed to open with error %s",
-		       hashfast->device_id, libusb_error_name(err));
+		applog(LOG_INFO, "%s %d: Failed to open with error %s",
+		       hashfast->drv->name, hashfast->device_id, libusb_error_name(err));
 	}
 	/* Must have transmitted init sequence sized buffer */
 	return (err == 7);
@@ -506,8 +506,9 @@ static void hfa_dfu_boot(struct cgpu_info *hashfast)
 		return;
 
 	ret = hfa_send_frame(hashfast, HF_USB_CMD(OP_DFU), 0, NULL, 0);
-	applog(LOG_WARNING, "HFA %d %03d:%03d DFU Boot %s", hashfast->device_id, hashfast->usbinfo.bus_number,
-	       hashfast->usbinfo.device_address, ret ? "Succeeded" : "Failed");
+	applog(LOG_WARNING, "%s %d %03d:%03d DFU Boot %s", hashfast->drv->name, hashfast->device_id,
+	       hashfast->usbinfo.bus_number, hashfast->usbinfo.device_address,
+	       ret ? "Succeeded" : "Failed");
 }
 
 static struct cgpu_info *hfa_detect_one(libusb_device *dev, struct usb_find_devices *found)
@@ -565,16 +566,16 @@ static bool hfa_get_packet(struct cgpu_info *hashfast, struct hf_header *h)
 	if (unlikely(!ret))
 		goto out;
 	if (unlikely(h->crc8 != hcrc)) {
-		applog(LOG_WARNING, "HFA %d: Bad CRC %d vs %d, discarding packet",
-		       hashfast->device_id, h->crc8, hcrc);
+		applog(LOG_WARNING, "%s %d: Bad CRC %d vs %d, discarding packet",
+		       hashfast->drv->name, hashfast->device_id, h->crc8, hcrc);
 		ret = false;
 		goto out;
 	}
 	if (h->data_length > 0)
 		ret = hfa_get_data(hashfast, (char *)(h + 1), h->data_length);
 	if (unlikely(!ret)) {
-		applog(LOG_WARNING, "HFA %d: Failed to get data associated with header",
-		       hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: Failed to get data associated with header",
+		       hashfast->drv->name, hashfast->device_id);
 	}
 
 out:
@@ -587,22 +588,22 @@ static void hfa_parse_gwq_status(struct cgpu_info *hashfast, struct hashfast_inf
 	struct hf_gwq_data *g = (struct hf_gwq_data *)(h + 1);
 	struct work *work;
 
-	applog(LOG_DEBUG, "HFA %d: OP_GWQ_STATUS, device_head %4d tail %4d my tail %4d shed %3d inflight %4d",
-		hashfast->device_id, g->sequence_head, g->sequence_tail, info->hash_sequence_tail,
-		g->shed_count, HF_SEQUENCE_DISTANCE(info->hash_sequence_head,g->sequence_tail));
+	applog(LOG_DEBUG, "%s %d: OP_GWQ_STATUS, device_head %4d tail %4d my tail %4d shed %3d inflight %4d",
+	       hashfast->drv->name, hashfast->device_id, g->sequence_head, g->sequence_tail, info->hash_sequence_tail,
+	       g->shed_count, HF_SEQUENCE_DISTANCE(info->hash_sequence_head,g->sequence_tail));
 
 	/* This is a special flag that the thermal overload has been tripped */
 	if (unlikely(h->core_address & 0x80)) {
-		applog(LOG_WARNING, "HFA %d Thermal overload tripped! Resetting device",
-		       hashfast->device_id);
+		applog(LOG_WARNING, "%s %d Thermal overload tripped! Resetting device",
+		       hashfast->drv->name, hashfast->device_id);
 		hfa_send_shutdown(hashfast);
 		if (hfa_reset(hashfast, info)) {
-			applog(LOG_NOTICE, "HFA %d: Succesfully reset, continuing operation",
-			       hashfast->device_id);
+			applog(LOG_NOTICE, "%s %d: Succesfully reset, continuing operation",
+			       hashfast->drv->name, hashfast->device_id);
 			return;
 		}
-		applog(LOG_WARNING, "HFA %d Failed to reset device, killing off thread to allow re-hotplug",
-		       hashfast->device_id);
+		applog(LOG_WARNING, "%s %d Failed to reset device, killing off thread to allow re-hotplug",
+		       hashfast->drv->name, hashfast->device_id);
 		usb_nodev(hashfast);
 		return;
 	}
@@ -617,13 +618,13 @@ static void hfa_parse_gwq_status(struct cgpu_info *hashfast, struct hashfast_inf
 		if (++info->hash_sequence_tail >= info->num_sequence)
 			info->hash_sequence_tail = 0;
 		if (unlikely(!(work = info->works[info->hash_sequence_tail]))) {
-			applog(LOG_ERR, "HFA %d: Bad work sequence tail",
-			       hashfast->device_id);
+			applog(LOG_ERR, "%s %d: Bad work sequence tail",
+			       hashfast->drv->name, hashfast->device_id);
 			hashfast->shutdown = true;
 			break;
 		}
-		applog(LOG_DEBUG, "HFA %d: Completing work on hash_sequence_tail %d",
-		       hashfast->device_id, info->hash_sequence_tail);
+		applog(LOG_DEBUG, "%s %d: Completing work on hash_sequence_tail %d",
+		       hashfast->drv->name, hashfast->device_id, info->hash_sequence_tail);
 		free_work(work);
 		info->works[info->hash_sequence_tail] = NULL;
 	}
@@ -669,8 +670,8 @@ static void hfa_update_die_status(struct cgpu_info *hashfast, struct hashfast_in
 			for (j = 0; j < 6; j++)
 				core_voltage[j] = GN_CORE_VOLTAGE(d->die.core_voltage[j]);
 
-			applog(LOG_DEBUG, "HFA %d: die %2d: OP_DIE_STATUS Temps die %.1fC board %.1fC vdd's %.2f %.2f %.2f %.2f %.2f %.2f",
-			       hashfast->device_id, h->chip_address + i, die_temperature, board_temperature(d->temperature),
+			applog(LOG_DEBUG, "%s %d: die %2d: OP_DIE_STATUS Temps die %.1fC board %.1fC vdd's %.2f %.2f %.2f %.2f %.2f %.2f",
+			       hashfast->drv->name, hashfast->device_id, h->chip_address + i, die_temperature, board_temperature(d->temperature),
 			       core_voltage[0], core_voltage[1], core_voltage[2],
 			       core_voltage[3], core_voltage[4], core_voltage[5]);
 			// XXX Convert board phase currents, voltage, temperature
@@ -684,13 +685,13 @@ static void hfa_parse_nonce(struct thr_info *thr, struct cgpu_info *hashfast,
 	struct hf_candidate_nonce *n = (struct hf_candidate_nonce *)(h + 1);
 	int i, num_nonces = h->data_length / U32SIZE(sizeof(struct hf_candidate_nonce));
 
-	applog(LOG_DEBUG, "HFA %d: OP_NONCE: %2d/%2d:, num_nonces %d hdata 0x%04x",
-	       hashfast->device_id, h->chip_address, h->core_address, num_nonces, h->hdata);
+	applog(LOG_DEBUG, "%s %d: OP_NONCE: %2d/%2d:, num_nonces %d hdata 0x%04x",
+	       hashfast->drv->name, hashfast->device_id, h->chip_address, h->core_address, num_nonces, h->hdata);
 	for (i = 0; i < num_nonces; i++, n++) {
 		struct work *work = NULL;
 
-		applog(LOG_DEBUG, "HFA %d: OP_NONCE: %2d: %2d: ntime %2d sequence %4d nonce 0x%08x",
-		       hashfast->device_id, h->chip_address, i, n->ntime & HF_NTIME_MASK, n->sequence, n->nonce);
+		applog(LOG_DEBUG, "%s %d: OP_NONCE: %2d: %2d: ntime %2d sequence %4d nonce 0x%08x",
+		       hashfast->drv->name, hashfast->device_id, h->chip_address, i, n->ntime & HF_NTIME_MASK, n->sequence, n->nonce);
 
 		if (n->sequence < info->usb_init_base.sequence_modulus) {
 			// Find the job from the sequence number
@@ -698,16 +699,16 @@ static void hfa_parse_nonce(struct thr_info *thr, struct cgpu_info *hashfast,
 			work = info->works[n->sequence];
 			mutex_unlock(&info->lock);
 		} else {
-			applog(LOG_INFO, "HFA %d: OP_NONCE: Sequence out of range %4d max %4d",
-			       hashfast->device_id, n->sequence, info->usb_init_base.sequence_modulus);
+			applog(LOG_INFO, "%s %d: OP_NONCE: Sequence out of range %4d max %4d",
+			       hashfast->drv->name, hashfast->device_id, n->sequence, info->usb_init_base.sequence_modulus);
 		}
 
 		if (unlikely(!work)) {
 			info->no_matching_work++;
-			applog(LOG_INFO, "HFA %d: No matching work!", hashfast->device_id);
+			applog(LOG_INFO, "%s %d: No matching work!", hashfast->drv->name, hashfast->device_id);
 		} else {
-			applog(LOG_DEBUG, "HFA %d: OP_NONCE: sequence %d: submitting nonce 0x%08x ntime %d",
-			       hashfast->device_id, n->sequence, n->nonce, n->ntime & HF_NTIME_MASK);
+			applog(LOG_DEBUG, "%s %d: OP_NONCE: sequence %d: submitting nonce 0x%08x ntime %d",
+			       hashfast->drv->name, hashfast->device_id, n->sequence, n->nonce, n->ntime & HF_NTIME_MASK);
 			if (submit_noffset_nonce(thr, work, n->nonce, n->ntime & HF_NTIME_MASK)) {
 				mutex_lock(&info->lock);
 				info->hash_count += 0xffffffffull * work->device_diff;
@@ -717,8 +718,8 @@ static void hfa_parse_nonce(struct thr_info *thr, struct cgpu_info *hashfast,
 			if (unlikely(n->ntime & HF_NONCE_SEARCH)) {
 				/* This tells us there is another share in the
 				 * next 128 nonces */
-				applog(LOG_DEBUG, "HFA %d: OP_NONCE: SEARCH PROXIMITY EVENT FOUND",
-				       hashfast->device_id);
+				applog(LOG_DEBUG, "%s %d: OP_NONCE: SEARCH PROXIMITY EVENT FOUND",
+				       hashfast->drv->name, hashfast->device_id);
 			}
 #endif
 		}
@@ -778,7 +779,7 @@ static void hfa_update_stats1(struct cgpu_info *hashfast, struct hashfast_info *
 	if (sd->max_rx_buffers >  s1->max_rx_buffers)
 		s1->max_rx_buffers = sd->max_rx_buffers;
 
-	applog(LOG_DEBUG, "HFA %d: OP_USB_STATS1:", hashfast->device_id);
+	applog(LOG_DEBUG, "%s %d: OP_USB_STATS1:", hashfast->drv->name, hashfast->device_id);
 	applog(LOG_DEBUG, "      usb_rx_preambles:             %6d", sd->usb_rx_preambles);
 	applog(LOG_DEBUG, "      usb_rx_receive_byte_errors:   %6d", sd->usb_rx_receive_byte_errors);
 	applog(LOG_DEBUG, "      usb_rx_bad_hcrc:              %6d", sd->usb_rx_bad_hcrc);
@@ -812,13 +813,13 @@ static void hfa_parse_notice(struct cgpu_info *hashfast, struct hf_header *h)
 	struct hf_usb_notice_data *d;
 
 	if (h->data_length == 0) {
-		applog(LOG_DEBUG, "HFA %d: Received OP_USB_NOTICE with zero data length",
-		       hashfast->device_id);
+		applog(LOG_DEBUG, "%s %d: Received OP_USB_NOTICE with zero data length",
+		       hashfast->drv->name, hashfast->device_id);
 		return;
 	}
 	d = (struct hf_usb_notice_data *)(h + 1);
 	/* FIXME Do something with the notification code d->extra_data here */
-	applog(LOG_NOTICE, "HFA %d NOTICE: %s", hashfast->device_id, d->message);
+	applog(LOG_NOTICE, "%s %d NOTICE: %s", hashfast->drv->name, hashfast->device_id, d->message);
 }
 
 static void *hfa_read(void *arg)
@@ -828,7 +829,7 @@ static void *hfa_read(void *arg)
 	struct hashfast_info *info = hashfast->device_data;
 	char threadname[16];
 
-	snprintf(threadname, sizeof(threadname), "%d/HfaRead", hashfast->device_id);
+	snprintf(threadname, sizeof(threadname), "%d/%sRead", hashfast->device_id, hashfast->drv->name);
 	RenameThread(threadname);
 
 	while (likely(!hashfast->shutdown)) {
@@ -862,12 +863,12 @@ static void *hfa_read(void *arg)
 				hfa_parse_notice(hashfast, h);
 				break;
 			default:
-				applog(LOG_WARNING, "HFA %d: Unhandled operation code %d",
-				       hashfast->device_id, h->operation_code);
+				applog(LOG_WARNING, "%s %d: Unhandled operation code %d",
+				       hashfast->drv->name, hashfast->device_id, h->operation_code);
 				break;
 		}
 	}
-	applog(LOG_DEBUG, "HFA %d: Shutting down read thread", hashfast->device_id);
+	applog(LOG_DEBUG, "%s %d: Shutting down read thread", hashfast->drv->name, hashfast->device_id);
 
 	return NULL;
 }
@@ -898,8 +899,8 @@ static int hfa_jobs(struct cgpu_info *hashfast, struct hashfast_info *info)
 	if (unlikely(info->overheat)) {
 		/* Acknowledge and notify of new condition.*/
 		if (info->overheat < 0) {
-			applog(LOG_WARNING, "HFA %d: Hit overheat temp, throttling!",
-			       hashfast->device_id);
+			applog(LOG_WARNING, "%s %d: Hit overheat temp, throttling!",
+			       hashfast->drv->name, hashfast->device_id);
 			/* Value of 1 means acknowledged overheat */
 			info->overheat = 1;
 		}
@@ -926,14 +927,14 @@ static int64_t hfa_scanwork(struct thr_info *thr)
 	int64_t hashes;
 
 	if (unlikely(hashfast->usbinfo.nodev)) {
-		applog(LOG_WARNING, "HFA %d: device disappeared, disabling",
-		       hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: device disappeared, disabling",
+		       hashfast->drv->name, hashfast->device_id);
 		return -1;
 	}
 
 	if (unlikely(last_getwork - hashfast->last_device_valid_work > 60)) {
-		applog(LOG_WARNING, "HFA %d: No valid hashes for over 1 minute, attempting to reset",
-		       hashfast->device_id);
+		applog(LOG_WARNING, "%s %d: No valid hashes for over 1 minute, attempting to reset",
+		       hashfast->drv->name, hashfast->device_id);
 		if (info->hash_clock_rate > HFA_CLOCK_DEFAULT) {
 			info->hash_clock_rate -= 5;
 			if (info->hash_clock_rate < opt_hfa_hash_clock)
@@ -958,8 +959,8 @@ restart:
 		if (unlikely(!ret)) {
 			ret = hfa_reset(hashfast, info);
 			if (unlikely(!ret)) {
-				applog(LOG_ERR, "HFA %d: Failed to reset after write failure, disabling",
-				hashfast->device_id);
+				applog(LOG_ERR, "%s %d: Failed to reset after write failure, disabling",
+				       hashfast->drv->name, hashfast->device_id);
 				return -1;
 			}
 		}
@@ -977,7 +978,7 @@ restart:
 	}
 
 	if (jobs) {
-		applog(LOG_DEBUG, "HFA %d: Sending %d new jobs", hashfast->device_id,
+		applog(LOG_DEBUG, "%s %d: Sending %d new jobs", hashfast->drv->name, hashfast->device_id,
 		       jobs);
 	}
 
@@ -1013,8 +1014,8 @@ restart:
 		if (unlikely(!ret)) {
 			ret = hfa_reset(hashfast, info);
 			if (unlikely(!ret)) {
-				applog(LOG_ERR, "HFA %d: Failed to reset after write failure, disabling",
-				       hashfast->device_id);
+				applog(LOG_ERR, "%s %d: Failed to reset after write failure, disabling",
+				       hashfast->drv->name, hashfast->device_id);
 				return -1;
 			}
 		}
@@ -1024,8 +1025,9 @@ restart:
 		info->works[info->hash_sequence_head] = work;
 		mutex_unlock(&info->lock);
 
-		applog(LOG_DEBUG, "HFA %d: OP_HASH sequence %d search_difficulty %d work_difficulty %g",
-		       hashfast->device_id, info->hash_sequence_head, op_hash_data.search_difficulty, work->work_difficulty);
+		applog(LOG_DEBUG, "%s %d: OP_HASH sequence %d search_difficulty %d work_difficulty %g",
+		       hashfast->drv->name, hashfast->device_id, info->hash_sequence_head,
+		       op_hash_data.search_difficulty, work->work_difficulty);
 	}
 
 	/* Only count 2/3 of the hashes to smooth out the hashrate for cycles