diff options
author | Alexey Dokuchaev <danfe@FreeBSD.org> | 2009-03-31 22:23:19 +0000 |
---|---|---|
committer | Alexey Dokuchaev <danfe@FreeBSD.org> | 2009-03-31 22:23:19 +0000 |
commit | 9d712428f5eea02595aa62eae9921e6363e21a6f (patch) | |
tree | 22fb0efd672ac61c6d0598ceca2bb8371936bee9 /sysutils/memtest86+/files/patch-test.c | |
parent | - The squid_kerb_auth helper needs to know about the endianness of the system (diff) |
Add memtest86+ 2.11, stand-alone memory test for x86 architecture
computers.
PR: ports/132700 (based on)
Submitted by: Andriy Gapon
Notes
Notes:
svn path=/head/; revision=231417
Diffstat (limited to 'sysutils/memtest86+/files/patch-test.c')
-rw-r--r-- | sysutils/memtest86+/files/patch-test.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/sysutils/memtest86+/files/patch-test.c b/sysutils/memtest86+/files/patch-test.c new file mode 100644 index 000000000000..367bad070b9b --- /dev/null +++ b/sysutils/memtest86+/files/patch-test.c @@ -0,0 +1,60 @@ +--- test.c 2008-11-16 02:18:14.000000000 +0200 ++++ test.c 2009-02-18 00:27:11.000000000 +0200 +@@ -6,12 +6,11 @@ + * ---------------------------------------------------- + * MemTest86+ V2.01 Specific code (GPL V2.0) + * By Samuel DEMEULEMEESTER, sdemeule@memtest.org + * http://www.canardpc.com - http://www.memtest.org + */ + +-#include "test.h" + #include "config.h" +-#include <sys/io.h> ++#include "test.h" + #include "dmi.h" + + extern int segs, bail; +@@ -1400,6 +1399,20 @@ void sleep(int n, int sms) + } + } + ++static inline unsigned char inb(unsigned int port) ++{ ++ unsigned char data; ++ ++ asm __volatile__("inb %1,%0" : "=a" (data) : "id" ((unsigned short)(port))); ++ return (data); ++} ++ ++static inline void outb(unsigned int port, unsigned char data) ++{ ++ asm __volatile__("outb %0,%1" : : "a" (data), "id" ((unsigned short)(port))); ++} ++ ++ + /* Beep function */ + + void beep(unsigned int frequency) +@@ -1407,18 +1420,18 @@ void beep(unsigned int frequency) + unsigned int count = 1193180 / frequency; + + // Switch on the speaker +- outb_p(inb_p(0x61)|3, 0x61); ++ outb(inb(0x61)|3, 0x61); + + // Set command for counter 2, 2 byte write +- outb_p(0xB6, 0x43); ++ outb(0xB6, 0x43); + + // Select desired Hz +- outb_p(count & 0xff, 0x42); ++ outb(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); ++ outb(inb(0x61)&0xFC, 0x61); + } |