ports/sysutils/memtest86+/files/patch-test.c
Torsten Zuehlsdorff 3e4ce85bdc sysutils/memtest86+: upgrade from 4.20 to 5.0.1
- Added support for up to 2 TB of RAM on X64 CPUs
- Added experimental SMT support up to 32 cores
  (Press F2 to enable at startup)
- Added complete detection for memory controllers
- Added Motherboard Manufacturer & Model reporting
- Added CPU temperature reporting
- Added enhanced Fail Safe Mode (Press F1 at startup)
- Added support for Intel "Sandy Bridge-E" CPUs
- Added support for Intel "Ivy Bridge" CPUs
- Added preliminary support for Intel "Haswell" CPUs (Core 4th Gen)
- Added preliminary support for Intel "Haswell-ULT" CPUs
- Added support for AMD "Kabini" (K16) CPUs
- Added support for AMD "Bulldozer" CPUs
- Added support for AMD "Trinity" CPUs
- Added support for AMD E-/C-/G-/Z- "Bobcat" CPUs
- Added support for Intel Atom "Pineview" CPUs
- Added support for Intel Atom "Cedar Trail" CPUs
- Added SPD detection on most AMD Chipsets
- Enforced Coreboot support
- Optimized run time for faster memory error detection
- Rewriten lots of memory timings detection cod
- Corrected bugs, bugs and more bugs (some could remain)

Also set GCC_USE=4.8 because it did not compile with GCC 5+. There seems
to be a patch for this problem which will be tested later:
https://build.opensuse.org/package/view_file/Base:System/memtest86+/memtest86+-gcc5.patch?expand=1

PR:           210293
Submitted by: takefu@airport.fm
Reviewed by:  Andriy Gapon <avg@FreeBSD.org> (maintainer)
Approved by:  pi (mentor)
2016-09-30 11:40:44 +00:00

53 lines
1.2 KiB
C

--- test.c.orig 2013-08-10 02:29:44 UTC
+++ test.c
@@ -14,7 +14,6 @@
#include "stdint.h"
#include "cpuid.h"
#include "smp.h"
-#include <sys/io.h>
extern struct cpu_ident cpu_id;
extern volatile int mstr_cpu;
@@ -1543,6 +1542,19 @@ void sleep(long n, int flag, int me, int
}
}
+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)
@@ -1551,18 +1563,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, 0, 0, 1);
// Switch off the speaker
- outb(inb_p(0x61)&0xFC, 0x61);
+ outb(inb(0x61)&0xFC, 0x61);
}