Browse Source

Merge branch 'monarch' into bfgminer

Luke Dashjr 12 years ago
parent
commit
8309bff8e7
1 changed files with 9 additions and 19 deletions
  1. 9 19
      driver-bitforce.c

+ 9 - 19
driver-bitforce.c

@@ -622,21 +622,6 @@ void bitforce_comm_error(struct thr_info *thr)
 	bitforce_clear_buffer(bitforce);
 	bitforce_clear_buffer(bitforce);
 }
 }
 
 
-static bool bitforce_thread_prepare(struct thr_info *thr)
-{
-	struct cgpu_info *bitforce = thr->cgpu;
-	
-	if (unlikely(!bitforce_open(bitforce)))
-	{
-		applog(LOG_ERR, "%s: Failed to open %s", bitforce->dev_repr, bitforce->device_path);
-		return false;
-	}
-
-	applog(LOG_INFO, "%s: Opened %s", bitforce->dev_repr, bitforce->device_path);
-
-	return true;
-}
-
 static
 static
 void __bitforce_clear_buffer(struct cgpu_info * const dev)
 void __bitforce_clear_buffer(struct cgpu_info * const dev)
 {
 {
@@ -1614,6 +1599,13 @@ static bool bitforce_thread_init(struct thr_info *thr)
 	applog(LOG_DEBUG, "%s: Delaying start by %dms", bitforce->dev_repr, wait / 1000);
 	applog(LOG_DEBUG, "%s: Delaying start by %dms", bitforce->dev_repr, wait / 1000);
 	cgsleep_ms(wait);
 	cgsleep_ms(wait);
 
 
+	if (unlikely(!bitforce_open(bitforce)))
+	{
+		applog(LOG_ERR, "%s: Failed to open %s", bitforce->dev_repr, bitforce->device_path);
+		return false;
+	}
+	applog(LOG_INFO, "%s: Opened %s", bitforce->dev_repr, bitforce->device_path);
+	
 	if (style != BFS_FPGA)
 	if (style != BFS_FPGA)
 	{
 	{
 		// Clear results queue last, to start fresh; ignore response
 		// Clear results queue last, to start fresh; ignore response
@@ -1813,7 +1805,6 @@ struct device_drv bitforce_drv = {
 	.reinit_device = bitforce_reinit,
 	.reinit_device = bitforce_reinit,
 	.get_stats = bitforce_get_stats,
 	.get_stats = bitforce_get_stats,
 	.identify_device = bitforce_identify,
 	.identify_device = bitforce_identify,
-	.thread_prepare = bitforce_thread_prepare,
 	.thread_init = bitforce_thread_init,
 	.thread_init = bitforce_thread_init,
 	.job_prepare = bitforce_job_prepare,
 	.job_prepare = bitforce_job_prepare,
 	.job_start = bitforce_job_start,
 	.job_start = bitforce_job_start,
@@ -1856,7 +1847,7 @@ bool bitforce_send_queue(struct thr_info *thr)
 	if (data->style == BFS_65NM)
 	if (data->style == BFS_65NM)
 		qjp_sz -= 3;
 		qjp_sz -= 3;
 	uint8_t qjp[qjp_sz], *qjs;
 	uint8_t qjp[qjp_sz], *qjs;
-	qjs = &qjp[qjp_sz - 1];
+	qjs = &qjp[qjp_sz];
 	// NOTE: qjp is build backwards here
 	// NOTE: qjp is build backwards here
 	
 	
 	*(--qjs) = 0xfe;
 	*(--qjs) = 0xfe;
@@ -1874,7 +1865,7 @@ bool bitforce_send_queue(struct thr_info *thr)
 	*(--qjs) = data->ready_to_queue;
 	*(--qjs) = data->ready_to_queue;
 	*(--qjs) = 0xc1;
 	*(--qjs) = 0xc1;
 	if (data->style == BFS_65NM)
 	if (data->style == BFS_65NM)
-		*(--qjs) = qjp_sz;
+		*(--qjs) = qjp_sz - 1;
 	else
 	else
 	{
 	{
 		*(--qjs) = qjp_sz >> 8;
 		*(--qjs) = qjp_sz >> 8;
@@ -2348,7 +2339,6 @@ struct device_drv bitforce_queue_api = {
 	.get_api_stats = bitforce_drv_stats,
 	.get_api_stats = bitforce_drv_stats,
 	.get_stats = bitforce_get_stats,
 	.get_stats = bitforce_get_stats,
 	.identify_device = bitforce_identify,
 	.identify_device = bitforce_identify,
-	.thread_prepare = bitforce_thread_prepare,
 	.thread_init = bitforce_thread_init,
 	.thread_init = bitforce_thread_init,
 	.queue_append = bitforce_queue_append,
 	.queue_append = bitforce_queue_append,
 	.queue_flush = bitforce_queue_flush,
 	.queue_flush = bitforce_queue_flush,