Browse Source

bitmain: Remove more dead code

Luke Dashjr 10 years ago
parent
commit
cdbe9d6ba3
3 changed files with 1 additions and 60 deletions
  1. 0 42
      driver-bitmain.c
  2. 0 17
      driver-bitmain.h
  3. 1 1
      miner.h

+ 0 - 42
driver-bitmain.c

@@ -239,8 +239,6 @@ int btm_write(struct cgpu_info * const cgpu, void * const buf, const size_t bufs
 	return err;
 	return err;
 }
 }
 
 
-#define BITMAIN_CALC_DIFF1	1
-
 #ifdef WIN32
 #ifdef WIN32
 #define BITMAIN_TEST
 #define BITMAIN_TEST
 #endif
 #endif
@@ -836,7 +834,6 @@ static void bitmain_parse_results(struct cgpu_info *bitmain, struct bitmain_info
 	struct work *work = NULL;
 	struct work *work = NULL;
 	struct bitmain_packet_head packethead;
 	struct bitmain_packet_head packethead;
 	int asicnum = 0;
 	int asicnum = 0;
-	int idiff = 0;
 	int mod = 0,tmp = 0;
 	int mod = 0,tmp = 0;
 
 
 	for (i = 0; i <= spare; i++) {
 	for (i = 0; i <= spare; i++) {
@@ -983,7 +980,6 @@ static void bitmain_parse_results(struct cgpu_info *bitmain, struct bitmain_info
 							if (submit_nonce(thr, work, nonce)) {
 							if (submit_nonce(thr, work, nonce)) {
 								mutex_lock(&info->qlock);
 								mutex_lock(&info->qlock);
 								hashes_done2(thr, 0x100000000 * work->nonce_diff, NULL);
 								hashes_done2(thr, 0x100000000 * work->nonce_diff, NULL);
-								info->auto_nonces++;
 								mutex_unlock(&info->qlock);
 								mutex_unlock(&info->qlock);
 						 	} else {
 						 	} else {
 						 		applog(LOG_ERR, "BitMain: bitmain_decode_nonce error work(%d)", rxnoncedata.nonces[j].work_id);
 						 		applog(LOG_ERR, "BitMain: bitmain_decode_nonce error work(%d)", rxnoncedata.nonces[j].work_id);
@@ -994,34 +990,10 @@ static void bitmain_parse_results(struct cgpu_info *bitmain, struct bitmain_info
 						applog(LOG_ERR, "BitMain: Nonce not find work(%d)", rxnoncedata.nonces[j].work_id);
 						applog(LOG_ERR, "BitMain: Nonce not find work(%d)", rxnoncedata.nonces[j].work_id);
 					}
 					}
 				}
 				}
-#ifdef BITMAIN_CALC_DIFF1
-				if(opt_bitmain_hwerror) {
-					int difftmp = 0;
-					idiff = nonce_diff;
-					mutex_lock(&info->qlock);
-					difftmp = idiff*(rxnoncedata.total_nonce_num-info->total_nonce_num);
-					if(difftmp < 0)
-						difftmp = 0;
-
-					hashes_done2(thr, 0x100000000 * difftmp, NULL);
-					info->auto_nonces = info->auto_nonces+difftmp;
-					info->total_nonce_num = rxnoncedata.total_nonce_num;
-					bitmain_set_fifo_space(bitmain, rxnoncedata.fifo_space);
-					mutex_unlock(&info->qlock);
-
-					applog(LOG_DEBUG, "bitmain_parse_rxnonce fifo space=%d diff=%d rxtnn=%"PRIu64" tnn=%"PRIu64, info->fifo_space, idiff, rxnoncedata.total_nonce_num, info->total_nonce_num);
-				} else {
-					mutex_lock(&info->qlock);
-					bitmain_set_fifo_space(bitmain, rxnoncedata.fifo_space);
-					mutex_unlock(&info->qlock);
-					applog(LOG_DEBUG, "bitmain_parse_rxnonce fifo space=%d", info->fifo_space);
-				}
-#else
 				mutex_lock(&info->qlock);
 				mutex_lock(&info->qlock);
 				bitmain_set_fifo_space(bitmain, rxnoncedata.fifo_space);
 				bitmain_set_fifo_space(bitmain, rxnoncedata.fifo_space);
 				mutex_unlock(&info->qlock);
 				mutex_unlock(&info->qlock);
 				applog(LOG_DEBUG, "bitmain_parse_rxnonce fifo space=%d", info->fifo_space);
 				applog(LOG_DEBUG, "bitmain_parse_rxnonce fifo space=%d", info->fifo_space);
-#endif
 
 
 #ifndef WIN32
 #ifndef WIN32
 				if(nonce_num < BITMAIN_MAX_NONCE_NUM)
 				if(nonce_num < BITMAIN_MAX_NONCE_NUM)
@@ -1055,7 +1027,6 @@ static void bitmain_parse_results(struct cgpu_info *bitmain, struct bitmain_info
 
 
 static void bitmain_running_reset(struct cgpu_info *bitmain, struct bitmain_info *info)
 static void bitmain_running_reset(struct cgpu_info *bitmain, struct bitmain_info *info)
 {
 {
-	bitmain->results = 0;
 	info->reset = false;
 	info->reset = false;
 }
 }
 
 
@@ -1164,17 +1135,7 @@ static bool bitmain_prepare(struct thr_info *thr)
 	struct cgpu_info *bitmain = thr->cgpu;
 	struct cgpu_info *bitmain = thr->cgpu;
 	struct bitmain_info *info = bitmain->device_data;
 	struct bitmain_info *info = bitmain->device_data;
 
 
-	free(bitmain->works);
-	bitmain->works = calloc(BITMAIN_MAX_WORK_NUM * sizeof(struct work *),
-			       BITMAIN_ARRAY_SIZE);
-	if (!bitmain->works)
-		quit(1, "Failed to calloc bitmain works in bitmain_prepare");
-
-	info->thr = thr;
-	mutex_init(&info->lock);
 	mutex_init(&info->qlock);
 	mutex_init(&info->qlock);
-	if (unlikely(pthread_cond_init(&info->qcond, NULL)))
-		quit(1, "Failed to pthread_cond_init bitmain qcond");
 
 
 	// To initialise queue_full
 	// To initialise queue_full
 	bitmain_set_fifo_space(bitmain, info->fifo_space);
 	bitmain_set_fifo_space(bitmain, info->fifo_space);
@@ -1346,8 +1307,6 @@ static int bitmain_initialize(struct cgpu_info *bitmain)
 	p.tv_nsec = BITMAIN_RESET_PITCH;
 	p.tv_nsec = BITMAIN_RESET_PITCH;
 	nanosleep(&p, NULL);
 	nanosleep(&p, NULL);
 
 
-	cgtime(&info->last_status_time);
-
 	if(statusok) {
 	if(statusok) {
 		applog(LOG_ERR, "bitmain_initialize start send txconfig");
 		applog(LOG_ERR, "bitmain_initialize start send txconfig");
 		if(opt_bitmain_hwerror)
 		if(opt_bitmain_hwerror)
@@ -1459,7 +1418,6 @@ static void do_bitmain_close(struct thr_info *thr)
 	struct cgpu_info *bitmain = thr->cgpu;
 	struct cgpu_info *bitmain = thr->cgpu;
 	struct bitmain_info *info = bitmain->device_data;
 	struct bitmain_info *info = bitmain->device_data;
 
 
-	pthread_join(info->read_thr, NULL);
 	bitmain_running_reset(bitmain, info);
 	bitmain_running_reset(bitmain, info);
 
 
 	info->no_matching_work = 0;
 	info->no_matching_work = 0;

+ 0 - 17
driver-bitmain.h

@@ -22,11 +22,9 @@
 //#define BITMAIN_TYPE_S3
 //#define BITMAIN_TYPE_S3
 #define BITMAIN_TYPE_S4
 #define BITMAIN_TYPE_S4
 
 
-#define BITMAIN_RESET_FAULT_DECISECONDS 1
 #define BITMAIN_MINER_THREADS 1
 #define BITMAIN_MINER_THREADS 1
 
 
 #define BITMAIN_IO_SPEED		115200
 #define BITMAIN_IO_SPEED		115200
-#define BITMAIN_HASH_TIME_FACTOR	((float)1.67/0x32)
 #define BITMAIN_RESET_PITCH	(300*1000*1000)
 #define BITMAIN_RESET_PITCH	(300*1000*1000)
 
 
 #define BITMAIN_TOKEN_TYPE_TXCONFIG 0x51
 #define BITMAIN_TOKEN_TYPE_TXCONFIG 0x51
@@ -240,7 +238,6 @@ struct bitmain_info {
 	int temp_sum;
 	int temp_sum;
 	int temp_old;
 	int temp_old;
 	int fan_pwm;
 	int fan_pwm;
-	uint64_t total_nonce_num;
 
 
 	int frequency;
 	int frequency;
 	char frequency_t[256];
 	char frequency_t[256];
@@ -254,26 +251,12 @@ struct bitmain_info {
 	int no_matching_work;
 	int no_matching_work;
 	//int matching_work[BITMAIN_DEFAULT_CHAIN_NUM];
 	//int matching_work[BITMAIN_DEFAULT_CHAIN_NUM];
 
 
-	struct thr_info *thr;
-	pthread_t read_thr;
-	pthread_t write_thr;
-	pthread_mutex_t lock;
 	pthread_mutex_t qlock;
 	pthread_mutex_t qlock;
-	pthread_cond_t qcond;
 	int fifo_space;
 	int fifo_space;
 	int max_fifo_space;
 	int max_fifo_space;
 	int hw_version[4];
 	int hw_version[4];
-	unsigned int last_work_block;
-	struct timeval last_status_time;
-	int send_full_space;
-
-	int auto_queued;
-	int auto_nonces;
-	int auto_hw;
 
 
-	int idle;
 	bool reset;
 	bool reset;
-	bool optimal;
 	
 	
 	char g_miner_version[256];
 	char g_miner_version[256];
 	
 	

+ 1 - 1
miner.h

@@ -512,7 +512,7 @@ struct cgpu_info {
 		struct ft232r_device_handle *device_ft232r;
 		struct ft232r_device_handle *device_ft232r;
 #endif
 #endif
 	};
 	};
-#if defined(USE_AVALON) || defined(USE_BITMAIN)
+#ifdef USE_AVALON
 	struct work **works;
 	struct work **works;
 	int work_array;
 	int work_array;
 	int queued;
 	int queued;