diff options
author | Michael Brown | 2009-09-18 05:35:36 +0200 |
---|---|---|
committer | Michael Brown | 2012-07-09 16:41:24 +0200 |
commit | c2b0054384857aaa2b94e0bc63cf0c77b0eca766 (patch) | |
tree | 74e633b81a0688444252f2718b4a1a49f187d685 | |
parent | [import] Import version 1.26 (diff) | |
download | memtest86-c2b0054384857aaa2b94e0bc63cf0c77b0eca766.tar.gz memtest86-c2b0054384857aaa2b94e0bc63cf0c77b0eca766.tar.xz memtest86-c2b0054384857aaa2b94e0bc63cf0c77b0eca766.zip |
[import] Import version 1.27
http://www.memtest.org/download/1.27/memtest86+-1.27.tar.gz
-rw-r--r-- | ..mt127r3.exe | bin | 0 -> 86840 bytes | |||
-rw-r--r-- | config.c | 13 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | controller.c | 87 | ||||
-rwxr-xr-x[-rw-r--r--] | init.c | 45 | ||||
-rw-r--r-- | mt86+_loader.asm | 4 | ||||
-rw-r--r-- | mt86+_loader.bin | bin | 784 -> 784 bytes | |||
-rwxr-xr-x | precomp.bin | bin | 81860 -> 86056 bytes | |||
-rw-r--r-- | test.c | 59 | ||||
-rw-r--r-- | test.h | 4 |
10 files changed, 148 insertions, 67 deletions
diff --git a/..mt127r3.exe b/..mt127r3.exe Binary files differnew file mode 100644 index 0000000..a05ebbb --- /dev/null +++ b/..mt127r3.exe @@ -13,7 +13,7 @@ #include "controller.h" #define ITER 20 -extern int bail; +extern int bail, beepmode; extern struct tseq tseq[]; /* extern struct vars *v; */ extern short e820_nr; @@ -40,7 +40,7 @@ void get_config() cprint(POP_Y+9, POP_X+6, "(7) ECC Mode"); cprint(POP_Y+10, POP_X+6, "(8) Restart Test"); cprint(POP_Y+11, POP_X+6, "(9) Reprint Screen"); - cprint(POP_Y+12,POP_X+6,"(0) Exit"); + cprint(POP_Y+12, POP_X+6, "(0) Exit"); /* Wait for key release */ /* Fooey! This nuts'es up the serial input. */ @@ -335,8 +335,10 @@ void get_config() 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+6, POP_X+6, "(4) Beep on Error"); + cprint(POP_Y+7, POP_X+6, "(0) Cancel"); cprint(POP_Y+3+v->printmode, POP_X+5, ">"); + if (beepmode) { cprint(POP_Y+6, POP_X+5, ">"); } wait_keyup(); while (!sflag) { switch(get_key()) { @@ -357,6 +359,11 @@ void get_config() v->printmode=PRINTMODE_NONE; sflag++; break; + case 5: + /* Set Beep On Error mode */ + beepmode = !beepmode; + sflag++; + break; case 11: case 57: /* 0/CR - Cancel */ @@ -18,6 +18,9 @@ /* SERIAL_BAUD_RATE - Baud rate for the serial console */ #define SERIAL_BAUD_RATE 9600 +/* BEEP_MODE - Beep on error. Default off, Change to 1 to enable */ +#define BEEP_MODE 0 + /* SCRN_DEBUG - extra check for SCREEN_BUFFER */ /* #define SCRN_DEBUG */ diff --git a/controller.c b/controller.c index 3665472..d3f3d6a 100644 --- a/controller.c +++ b/controller.c @@ -3,7 +3,7 @@ * Released under version 2 of the Gnu Public License. * By Chris Brady, cbrady@sgi.com * ---------------------------------------------------- - * MemTest86+ V1.26 Specific code (GPL V2.0) + * MemTest86+ V1.27 Specific code (GPL V2.0) * By Samuel DEMEULEMEESTER, sdemeule@memtest.org * http://www.x86-secret.com - http://www.memtest.org */ @@ -563,8 +563,7 @@ static void setup_i925(void) { // Activate MMR I/O - ulong dev0;//, drt; - //long *ptr; + ulong dev0; // Current stepping of i925X does not support ECC ctrl.cap = ECC_CORRECT; @@ -573,7 +572,6 @@ static void setup_i925(void) pci_conf_read( 0, 0, 0, 0x54, 4, &dev0); dev0 = dev0 | 0x10000000; pci_conf_write( 0, 0, 0, 0x54, 4, dev0); - } @@ -607,9 +605,7 @@ static void poll_i875(void) /* Clear the error status */ pci_conf_write(ctrl.bus, ctrl.dev, ctrl.fn, 0xC8, 2, 0x81); - } - } static void setup_i845(void) @@ -782,6 +778,34 @@ static void poll_i860(void) static float athloncoef[] = {11, 11.5, 12.0, 12.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0, 10.5}; static float athloncoef2[] = {12, 19.0, 12.0, 20.0, 13.0, 13.5, 14.0, 21.0, 15.0, 22, 16.0, 16.5, 17.0, 18.0, 23.0, 24.0}; +static int p4model1ratios[] = {16, 17, 18, 19, 20, 21, 22, 23, 8, 9, 10, 11, 12, 13, 14, 15}; + +static int getP4PMmultiplier(void) +{ + unsigned int msr_lo, msr_hi; + int coef; + /* Find multiplier (by MSR) */ + + if (cpu_id.type == 6) { + rdmsr(0x2A, msr_lo, msr_hi); + coef = (msr_lo >> 22) & 0x1F; + } + else + { + if (cpu_id.model < 2) + { + rdmsr(0x2A, msr_lo, msr_hi); + coef = (msr_lo >> 8) & 0xF; + coef = p4model1ratios[coef]; + } + else + { + rdmsr(0x2C, msr_lo, msr_hi); + coef = (msr_lo >> 24) & 0x1F; + } + } + return coef; +} static void poll_fsb_amd64(void) { @@ -845,14 +869,10 @@ static void poll_fsb_amd64(void) { static void poll_fsb_i925(void) { double dramclock, dramratio, fsb; - unsigned int msr_lo, msr_hi; unsigned long mchcfg, mchcfg2, dev0; - int coef; + int coef = getP4PMmultiplier(); long *ptr; - /* Find multiplier (by MSR) */ - rdmsr(0x2C, msr_lo, msr_hi); - coef = (msr_lo >> 24) & 0x1F; /* Find dramratio */ pci_conf_read( 0, 0, 0, 0x44, 4, &dev0); @@ -862,14 +882,21 @@ static void poll_fsb_i925(void) { mchcfg2 = (mchcfg >> 4)&3; - if (mchcfg2 == 2) { dramratio = 1; } - else if (mchcfg2 == 1) { dramratio = 0.66667; } - else if (mchcfg2 == 3) { - // If mchcfg[0] = 1 => FSB533 / = 0 => FSB800 - if ((mchcfg & 1) == 0) { dramratio = 1.33334; } - else { dramratio = 1.5; } + if ((mchcfg >> 2)&1) { + if (mchcfg2 == 2) { dramratio = 0.75; } else { dramratio = 1; } + } else { + switch (mchcfg2) { + case 1: + dramratio = 0.66667; + break; + case 2: + dramratio = 1; + break; + case 3: + if ((mchcfg & 1) == 0) { dramratio = 1.33334; } + else { dramratio = 1.5; } + } } - // Compute RAM Frequency fsb = ((extclock /1000) / coef); @@ -891,13 +918,8 @@ static void poll_fsb_i925(void) { static void poll_fsb_i875(void) { double dramclock, dramratio, fsb; - unsigned int msr_lo, msr_hi; unsigned long mchcfg, smfs; - int coef; - - /* Find multiplier (by MSR) */ - rdmsr(0x2C, msr_lo, msr_hi); - coef = (msr_lo >> 24) & 0x1F; + int coef = getP4PMmultiplier(); /* Find dramratio */ pci_conf_read(0, 0, 0, 0xC6, 2, &mchcfg); @@ -939,17 +961,7 @@ static void poll_fsb_i875(void) { static void poll_fsb_p4(void) { ulong fsb, idetect; - unsigned int msr_lo, msr_hi; - int coef; - - /* Find multiplier (by MSR) - Added a check for P-M for ATi RSxxx chipsets */ - if (cpu_id.type == 6) { - rdmsr(0x2A, msr_lo, msr_hi); - coef = (msr_lo >> 22) & 0x1F; - } else { - rdmsr(0x2C, msr_lo, msr_hi); - coef = (msr_lo >> 24) & 0x1F; - } + int coef = getP4PMmultiplier(); fsb = ((extclock /1000) / coef); @@ -966,10 +978,8 @@ static void poll_fsb_p4(void) { if (idetect == 0x2540 || idetect == 0x254C) { print_fsb_info(fsb, "RAM : "); } - } - static void poll_fsb_i855(void) { @@ -1561,6 +1571,7 @@ static struct pci_memory_controller controllers[] = { { 0x10de, 0x01E0, "nVidia nForce2 SPP", 0, poll_fsb_nf2, poll_timings_nf2, setup_nothing, poll_nothing }, { 0x10de, 0x00D1, "nVidia nForce3", 0, poll_fsb_amd64, poll_timings_amd64, setup_amd64, poll_amd64 }, { 0x10de, 0x00E1, "nForce3 250", 0, poll_fsb_amd64, poll_timings_amd64, setup_amd64, poll_amd64 }, + { 0x10de, 0x005E, "nVidia nForce4", 0, poll_fsb_amd64, poll_timings_amd64, setup_amd64, poll_amd64 }, /* VIA */ { 0x1106, 0x0305, "VIA KT133/KT133A", 0, poll_fsb_nothing, poll_timings_nothing, setup_nothing, poll_nothing }, @@ -1618,7 +1629,7 @@ static struct pci_memory_controller controllers[] = { { 0x8086, 0x3580, "Intel ", 0, poll_fsb_i855, poll_timings_i852, setup_nothing, poll_nothing }, { 0x8086, 0x3340, "Intel i855PM", 0, poll_fsb_i855, poll_timings_i855, setup_nothing, poll_nothing }, { 0x8086, 0x2580, "Intel i915P/G", 0, poll_fsb_i925, poll_timings_i925, setup_i925, poll_nothing }, - { 0x8086, 0x2584, "Intel i925X", 0, poll_fsb_i925, poll_timings_i925, setup_i925, poll_nothing }, + { 0x8086, 0x2584, "Intel i925X/XE", 0, poll_fsb_i925, poll_timings_i925, setup_i925, poll_nothing }, }; static void print_memory_controller(void) @@ -3,7 +3,7 @@ * Released under version 2 of the Gnu Public License. * By Chris Brady, cbrady@sgi.com * ---------------------------------------------------- - * MemTest86+ V1.26 Specific code (GPL V2.0) + * MemTest86+ V1.27 Specific code (GPL V2.0) * By Samuel DEMEULEMEESTER, sdemeule@memtest.org * http://www.x86-secret.com - http://www.memtest.org */ @@ -17,6 +17,7 @@ extern short memsz_mode; extern short firmware; +int beepmode; struct cpu_ident cpu_id; ulong st_low, st_high; @@ -51,7 +52,7 @@ static void display_init(void) for(i=0, pp=(char *)(SCREEN_ADR+1); i<TITLE_WIDTH; i++, pp+=2) { *pp = 0x20; } - cprint(0, 0, " Memtest86 v1.26 "); + cprint(0, 0, " Memtest86 v1.27 "); for(i=0, pp=(char *)(SCREEN_ADR+1); i<2; i++, pp+=30) { *pp = 0xA4; @@ -96,6 +97,9 @@ void init(void) /* setup pci */ pci_init(); + + /* setup beep mode */ + beepmode = BEEP_MODE; v->test = 0; v->testsel = -1; @@ -448,24 +452,35 @@ void cpu_type(void) l1_cache += cpu_id.cache_info[7]; break; case 15: + l1_cache = cpu_id.cache_info[3]; + l1_cache += cpu_id.cache_info[7]; + l2_cache = (cpu_id.cache_info[11] << 8); + l2_cache += cpu_id.cache_info[10]; switch(cpu_id.model) { default: cprint(LINE_CPU, 0, "AMD Athlon 64"); - off = 13; - break; + off = 13; + break; case 5: - cprint(LINE_CPU, 0, "AMD Opteron"); - off = 11; - break; - case 12: - cprint(LINE_CPU, 0, "AMD Sempron"); - off = 11; - break; + cprint(LINE_CPU, 0, "AMD Opteron (0.13)"); + off = 18; + break; + case 4: + case 12: + if (l2_cache == 256) { + cprint(LINE_CPU, 0, "AMD Sempron (0.13)"); + off = 18; + } else { + cprint(LINE_CPU, 0, "Athlon 64 (0.13)"); + off = 16; + } + break; + case 15: + cprint(LINE_CPU, 0, "Athlon 64 (0.09)"); + off = 16; + break; + } - l1_cache = cpu_id.cache_info[3]; - l1_cache += cpu_id.cache_info[7]; - l2_cache = (cpu_id.cache_info[11] << 8); - l2_cache += cpu_id.cache_info[10]; break; } break; diff --git a/mt86+_loader.asm b/mt86+_loader.asm index da192ec..6916f8d 100644 --- a/mt86+_loader.asm +++ b/mt86+_loader.asm @@ -12,8 +12,8 @@ ; The good thing is that you get a single file which can be ; compressed, for example with http://upx.sf.net/ (UPX). -%define fullsize (81860 + buffer - start) - ; 81860 is the size of memtest86+ V1.26, adjust as needed! +%define fullsize (86056 + buffer - exeh) + ; 86056 is the size of memtest86+ V1.27, adjust as needed! %define stacksize 2048 %define stackpara ((stacksize + 15) / 16) diff --git a/mt86+_loader.bin b/mt86+_loader.bin Binary files differindex 38730ee..0d8b929 100644 --- a/mt86+_loader.bin +++ b/mt86+_loader.bin diff --git a/precomp.bin b/precomp.bin Binary files differindex c607ff5..6129a98 100755 --- a/precomp.bin +++ b/precomp.bin @@ -5,8 +5,10 @@ */ #include "test.h" #include "config.h" +#include <sys/io.h> -extern int segs, bail; + +extern int segs, bail, beepmode; extern volatile ulong *p; extern ulong p1, p2; extern int test_ticks, nticks; @@ -1145,7 +1147,7 @@ void bit_fade() BAILR } /* Snooze for 90 minutes */ - sleep (5400); + sleep (5400, 0); /* Make sure that nothing changed while sleeping */ for (j=0; j<segs; j++) { @@ -1282,6 +1284,12 @@ void print_hdr(void) static void update_err_counts(void) { ++(v->ecount); + + if (beepmode){ + beep(600); + beep(1000); + } + tseq[v->test].errors++; } @@ -1322,6 +1330,7 @@ void print_err( ulong *adr, ulong good, ulong bad, ulong xor) page = page_of(adr); offset = ((unsigned long)adr) & 0xFFF; common_err(page, offset); + ecount = 1; hprint(v->msg_line, 36, good); @@ -1478,7 +1487,9 @@ void do_tick(void) poll_errors(); } -void sleep(int n) +/* Sleep function */ + +void sleep(int n, int sms) { int i, ip; ulong sh, sl, l, h, t; @@ -1498,23 +1509,31 @@ void sleep(int n) :"=a" (l), "=d" (h) :"g" (sl), "g" (sh), "0" (l), "1" (h)); + + if (sms != 0) { + t = h * ((unsigned)0xffffffff / v->clks_msec); + t += (l / v->clks_msec); + } else { t = h * ((unsigned)0xffffffff / v->clks_msec) / 1000; t += (l / v->clks_msec) / 1000; - + } + /* Is the time up? */ if (t >= n) { break; } /* Display the elapsed time on the screen */ + if (sms == 0) { + i = t % 60; dprint(LINE_TIME, COL_TIME+9, i%10, 1, 0); dprint(LINE_TIME, COL_TIME+8, i/10, 1, 0); - if (i != ip) { - check_input(); - ip = i; - } + if (i != ip) { + check_input(); + ip = i; + } t /= 60; i = t % 60; @@ -1523,5 +1542,29 @@ void sleep(int n) t /= 60; dprint(LINE_TIME, COL_TIME, t, 4, 0); BAILR + } } } + +/* Beep function */ + +void beep(unsigned int frequency) +{ + unsigned int count = 1193180 / frequency; + + // Switch on the speaker + outb_p(inb_p(0x61)|3, 0x61); + + // Set command for counter 2, 2 byte write + outb_p(0xB6, 0x43); + + // Select desired Hz + outb_p(count & 0xff, 0x42); + outb((count >> 8) & 0xff, 0x42); + + // Block for 100 microseconds + sleep(100, 1); + + // Switch off the speaker + outb(inb_p(0x61)&0xFC, 0x61); +} @@ -129,7 +129,8 @@ void get_printmode(void); void addr_tst1(void); void addr_tst2(void); void bit_fade(void); -void sleep(int sec); +void sleep(int sec, int sms); +void beep(unsigned int frequency); void block_move(int iter); void find_ticks(void); void print_err(ulong *adr, ulong good, ulong bad, ulong xor); @@ -262,6 +263,7 @@ struct vars { int total_ticks; int pptr; int tptr; + int beepmode; struct pmap pmap[MAX_MEM_SEGMENTS]; struct mmap map[MAX_MEM_SEGMENTS]; ulong plim_lower; |