Browse Source

Merge commit 'b83cdf1' into bfgminer

Luke Dashjr 12 years ago
parent
commit
b407ab32a3
9 changed files with 14 additions and 2 deletions
  1. 1 0
      api.c
  2. 1 0
      driver-avalon.c
  3. 2 0
      driver-bitforce.c
  4. 2 0
      driver-icarus.c
  5. 2 0
      driver-modminer.c
  6. 3 1
      driver-x6500.c
  7. 1 0
      driver-ztex.c
  8. 1 1
      miner.c
  9. 1 0
      miner.h

+ 1 - 0
api.c

@@ -1391,6 +1391,7 @@ static const char *status2str(enum alive status)
 		case LIFE_NOSTART:
 			return NOSTART;
 		case LIFE_INIT:
+		case LIFE_INIT2:
 			return INIT;
 		case LIFE_WAIT:
 			return WAIT;

+ 1 - 0
driver-avalon.c

@@ -691,6 +691,7 @@ static bool avalon_prepare(struct thr_info *thr)
 
 	cgtime(&now);
 	get_datestamp(avalon->init, &now);
+	proc->status = LIFE_INIT2;
 	return true;
 }
 

+ 2 - 0
driver-bitforce.c

@@ -1311,6 +1311,7 @@ static bool bitforce_thread_init(struct thr_info *thr)
 			if (opt_bfl_noncerange)
 				bitforce_change_mode(bitforce, BFP_RANGE);
 		}
+		bitforce->status = LIFE_INIT2;
 		
 		first_on_this_board = procdata;
 		for (int proc = 1; proc < data->parallel; ++proc)
@@ -1325,6 +1326,7 @@ static bool bitforce_thread_init(struct thr_info *thr)
 			procdata->handles_board = false;
 			procdata->cgpu = bitforce;
 			bitforce->device_data = data;
+			bitforce->status = LIFE_INIT2;
 		}
 		applog(LOG_DEBUG, "%s: Board %d: %"PRIpreprv"-%"PRIpreprv, bitforce->dev_repr, boardno, first_on_this_board->cgpu->proc_repr, bitforce->proc_repr);
 		

+ 2 - 0
driver-icarus.c

@@ -682,6 +682,8 @@ static bool icarus_prepare(struct thr_info *thr)
 	}
 #endif
 
+	icarus->status = LIFE_INIT2;
+	
 	return true;
 }
 

+ 2 - 0
driver-modminer.c

@@ -300,6 +300,8 @@ modminer_fpga_prepare(struct thr_info *thr)
 	dclk_prepare(&state->dclk);
 	state->next_work_cmd[0] = MODMINER_SEND_WORK;
 	state->next_work_cmd[1] = proc->proc_id;  // FPGA id
+	
+	proc->status = LIFE_INIT2;
 
 	return true;
 }

+ 3 - 1
driver-x6500.c

@@ -227,7 +227,7 @@ x6500_fpga_upload_bitstream(struct cgpu_info *x6500, struct jtag_port *jp1)
 
 	applog(LOG_WARNING, "%s: Programming %s...",
 	       x6500->dev_repr, x6500->device_path);
-	x6500->status = LIFE_INIT;
+	x6500->status = LIFE_INIT2;
 	
 	// "Magic" jtag_port configured to access both FPGAs concurrently
 	struct jtag_port jpt = {
@@ -344,6 +344,7 @@ static bool x6500_thread_init(struct thr_info *thr)
 	notifier_init(thr->mutex_request);
 	pthread_cond_init(&x6500->device_cond, NULL);
 	
+	// This works because x6500_thread_init is only called for the first processor now that they're all using the same thread
 	for ( ; x6500; x6500 = x6500->next_proc)
 	{
 		thr = x6500->thr[0];
@@ -363,6 +364,7 @@ static bool x6500_thread_init(struct thr_info *thr)
 	jp->a = x6500->device_data;
 	x6500_jtag_set(jp, pinoffset);
 	thr->cgpu_data = fpga;
+	x6500->status = LIFE_INIT2;
 	
 	if (!jtag_reset(jp)) {
 		applog(LOG_ERR, "%s: JTAG reset failed",

+ 1 - 0
driver-ztex.c

@@ -376,6 +376,7 @@ static bool ztex_prepare(struct thr_info *thr)
 	ztex_releaseFpga(ztex);
 	notifier_init(thr->work_restart_notifier);
 	applog(LOG_DEBUG, "%"PRIpreprv": prepare", cgpu->proc_repr);
+	cgpu->status = LIFE_INIT2;
 	return true;
 }
 

+ 1 - 1
miner.c

@@ -8049,7 +8049,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
 				continue;
 #endif
 			if (cgpu->status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME)) {
-				if (cgpu->status != LIFE_INIT)
+				if (likely(cgpu->status != LIFE_INIT && cgpu->status != LIFE_INIT2))
 				applog(LOG_ERR, "%s: Recovered, declaring WELL!", dev_str);
 				cgpu->status = LIFE_WELL;
 				cgpu->device_last_well = time(NULL);

+ 1 - 0
miner.h

@@ -215,6 +215,7 @@ enum alive {
 	LIFE_NOSTART,
 	LIFE_INIT,
 	LIFE_WAIT,
+	LIFE_INIT2,  // Still initializing, but safe to call functions
 };