Exemplo n.º 1
0
void get_config()
{
    int flag = 0, sflag = 0, i, prt = 0;
    int reprint_screen = 0;
    ulong page;

    popup();
    wait_keyup();
    while(!flag) {
        cprint(POP_Y+1,  POP_X+2, "Configuration:");
        cprint(POP_Y+3,  POP_X+6, "(1) Test Selection");
        cprint(POP_Y+4,  POP_X+6, "(2) Address Range");
        cprint(POP_Y+5,  POP_X+6, "(3) Memory Sizing");
        cprint(POP_Y+6,  POP_X+6, "(4) Error Summary");
        cprint(POP_Y+7,  POP_X+6, "(5) Error Report Mode");
        cprint(POP_Y+8,  POP_X+6, "(6) ECC Mode");
        cprint(POP_Y+9,  POP_X+6, "(7) Restart w/Defaults");
        cprint(POP_Y+10, POP_X+6, "(8) Redraw Screen");
        cprint(POP_Y+11, POP_X+6, "(9) Adv. Options");
        cprint(POP_Y+12,POP_X+6,"(0) Continue");

        /* Wait for key release */
        /* Fooey! This nuts'es up the serial input. */
        sflag = 0;
        switch(get_key()) {
        case 2:
            /* 1 - Test Selection */
            popclear();
            cprint(POP_Y+1, POP_X+2, "Test Selection:");
            cprint(POP_Y+3, POP_X+6, "(1) Default Tests");
            cprint(POP_Y+4, POP_X+6, "(2) Skip Current Test");
            cprint(POP_Y+5, POP_X+6, "(3) Select Test");
            cprint(POP_Y+6, POP_X+6, "(4) Select Bit Fade Test");
            cprint(POP_Y+7, POP_X+6, "(0) Cancel");
            if (v->testsel < 0) {
                cprint(POP_Y+3, POP_X+5, ">");
            } else {
                cprint(POP_Y+5, POP_X+5, ">");
            }
            wait_keyup();
            while (!sflag) {
                switch(get_key()) {
                case 2:
                    /* Default */
                    if (v->testsel == 9) {
                        bail++;
                    }
                    v->testsel = -1;
                    find_ticks();
                    sflag++;
                    cprint(LINE_INFO, COL_TST, "Std");
                    break;
                case 3:
                    /* Skip test */
                    bail++;
                    sflag++;
                    break;
                case 4:
                    /* Select test */
                    popclear();
                    cprint(POP_Y+1, POP_X+3,
                           "Test Selection:");
                    cprint(POP_Y+4, POP_X+5,
                           "Test Number [0-9]: ");
                    i = getval(POP_Y+4, POP_X+24, 0);
                    if (i <= 9) {
                        if (i != v->testsel) {
                            v->pass = -1;
                            v->test = -1;
                        }
                        v->testsel = i;
                    }
                    find_ticks();
                    sflag++;
                    bail++;
                    cprint(LINE_INFO, COL_TST, "#");
                    dprint(LINE_INFO, COL_TST+1, i, 2, 1);
                    break;
                case 5:
                    if (v->testsel != 9) {
                        v->pass = -1;
                        v->test = -1;
                    }
                    v->testsel = 9;
                    find_ticks();
                    sflag++;
                    bail++;
                    cprint(LINE_INFO, COL_TST, "#");
                    dprint(LINE_INFO, COL_TST+1, 9, 2, 1);
                    break;
                case 11:
                case 57:
                    sflag++;
                    break;
                }
            }
            popclear();
            break;
        case 3:
            /* 2 - Address Range */
            popclear();
            cprint(POP_Y+1, POP_X+2, "Test Address Range:");
            cprint(POP_Y+3, POP_X+6, "(1) Set Lower Limit");
            cprint(POP_Y+4, POP_X+6, "(2) Set Upper Limit");
            cprint(POP_Y+5, POP_X+6, "(3) Test All Memory");
            cprint(POP_Y+6, POP_X+6, "(0) Cancel");
            wait_keyup();
            while (!sflag) {
                switch(get_key()) {
                case 2:
                    /* Lower Limit */
                    popclear();
                    cprint(POP_Y+2, POP_X+4,
                           "Lower Limit: ");
                    cprint(POP_Y+4, POP_X+4,
                           "Current: ");
                    aprint(POP_Y+4, POP_X+13, v->plim_lower);
                    cprint(POP_Y+6, POP_X+4,
                           "New: ");
                    page = getval(POP_Y+6, POP_X+9, 12);
                    if (page + 1 <= v->plim_upper) {
                        v->plim_lower = page;
                        bail++;
                    }
                    adj_mem();
                    find_ticks();
                    sflag++;
                    break;
                case 3:
                    /* Upper Limit */
                    popclear();
                    cprint(POP_Y+2, POP_X+4,
                           "Upper Limit: ");
                    cprint(POP_Y+4, POP_X+4,
                           "Current: ");
                    aprint(POP_Y+4, POP_X+13, v->plim_upper);
                    cprint(POP_Y+6, POP_X+4,
                           "New: ");
                    page = getval(POP_Y+6, POP_X+9, 12);
                    if  (page - 1 >= v->plim_lower) {
                        v->plim_upper = page;
                        bail++;
                    }
                    adj_mem();
                    find_ticks();
                    sflag++;
                    break;
                case 4:
                    /* All of memory */
                    v->plim_lower = 0;
                    v->plim_upper = v->pmap[v->msegs - 1].end;
                    bail++;
                    adj_mem();
                    find_ticks();
                    sflag++;
                    break;
                case 11:
                case 57:
                    /* 0/CR - Continue */
                    sflag++;
                    break;
                }
            }
            popclear();
            break;
        case 4:
            /* 3 - Memory Sizing */
            popclear();
            cprint(POP_Y+1, POP_X+2, "Memory Sizing:");
            cprint(POP_Y+3, POP_X+6, "(1) BIOS - Std");
            if (e820_nr) {
                cprint(POP_Y+4, POP_X+6, "(2) BIOS - All");
                cprint(POP_Y+5, POP_X+6, "(3) Probe");
                cprint(POP_Y+6, POP_X+6, "(0) Continue");
                cprint(POP_Y+2+memsz_mode, POP_X+5, ">");
            } else {
                cprint(POP_Y+4, POP_X+6, "(3) Probe");
                cprint(POP_Y+5, POP_X+6, "(0) Cancel");
                if (memsz_mode == SZ_MODE_BIOS) {
                    cprint(POP_Y+3, POP_X+5, ">");
                } else {
                    cprint(POP_Y+4, POP_X+5, ">");
                }
            }
            wait_keyup();
            while (!sflag) {
                switch(get_key()) {
                case 2:
                    memsz_mode = SZ_MODE_BIOS;
                    wait_keyup();
                    restart();
                    break;
                case 3:
                    memsz_mode = SZ_MODE_BIOS_RES;
                    wait_keyup();
                    restart();
                    break;
                case 4:
                    memsz_mode = SZ_MODE_PROBE;
                    wait_keyup();
                    restart();
                    break;
                case 11:
                case 57:
                    /* 0/CR - Continue */
                    sflag++;
                    break;
                }
            }
            popclear();
            break;
        case 5:
            /* 4 - Show error summary */
            popclear();
            for (i=0; tseq[i].msg != NULL; i++) {
                cprint(POP_Y+1+i, POP_X+2, "Test:");
                dprint(POP_Y+1+i, POP_X+8, i, 2, 1);
                cprint(POP_Y+1+i, POP_X+12, "Errors:");
                dprint(POP_Y+1+i, POP_X+20, tseq[i].errors,
                       5, 1);
            }
            wait_keyup();
            while (get_key() == 0);
            popclear();
            break;
        case 6:
            /* 5 - Printing Mode */
            popclear();
            cprint(POP_Y+1, POP_X+2, "Printing Mode:");
            cprint(POP_Y+3, POP_X+6, "(1) Individual Errors");
            cprint(POP_Y+4, POP_X+6, "(2) BadRAM Patterns");
            cprint(POP_Y+5, POP_X+6, "(3) Error Counts Only");
            cprint(POP_Y+6, POP_X+6, "(0) Cancel");
            cprint(POP_Y+3+v->printmode, POP_X+5, ">");
            wait_keyup();
            while (!sflag) {
                switch(get_key()) {
                case 2:
                    /* Separate Addresses */
                    v->printmode=PRINTMODE_ADDRESSES;
                    v->eadr = 0;
                    sflag++;
                    break;
                case 3:
                    /* BadRAM Patterns */
                    v->printmode=PRINTMODE_PATTERNS;
                    sflag++;
                    prt++;
                    break;
                case 4:
                    /* Error Counts Only */
                    v->printmode=PRINTMODE_NONE;
                    sflag++;
                    break;
                case 11:
                case 57:
                    /* 0/CR - Continue */
                    sflag++;
                    break;
                }
            }
            popclear();
            break;
        case 7:
            /* 6 - ECC Polling Mode */
            popclear();
            cprint(POP_Y+1, POP_X+2, "ECC Polling Mode:");
            cprint(POP_Y+3, POP_X+6, "(1) Recommended");
            cprint(POP_Y+4, POP_X+6, "(2) On");
            cprint(POP_Y+5, POP_X+6, "(3) Off");
            cprint(POP_Y+6, POP_X+6, "(0) Cancel");
            wait_keyup();
            while(!sflag) {
                switch(get_key()) {
                case 2:
                    set_ecc_polling(-1);
                    sflag++;
                    break;
                case 3:
                    set_ecc_polling(1);
                    sflag++;
                    break;
                case 4:
                    set_ecc_polling(0);
                    sflag++;
                    break;
                case 11:
                case 57:
                    /* 0/CR - Continue */
                    sflag++;
                    break;
                }
            }
            popclear();
            break;
        case 8:
            wait_keyup();
            restart();
            break;
        case 9:
            reprint_screen = 1;
            flag++;
            break;
        case 10:
            /* 9 - Advanced Options */
            popclear();
            cprint(POP_Y+1, POP_X+2, "Advanced Options:");
            cprint(POP_Y+3, POP_X+6, "(1) Display SPD Info");
            cprint(POP_Y+4, POP_X+6, "(2) Modify Memory Timing");
            cprint(POP_Y+5, POP_X+6, "(0) Cancel");
            wait_keyup();
            while (!sflag) {
                switch(get_key()) {
                case 2:
                    popdown();
                    show_spd();
                    popup();
                    sflag++;
                    break;
                case 3:
                    get_menu();
                    sflag++;
                    break;
                case 11:
                case 57:
                    /* 0/CR - Continue */
                    sflag++;
                    break;
                }
            }
            popclear();
            break;
        case 11:
        case 57:
        case 28:
            /* 0/CR/SP - Continue */
            flag++;
            break;
        }
    }
    popdown();
    if (prt) {
        printpatn();
    }
    if (reprint_screen) {
        tty_print_screen();
    }
}
Exemplo n.º 2
0
void get_config()
{
	int flag = 0, sflag = 0, i, j, k, n, m, prt = 0;
  int reprint_screen = 0;
  char cp[64];
	ulong page;

	popup();
	wait_keyup();
	while(!flag) {
		cprint(POP_Y+1,  POP_X+2, "Settings:");
		cprint(POP_Y+3,  POP_X+4, "(1) Select wat MEMEZ to test");
		cprint(POP_Y+4,  POP_X+4, "(2) Address Range");
		cprint(POP_Y+5,  POP_X+4, "(3) O NOES ERRORZ Mode");
		cprint(POP_Y+6,  POP_X+4, "(4) Select with COREZ 2 test");
		cprint(POP_Y+7,  POP_X+4, "(5) Refresh Screen");
		cprint(POP_Y+8,  POP_X+4, "(6) DISPLYUZ DMI DATUZ");
		cprint(POP_Y+9,  POP_X+4, "(7) such RAM much SPD");
		cprint(POP_Y+11, POP_X+4,	"(0) Continue rowHAMMER TIME");

		/* Wait for key release */
		/* Fooey! This nuts'es up the serial input. */
		sflag = 0;
		switch(get_key()) {
		case 2:
			/* 1 - Test Selection */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Test Selection:");
			cprint(POP_Y+3, POP_X+6, "(1) Default Tests");
			cprint(POP_Y+4, POP_X+6, "(2) Skip Current Test");
			cprint(POP_Y+5, POP_X+6, "(3) Select Test");
		  cprint(POP_Y+6, POP_X+6, "(4) Enter Test List");
			cprint(POP_Y+7, POP_X+6, "(0) Cancel");
			if (v->testsel < 0) {
				cprint(POP_Y+3, POP_X+5, ">");
			} else {
				cprint(POP_Y+5, POP_X+5, ">");
			}
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Default - All tests */
					i = 0;
					while (tseq[i].cpu_sel) {
					    tseq[i].sel = 1;
					    i++;
					}
					find_ticks_for_pass();
					sflag++;
					break;
				case 3:
					/* Skip test */
					bail++;
					sflag++;
					break;
				case 4:
					/* Select test */
					popclear();
					cprint(POP_Y+1, POP_X+3,
						"Test Selection:");
					cprint(POP_Y+4, POP_X+5,
						"Test Number [1-11]: ");
					n = getval(POP_Y+4, POP_X+24, 0) - 1;
					if (n <= 11) 
						{
					    /* Deselect all tests */
					    i = 0;
					    while (tseq[i].cpu_sel) {
					        tseq[i].sel = 0;
					        i++;
					    }
					    /* Now set the selection */
					    tseq[n].sel = 1;
					    v->pass = -1;
					    test = n;
					    find_ticks_for_pass();
					    sflag++;
          		bail++;
						}
					break;
				case 5:
					/* Enter a test list */
					popclear();
					cprint(POP_Y+1, POP_X+3,
				"Enter a comma separated list");
					cprint(POP_Y+2, POP_X+3,
				"of tests to execute:");
					cprint(POP_Y+5, POP_X+5, "List: ");
					/* Deselect all tests */
					k = 0;
					while (tseq[k].cpu_sel) {
					    tseq[k].sel = 0;
					    k++;
					}

					/* Get the list */
					for (i=0; i<64; i++) cp[i] = 0;
					get_list(POP_Y+5, POP_X+10, 64, cp);

					/* Now enable all of the tests in the
					 * list */
					i = j = m = 0;
					while (1) {
					    if (isdigit(cp[i])) {
						n = cp[i]-'0';
						j = j*10 + n;
						i++;
						if (cp[i] == ',' || cp[i] == 0){
						    if (j < k) {
							tseq[j].sel = 1;
							m++;
						    }
						    if (cp[i] == 0) break;
						    j = 0;
						    i++;
						}
					    }
					}

					/* If we didn't select at least one
					 * test turn them all back on */
					if (m == 0) {
					    k = 0;
					    while (tseq[k].cpu_sel) {
					        tseq[k].sel = 1;
					        k++;
					    }
					}
					v->pass = -1;
					test = n;
					find_ticks_for_pass();
					sflag++;
          bail++;
					break;
				case 11:
				case 57:
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 3:
			/* 2 - Address Range */
			popclear();
			cprint(POP_Y+1, POP_X+2, "rowHAMMER TIME Address Range:");
			cprint(POP_Y+3, POP_X+6, "(1) Set Lower Limit");
			cprint(POP_Y+4, POP_X+6, "(2) Set Upper Limit");
			cprint(POP_Y+5, POP_X+6, "(3) Test All Memory");
			cprint(POP_Y+6, POP_X+6, "(0) Cancel");
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Lower Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Lower Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_lower);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if (page + 1 <= v->plim_upper) {
						v->plim_lower = page;
						test--;
						bail++;
					}
					adj_mem();
					find_chunks();
					find_ticks_for_pass();
					sflag++;
					break;
				case 3:
					/* Upper Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Upper Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_upper);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if  (page - 1 >= v->plim_lower) {
						v->plim_upper = page;
						bail++;
						test--;
					}
					adj_mem();
					find_chunks();
					find_ticks_for_pass();
					sflag++;
					break;
				case 4:
					/* All of memory */
					v->plim_lower = 0;
					v->plim_upper =
						v->pmap[v->msegs - 1].end;
					test--;
					bail++;
					adj_mem();
					find_chunks();
					find_ticks_for_pass();
					sflag++;
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 4:
			/* Error Mode */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Printing Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) O NOES ALL ERRORZ");
			cprint(POP_Y+4, POP_X+6, "(2) O NOES ONE ERRORZ");
			cprint(POP_Y+5, POP_X+6, "(3) BadRAM Patterns. BADRAM");
			cprint(POP_Y+6, POP_X+6, "(4) O NOES HOW MANYZ ERRORZ");
			cprint(POP_Y+7, POP_X+6, "(5) BEEP BEEP BEEP ERRORZ");
			cprint(POP_Y+8, POP_X+6, "(0) GTFO");
			cprint(POP_Y+3+v->printmode, POP_X+5, ">");
			if (beepmode) { cprint(POP_Y+7, POP_X+5, ">"); }
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Error Summary */
					v->printmode=PRINTMODE_SUMMARY;
					v->erri.eadr = 0;
					v->erri.hdr_flag = 0;
					sflag++;
					break;
				case 3:
					/* Separate Addresses */
					v->printmode=PRINTMODE_ADDRESSES;
					v->erri.eadr = 0;
					v->erri.hdr_flag = 0;
					v->msg_line = LINE_SCROLL-1;
					sflag++;
					break;
				case 4:
					/* BadRAM Patterns */
					v->printmode=PRINTMODE_PATTERNS;
					v->erri.hdr_flag = 0;
					sflag++;
					prt++;
					break;
				case 5:
					/* Error Counts Only */
					v->printmode=PRINTMODE_NONE;
					v->erri.hdr_flag = 0;
					sflag++;
					break;
				case 6:
					/* Set Beep On Error mode */
					beepmode = !beepmode;
					sflag++;
					break;						
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 5:
    			/* CPU Mode */
    	reprint_screen = 1;
			popclear();
			cprint(POP_Y+1, POP_X+2, "BRAINE Selection Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) Parallel (All)");
			cprint(POP_Y+4, POP_X+6, "(2) Round Robin Hood (RRbH)");
			cprint(POP_Y+5, POP_X+6, "(3) Sequential (Seq)");
			cprint(POP_Y+6, POP_X+6, "(0) NOPE BYE");
			cprint(POP_Y+2+cpu_mode, POP_X+5, ">");
			wait_keyup();
			while(!sflag) {
				switch(get_key()) {
				case 2:
					if (cpu_mode != CPM_ALL) bail++;
					cpu_mode = CPM_ALL;
					sflag++;
					popdown();
					cprint(9,34,"All");
					popup();
					break;
				case 3:
					if (cpu_mode != CPM_RROBIN) bail++;
					cpu_mode = CPM_RROBIN;
					sflag++;
					popdown();
					cprint(9,34,"RRb");
					popup();
					break;
				case 4:
					if (cpu_mode != CPM_SEQ) bail++;
					cpu_mode = CPM_SEQ;
					sflag++;
					popdown();
					cprint(9,34,"Seq");
					popup();
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 6:
			reprint_screen = 1;
			flag++;
			break;
		case 7:
			/* Display DMI Memory Info */
			pop2up();
      print_dmi_info();
			pop2down();			
			break;
		case 8:
			/* Display SPD Data */			
			popdown();
			show_spd();
			popup();
			sflag++;
			break;
		case 11:
		case 57:
		case 28:
			/* 0/CR/SP - Continue */
			flag++;
			break;
		}
	}
	popdown();
	if (prt) {
		printpatn();
	}
        if (reprint_screen){
            tty_print_screen();
        }
}