bab report missing chips at start and API
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
diff --git a/driver-bab.c b/driver-bab.c
index 6d00544..76de602 100644
--- a/driver-bab.c
+++ b/driver-bab.c
@@ -304,6 +304,7 @@ struct bab_info {
int spifd;
int chips;
int chips_per_bank[BAB_MAXBANKS+1];
+ int missing_chips_per_bank[BAB_MAXBANKS+1];
int boards;
int banks;
uint32_t chip_spis[BAB_MAXCHIPS+1];
@@ -1069,7 +1070,7 @@ bad_out:
static void bab_init_chips(struct cgpu_info *babcgpu, struct bab_info *babinfo)
{
- int chip, chipoff, bank, chips, new_chips, boards;
+ int chip, chipoff, bank, chips, new_chips, boards, mis;
applog(LOG_WARNING, "%s V1 first test for %d chips ...",
babcgpu->drv->dname, BAB_V1_CHIP_TEST);
@@ -1087,6 +1088,14 @@ static void bab_init_chips(struct cgpu_info *babcgpu, struct bab_info *babinfo)
babinfo->chips_per_bank[BAB_V1_BANK] = babinfo->chips;
babinfo->boards = (int)((float)(babinfo->chips - 1) / BAB_BOARDCHIPS) + 1;
babinfo->reply_wait = BAB_REPLY_WAIT_mS * 2;
+
+ if ((chip = (babinfo->chips_per_bank[BAB_V1_BANK] % BAB_BOARDCHIPS))) {
+ mis = BAB_BOARDCHIPS - chip;
+ babinfo->missing_chips_per_bank[BAB_V1_BANK] = mis;
+ applog(LOG_WARNING, "%s V1: missing %d chip%s",
+ babcgpu->drv->dname, mis,
+ (mis == 1) ? "" : "s");
+ }
} else {
applog(LOG_WARNING, "%s no chips found with V1", babcgpu->drv->dname);
applog(LOG_WARNING, "%s V2 test %d banks %d chips ...",
@@ -1115,6 +1124,14 @@ static void bab_init_chips(struct cgpu_info *babcgpu, struct bab_info *babinfo)
babcgpu->drv->dname, bank, new_chips,
boards, (boards == 1) ? "" : "s");
babinfo->boards += boards;
+
+ if ((chip = (babinfo->chips_per_bank[bank] % BAB_BOARDCHIPS))) {
+ mis = BAB_BOARDCHIPS - chip;
+ babinfo->missing_chips_per_bank[bank] = mis;
+ applog(LOG_WARNING, "%s V2: bank %d missing %d chip%s",
+ babcgpu->drv->dname, bank,
+ mis, (mis == 1) ? "" : "s");
+ }
}
babinfo->reply_wait = BAB_REPLY_WAIT_mS * babinfo->banks;
bab_reset(0, 8);
@@ -1798,6 +1815,15 @@ static struct api_data *bab_api_stats(struct cgpu_info *babcgpu)
}
root = api_add_string(root, "Chips Per Bank", data, true);
+ data[0] = '\0';
+ for (i = 0; i <= BAB_MAXBANKS; i++) {
+ snprintf(buf, sizeof(buf), "%s%d",
+ (i == 0) ? "" : " ",
+ babinfo->missing_chips_per_bank[i]);
+ strcat(data, buf);
+ }
+ root = api_add_string(root, "Missing Chips Per Bank", data, true);
+
cgtime(&now);
elapsed = tdiff(&now, &(babcgpu->dev_start_tv));