Commit 53b8b2cdc5230b575f16e2cecb1897df0896ab21

Kano 2014-01-12T07:51:57

bab report V2 banks/boards during initialisation

diff --git a/driver-bab.c b/driver-bab.c
index 401b246..1e7aee2 100644
--- a/driver-bab.c
+++ b/driver-bab.c
@@ -285,6 +285,7 @@ struct bab_info {
 
 	int spifd;
 	int chips;
+	int boards;
 	uint32_t chip_spis[BAB_MAXCHIPS+1];
 
 	cgsem_t scan_work;
@@ -1004,7 +1005,7 @@ bad_out:
 
 static void bab_init_chips(struct cgpu_info *babcgpu, struct bab_info *babinfo)
 {
-	int chip, chipoff, bank;
+	int chip, chipoff, bank, chips, new_chips, boards;
 
 	applog(LOG_WARNING, "%s V1 first test for %d chips ...",
 			    babcgpu->drv->dname, BAB_V1_CHIP_TEST);
@@ -1022,6 +1023,7 @@ static void bab_init_chips(struct cgpu_info *babcgpu, struct bab_info *babinfo)
 		applog(LOG_WARNING, "%s V2 test %d banks %d chips ...",
 				    babcgpu->drv->dname, BAB_MAXBANKS, BAB_MAXCHIPS);
 
+		chips = 0;
 		for (bank = 1; bank <= BAB_MAXBANKS; bank++) {
 			for (chipoff = 0; chipoff < BAB_BANKCHIPS; chipoff++) {
 				chip = babinfo->chips + chipoff;
@@ -1029,6 +1031,16 @@ static void bab_init_chips(struct cgpu_info *babcgpu, struct bab_info *babinfo)
 			}
 			bab_reset(bank, 64);
 			bab_detect_chips(babcgpu, babinfo, bank, babinfo->chips, babinfo->chips + BAB_BANKCHIPS);
+			new_chips = babinfo->chips - chips;
+			chips = babinfo->chips;
+			if (new_chips == 0)
+				boards = 0;
+			else
+				boards = (int)((float)(new_chips - 1) / BAB_BOARDCHIPS) + 1;
+			applog(LOG_WARNING, "%s V2 bank %d: %d chips %d board%s",
+					    babcgpu->drv->dname, bank, new_chips,
+					    boards, (boards == 1) ? "" : "s");
+			babinfo->boards += boards;
 		}
 		bab_reset(0, 8);
 	}
@@ -1074,7 +1086,15 @@ static void bab_detect(bool hotplug)
 
 	bab_init_chips(babcgpu, babinfo);
 
-	applog(LOG_WARNING, "%s found %d chips", babcgpu->drv->dname, babinfo->chips);
+	if (babinfo->boards) {
+		applog(LOG_WARNING, "%s found %d chips %d board%s",
+				    babcgpu->drv->dname, babinfo->chips,
+				    babinfo->boards,
+				    (babinfo->boards == 1) ? "" : "s");
+	} else {
+		applog(LOG_WARNING, "%s found %d chips",
+				    babcgpu->drv->dname, babinfo->chips);
+	}
 
 	if (babinfo->chips == 0)
 		goto cleanup;