[PATCH] memtest86...

Eric W. Biederman ebiederman at lnxi.com
Sun Aug 17 06:12:00 CEST 2003


I have finally had a chance to make a good patch with
my changes that have been accumulating to memtest86.   I believe
this patch resolves most of the outstanding issues.  

There are quite a few people on the LinuxBIOS list who are
interested so I am posting it here before I run out of time again.

- Fixes problems when compiling with newer versions of gcc
  o Rely on test.h for the declaration of v
  o Update memtest86.lds so we include all of the relocation sections
- Add support for the memory controller in the E7500 
- Add private versions elf.h and stdint.h to ensure a good copy is present.
- Rewrite cacheable so it works properly with sparse memory maps.
- Add the ability to automatically detect the baud rate
- Generalized the code that sanitizes the memory map so it is universal.
- Detect Opteron CPUS 

Eric

diff --exclude=CVS -uNr memtest86-3.0/Makefile memtest86/Makefile
--- memtest86-3.0/Makefile	Tue Apr 23 05:21:05 2002
+++ memtest86/Makefile	Sun Aug 17 04:00:36 2003
@@ -12,7 +12,7 @@
 #
 # gcc compiler options, these settings should suffice
 #
-CCFLAGS=-Wall -march=i486 -O -fomit-frame-pointer -fno-builtin
+CCFLAGS=-Wall -march=i486 -Os -fomit-frame-pointer -fno-builtin -ffreestanding
 
 AS=as
 
@@ -56,6 +56,9 @@
 controller.o: controller.c defs.h config.h test.h pci.h controller.h
 	$(CC) -c $(CCFLAGS) -fPIC controller.c
 
+controller.s: controller.c defs.h config.h test.h pci.h controller.h
+	$(CC) -S $(CCFLAGS) -fPIC controller.c
+
 head.s: head.S
 	$(CC) -E -traditional $< -o $@
 
@@ -70,7 +73,7 @@
 # relocation information
 memtest_shared: $(OBJS) memtest_shared.lds Makefile
 	$(LD) --warn-constructors --warn-common -static -T memtest_shared.lds -o $@ $(OBJS) && \
-	$(LD) -shared -T memtest_shared.lds -o $@ $(OBJS)
+	$(LD) -shared -Bsymbolic -T memtest_shared.lds -o $@ $(OBJS)
 
 memtest_shared.bin: memtest_shared
 	objcopy -O binary $< memtest_shared.bin
diff --exclude=CVS -uNr memtest86-3.0/config.c memtest86/config.c
--- memtest86-3.0/config.c	Tue May 21 12:27:11 2002
+++ memtest86/config.c	Sat Aug 16 22:40:06 2003
@@ -10,7 +10,6 @@
 
 extern int bail;
 extern struct tseq tseq[];
-extern struct vars *v;
 extern short e820_nr;
 extern char memsz_mode;
 
diff --exclude=CVS -uNr memtest86-3.0/config.h memtest86/config.h
--- memtest86-3.0/config.h	Tue May 21 15:14:30 2002
+++ memtest86/config.h	Sun Aug 17 04:09:51 2003
@@ -15,7 +15,10 @@
 /*	to enable. */
 #define SERIAL_CONSOLE_DEFAULT 0
 
-/* SERIAL_BAUD_RATE - Baud rate for the serial console */
+/* SERIAL_BAUD_RATE - Baud rate for the serial console
+ * If this is not defined it is assumed a previous program has set the
+ * baud rate, and the baud is preserved.
+ */
 #define SERIAL_BAUD_RATE 9600
 
 /* SCRN_DEBUG - extra check for SCREEN_BUFFER
diff --exclude=CVS -uNr memtest86-3.0/controller.c memtest86/controller.c
--- memtest86-3.0/controller.c	Wed Apr 24 10:55:22 2002
+++ memtest86/controller.c	Sun Aug 17 02:26:50 2003
@@ -417,6 +417,75 @@
 	}
 }
 
+static void setup_iE7500(void)
+{
+	unsigned long mchcfgns;
+	unsigned long drc;
+
+	/* Read the hardare capabilities */
+	pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn, 0x52, 2, &mchcfgns);
+	pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn, 0x7C, 4, &drc);
+
+	/* Fill in the correct memory capabilities */
+	ctrl.cap = ECC_SCRUB;
+	ctrl.mode = 0;
+	/* checking and correcting enabled */
+	if (((drc >> 20) & 3) == 2) {
+		ctrl.mode |= ECC_CORRECT;
+	}
+	/* scrub enabled */
+	if (mchcfgns & (1 << 2)) {
+		ctrl.mode |= __ECC_SCRUB;
+	}
+
+	/* Clear any prexisting error reports */
+	pci_conf_write(ctrl.bus, ctrl.dev, ctrl.fn +1, 0x80, 1, 3);
+	pci_conf_write(ctrl.bus, ctrl.dev, ctrl.fn +1, 0x82, 1, 3);
+}
+
+static void poll_iE7500(void)
+{
+	unsigned long ferr;
+	unsigned long nerr;
+	unsigned char err;
+	pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn +1, 0x80, 1, &ferr);
+	pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn +1, 0x82, 1, &nerr);
+	err = ferr | nerr;
+	if (err & 1) {
+		/* Find out about the first correctable error */
+		unsigned long celog_add;
+		unsigned long celog_syndrome;
+		unsigned long page;
+		/* Read the error location */
+		pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn +1, 0xA0, 4, &celog_add);
+		/* Read the syndrome */
+		pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn +1, 0xD0, 2, &celog_syndrome);
+
+		/* Parse the error location */
+		page = (celog_add & 0x0FFFFFC0) >> 6;
+		
+		/* Report the error */
+		print_ecc_err(page, 0, 1, celog_syndrome, 0);
+	}
+	if (err & 2) {
+		/* Found out about the first uncorrectable error */
+		unsigned long uccelog_add;
+		unsigned long page;
+		/* Read the error location */
+		pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn +1, 0xB0, 4, &uccelog_add);
+
+		/* Parse the error location */
+		page = (uccelog_add & 0x0FFFFFC0) >> 6;
+		
+		/* Report the error */
+		print_ecc_err(page, 0, 2, 0, 0);
+		
+	}
+	/* Clear the error registers */
+	pci_conf_write(ctrl.bus, ctrl.dev, ctrl.fn +1, 0x80, 1, ferr & 3);
+	pci_conf_write(ctrl.bus, ctrl.dev, ctrl.fn +1, 0x82, 1, nerr & 3);
+}
+
 struct pci_memory_controller {
 	unsigned vendor;
 	unsigned device;
@@ -465,10 +534,10 @@
 	{ 0x8086, 0x122d, "i430fx",    0, setup_nothing, poll_nothing },
 	{ 0x8086, 0x1237, "i440fx",    0, setup_nothing, poll_nothing },
 	{ 0x8086, 0x1250, "i430hx",    0, setup_nothing, poll_nothing },
-	{ 0x8086, 0x1A21, "i840",      0,setup_i840, poll_i840 },
-	{ 0x8086, 0x1A30, "i845",      0,setup_i845, poll_i845 },
-	{ 0x8086, 0x2500, "i820",      0,setup_i820, poll_i820 },
-	{ 0x8086, 0x2530, "i850",      0,setup_i850, poll_i850 },
+	{ 0x8086, 0x1A21, "i840",      0, setup_i840, poll_i840 },
+	{ 0x8086, 0x1A30, "i845",      0, setup_i845, poll_i845 },
+	{ 0x8086, 0x2500, "i820",      0, setup_i820, poll_i820 },
+	{ 0x8086, 0x2530, "i850",      0, setup_i850, poll_i850 },
 	{ 0x8086, 0x2531, "i860",      1, setup_i860, poll_i860 },
 	{ 0x8086, 0x7030, "i430vx",    0, setup_nothing, poll_nothing },
 	{ 0x8086, 0x7120, "i810",      0, setup_nothing, poll_nothing },
@@ -480,6 +549,7 @@
 	{ 0x8086, 0x71A0, "i440gx",    0, setup_i440gx, poll_i440gx },
 	{ 0x8086, 0x71A2, "i440gx",    0, setup_i440gx, poll_i440gx },
 	{ 0x8086, 0x84C5, "i450gx",    0, setup_nothing, poll_nothing },
+	{ 0x8086, 0x2540, "iE7500",    1, setup_iE7500, poll_iE7500 },
 };
 
 static void print_memory_controller(void)
@@ -541,6 +611,7 @@
 	unsigned long device;
 	int i;
 	int result;
+
 	result = pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn, PCI_VENDOR_ID, 2, &vendor);
 	result = pci_conf_read(ctrl.bus, ctrl.dev, ctrl.fn, PCI_DEVICE_ID, 2, &device);
 	ctrl.index = 0;
@@ -553,7 +624,8 @@
 			}
 		}
 	}
-	controllers[ctrl.index].setup_ecc();
+	controllers[ctrl.index].setup_ecc(); 
+
 	/* Don't enable ECC polling by default unless it has
 	 * been well tested.
 	 */
diff --exclude=CVS -uNr memtest86-3.0/elf.h memtest86/elf.h
--- memtest86-3.0/elf.h	Wed Dec 31 17:00:00 1969
+++ memtest86/elf.h	Sat Aug 16 23:17:22 2003
@@ -0,0 +1,590 @@
+#ifndef ELF_H
+#define ELF_H
+
+#define EI_NIDENT	16	/* Size of e_ident array. */
+
+/* Values for e_type. */
+#define ET_NONE		0	/* No file type */
+#define ET_REL		1	/* Relocatable file */
+#define ET_EXEC		2	/* Executable file */
+#define ET_DYN		3	/* Shared object file */
+#define ET_CORE		4	/* Core file */
+
+/* Values for e_machine (architecute). */
+#define EM_NONE		 0		/* No machine */
+#define EM_M32		 1		/* AT&T WE 32100 */
+#define EM_SPARC	 2		/* SUN SPARC */
+#define EM_386		 3		/* Intel 80386+ */
+#define EM_68K		 4		/* Motorola m68k family */
+#define EM_88K		 5		/* Motorola m88k family */
+#define EM_486		 6		/* Perhaps disused */
+#define EM_860		 7		/* Intel 80860 */
+#define EM_MIPS		 8		/* MIPS R3000 big-endian */
+#define EM_S370		 9		/* IBM System/370 */
+#define EM_MIPS_RS3_LE	10		/* MIPS R3000 little-endian */
+
+#define EM_PARISC	15		/* HPPA */
+#define EM_VPP500	17		/* Fujitsu VPP500 */
+#define EM_SPARC32PLUS	18		/* Sun's "v8plus" */
+#define EM_960		19		/* Intel 80960 */
+#define EM_PPC		20		/* PowerPC */
+#define EM_PPC64	21		/* PowerPC 64-bit */
+#define EM_S390		22		/* IBM S390 */
+
+#define EM_V800		36		/* NEC V800 series */
+#define EM_FR20		37		/* Fujitsu FR20 */
+#define EM_RH32		38		/* TRW RH-32 */
+#define EM_RCE		39		/* Motorola RCE */
+#define EM_ARM		40		/* ARM */
+#define EM_FAKE_ALPHA	41		/* Digital Alpha */
+#define EM_SH		42		/* Hitachi SH */
+#define EM_SPARCV9	43		/* SPARC v9 64-bit */
+#define EM_TRICORE	44		/* Siemens Tricore */
+#define EM_ARC		45		/* Argonaut RISC Core */
+#define EM_H8_300	46		/* Hitachi H8/300 */
+#define EM_H8_300H	47		/* Hitachi H8/300H */
+#define EM_H8S		48		/* Hitachi H8S */
+#define EM_H8_500	49		/* Hitachi H8/500 */
+#define EM_IA_64	50		/* Intel Merced */
+#define EM_MIPS_X	51		/* Stanford MIPS-X */
+#define EM_COLDFIRE	52		/* Motorola Coldfire */
+#define EM_68HC12	53		/* Motorola M68HC12 */
+#define EM_MMA		54		/* Fujitsu MMA Multimedia Accelerator*/
+#define EM_PCP		55		/* Siemens PCP */
+#define EM_NCPU		56		/* Sony nCPU embeeded RISC */
+#define EM_NDR1		57		/* Denso NDR1 microprocessor */
+#define EM_STARCORE	58		/* Motorola Start*Core processor */
+#define EM_ME16		59		/* Toyota ME16 processor */
+#define EM_ST100	60		/* STMicroelectronic ST100 processor */
+#define EM_TINYJ	61		/* Advanced Logic Corp. Tinyj emb.fam*/
+#define EM_X86_64	62		/* AMD x86-64 architecture */
+#define EM_PDSP		63		/* Sony DSP Processor */
+
+#define EM_FX66		66		/* Siemens FX66 microcontroller */
+#define EM_ST9PLUS	67		/* STMicroelectronics ST9+ 8/16 mc */
+#define EM_ST7		68		/* STmicroelectronics ST7 8 bit mc */
+#define EM_68HC16	69		/* Motorola MC68HC16 microcontroller */
+#define EM_68HC11	70		/* Motorola MC68HC11 microcontroller */
+#define EM_68HC08	71		/* Motorola MC68HC08 microcontroller */
+#define EM_68HC05	72		/* Motorola MC68HC05 microcontroller */
+#define EM_SVX		73		/* Silicon Graphics SVx */
+#define EM_AT19		74		/* STMicroelectronics ST19 8 bit mc */
+#define EM_VAX		75		/* Digital VAX */
+#define EM_CRIS		76		/* Axis Communications 32-bit embedded processor */
+#define EM_JAVELIN	77		/* Infineon Technologies 32-bit embedded processor */
+#define EM_FIREPATH	78		/* Element 14 64-bit DSP Processor */
+#define EM_ZSP		79		/* LSI Logic 16-bit DSP Processor */
+#define EM_MMIX		80		/* Donald Knuth's educational 64-bit processor */
+#define EM_HUANY	81		/* Harvard University machine-independent object files */
+#define EM_PRISM	82		/* SiTera Prism */
+#define EM_AVR		83		/* Atmel AVR 8-bit microcontroller */
+#define EM_FR30		84		/* Fujitsu FR30 */
+#define EM_D10V		85		/* Mitsubishi D10V */
+#define EM_D30V		86		/* Mitsubishi D30V */
+#define EM_V850		87		/* NEC v850 */
+#define EM_M32R		88		/* Mitsubishi M32R */
+#define EM_MN10300	89		/* Matsushita MN10300 */
+#define EM_MN10200	90		/* Matsushita MN10200 */
+#define EM_PJ		91		/* picoJava */
+#define EM_OPENRISC	92		/* OpenRISC 32-bit embedded processor */
+#define EM_ARC_A5	93		/* ARC Cores Tangent-A5 */
+#define EM_XTENSA	94		/* Tensilica Xtensa Architecture */
+#define EM_NUM		95
+
+/* Values for p_type. */
+#define PT_NULL		0	/* Unused entry. */
+#define PT_LOAD		1	/* Loadable segment. */
+#define PT_DYNAMIC	2	/* Dynamic linking information segment. */
+#define PT_INTERP	3	/* Pathname of interpreter. */
+#define PT_NOTE		4	/* Auxiliary information. */
+#define PT_SHLIB	5	/* Reserved (not used). */
+#define PT_PHDR		6	/* Location of program header itself. */
+
+/* Values for p_flags. */
+#define PF_X		0x1	/* Executable. */
+#define PF_W		0x2	/* Writable. */
+#define PF_R		0x4	/* Readable. */
+
+
+#define	ELF_PROGRAM_RETURNS_BIT	0x8000000	/* e_flags bit 31 */
+
+#define EI_MAG0		0
+#define ELFMAG0		0x7f
+
+#define EI_MAG1		1
+#define ELFMAG1		'E'
+
+#define EI_MAG2		2
+#define ELFMAG2		'L'
+
+#define EI_MAG3		3
+#define ELFMAG3		'F'
+
+#define ELFMAG		"\177ELF"
+
+#define EI_CLASS	4	/* File class byte index */
+#define ELFCLASSNONE	0	/* Invalid class */
+#define ELFCLASS32	1	/* 32-bit objects */
+#define ELFCLASS64	2	/* 64-bit objects */
+
+#define EI_DATA		5	/* Data encodeing byte index */
+#define ELFDATANONE	0	/* Invalid data encoding */
+#define ELFDATA2LSB	1	/* 2's complement little endian */
+#define ELFDATA2MSB	2	/* 2's complement big endian */
+
+#define EI_VERSION	6	/* File version byte index */
+				/* Value must be EV_CURRENT */
+
+#define EV_NONE		0	/* Invalid ELF Version */
+#define EV_CURRENT	1	/* Current version */
+
+#define ELF32_PHDR_SIZE (8*4)	/* Size of an elf program header */
+
+#ifndef ASSEMBLY
+
+#include "stdint.h"
+
+/*
+ * ELF definitions common to all 32-bit architectures.
+ */
+
+typedef uint32_t	Elf32_Addr;
+typedef uint16_t	Elf32_Half;
+typedef uint32_t	Elf32_Off;
+typedef uint16_t	Elf32_Section;
+typedef int32_t		Elf32_Sword;
+typedef uint32_t	Elf32_Word;
+typedef uint32_t	Elf32_Size;
+
+typedef uint64_t	Elf64_Addr;
+typedef uint16_t	Elf64_Half;
+typedef uint64_t	Elf64_Off;
+typedef uint16_t	Elf64_Section;
+typedef int32_t		Elf64_Sword;
+typedef uint32_t	Elf64_Word;
+typedef uint64_t	Elf64_Size;
+typedef uint64_t	Elf64_Xword;
+typedef	int64_t		Elf64_Sxword;
+
+/*
+ * ELF header.
+ */
+typedef struct {
+	unsigned char	e_ident[EI_NIDENT];	/* File identification. */
+	Elf32_Half	e_type;		/* File type. */
+	Elf32_Half	e_machine;	/* Machine architecture. */
+	Elf32_Word	e_version;	/* ELF format version. */
+	Elf32_Addr	e_entry;	/* Entry point. */
+	Elf32_Off	e_phoff;	/* Program header file offset. */
+	Elf32_Off	e_shoff;	/* Section header file offset. */
+	Elf32_Word	e_flags;	/* Architecture-specific flags. */
+	Elf32_Half	e_ehsize;	/* Size of ELF header in bytes. */
+	Elf32_Half	e_phentsize;	/* Size of program header entry. */
+	Elf32_Half	e_phnum;	/* Number of program header entries. */
+	Elf32_Half	e_shentsize;	/* Size of section header entry. */
+	Elf32_Half	e_shnum;	/* Number of section header entries. */
+	Elf32_Half	e_shstrndx;	/* Section name strings section. */
+} Elf32_Ehdr;
+
+typedef struct {
+	unsigned char	e_ident[EI_NIDENT];	/* File identification. */
+	Elf64_Half	e_type;		/* File type. */
+	Elf64_Half	e_machine;	/* Machine architecture. */
+	Elf64_Word	e_version;	/* ELF format version. */
+	Elf64_Addr	e_entry;	/* Entry point. */
+	Elf64_Off	e_phoff;	/* Program header file offset. */
+	Elf64_Off	e_shoff;	/* Section header file offset. */
+	Elf64_Word	e_flags;	/* Architecture-specific flags. */
+	Elf64_Half	e_ehsize;	/* Size of ELF header in bytes. */
+	Elf64_Half	e_phentsize;	/* Size of program header entry. */
+	Elf64_Half	e_phnum;	/* Number of program header entries. */
+	Elf64_Half	e_shentsize;	/* Size of section header entry. */
+	Elf64_Half	e_shnum;	/* Number of section header entries. */
+	Elf64_Half	e_shstrndx;	/* Section name strings section. */
+} Elf64_Ehdr;
+
+/*
+ * Program header.
+ */
+typedef struct {
+	Elf32_Word	p_type;		/* Entry type. */
+	Elf32_Off	p_offset;	/* File offset of contents. */
+	Elf32_Addr	p_vaddr;	/* Virtual address (not used). */
+	Elf32_Addr	p_paddr;	/* Physical address. */
+	Elf32_Size	p_filesz;	/* Size of contents in file. */
+	Elf32_Size	p_memsz;	/* Size of contents in memory. */
+	Elf32_Word	p_flags;	/* Access permission flags. */
+	Elf32_Size	p_align;	/* Alignment in memory and file. */
+} Elf32_Phdr;
+
+typedef struct {
+	Elf64_Word	p_type;		/* Entry type. */
+	Elf64_Word	p_flags;	/* Access permission flags. */
+	Elf64_Off	p_offset;	/* File offset of contents. */
+	Elf64_Addr	p_vaddr;	/* Virtual address (not used). */
+	Elf64_Addr	p_paddr;	/* Physical address. */
+	Elf64_Size	p_filesz;	/* Size of contents in file. */
+	Elf64_Size	p_memsz;	/* Size of contents in memory. */
+	Elf64_Size	p_align;	/* Alignment in memory and file. */
+} Elf64_Phdr;
+
+
+/* Dynamic section entry.  */
+
+typedef struct
+{
+	Elf32_Sword	d_tag;			/* Dynamic entry type */
+	union
+	{
+		Elf32_Word d_val;			/* Integer value */
+		Elf32_Addr d_ptr;			/* Address value */
+	} d_un;
+} Elf32_Dyn;
+
+typedef struct
+{
+	Elf64_Sxword	d_tag;			/* Dynamic entry type */
+	union
+	{
+		Elf64_Xword d_val;		/* Integer value */
+		Elf64_Addr d_ptr;		/* Address value */
+	} d_un;
+} Elf64_Dyn;
+
+/* Legal values for d_tag (dynamic entry type).  */
+
+#define DT_NULL		0		/* Marks end of dynamic section */
+#define DT_NEEDED	1		/* Name of needed library */
+#define DT_PLTRELSZ	2		/* Size in bytes of PLT relocs */
+#define DT_PLTGOT	3		/* Processor defined value */
+#define DT_HASH		4		/* Address of symbol hash table */
+#define DT_STRTAB	5		/* Address of string table */
+#define DT_SYMTAB	6		/* Address of symbol table */
+#define DT_RELA		7		/* Address of Rela relocs */
+#define DT_RELASZ	8		/* Total size of Rela relocs */
+#define DT_RELAENT	9		/* Size of one Rela reloc */
+#define DT_STRSZ	10		/* Size of string table */
+#define DT_SYMENT	11		/* Size of one symbol table entry */
+#define DT_INIT		12		/* Address of init function */
+#define DT_FINI		13		/* Address of termination function */
+#define DT_SONAME	14		/* Name of shared object */
+#define DT_RPATH	15		/* Library search path (deprecated) */
+#define DT_SYMBOLIC	16		/* Start symbol search here */
+#define DT_REL		17		/* Address of Rel relocs */
+#define DT_RELSZ	18		/* Total size of Rel relocs */
+#define DT_RELENT	19		/* Size of one Rel reloc */
+#define DT_PLTREL	20		/* Type of reloc in PLT */
+#define DT_DEBUG	21		/* For debugging; unspecified */
+#define DT_TEXTREL	22		/* Reloc might modify .text */
+#define DT_JMPREL	23		/* Address of PLT relocs */
+#define	DT_BIND_NOW	24		/* Process relocations of object */
+#define	DT_INIT_ARRAY	25		/* Array with addresses of init fct */
+#define	DT_FINI_ARRAY	26		/* Array with addresses of fini fct */
+#define	DT_INIT_ARRAYSZ	27		/* Size in bytes of DT_INIT_ARRAY */
+#define	DT_FINI_ARRAYSZ	28		/* Size in bytes of DT_FINI_ARRAY */
+#define DT_RUNPATH	29		/* Library search path */
+#define DT_FLAGS	30		/* Flags for the object being loaded */
+#define DT_ENCODING	32		/* Start of encoded range */
+#define DT_PREINIT_ARRAY 32		/* Array with addresses of preinit fct*/
+#define DT_PREINIT_ARRAYSZ 33		/* size in bytes of DT_PREINIT_ARRAY */
+#define	DT_NUM		34		/* Number used */
+#define DT_LOOS		0x6000000d	/* Start of OS-specific */
+#define DT_HIOS		0x6ffff000	/* End of OS-specific */
+#define DT_LOPROC	0x70000000	/* Start of processor-specific */
+#define DT_HIPROC	0x7fffffff	/* End of processor-specific */
+#define	DT_PROCNUM	0x32		/* Most used by any processor */
+
+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+   Dyn.d_un.d_val field of the Elf*_Dyn structure.  This follows Sun's
+   approach.  */
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5	/* Prelinking timestamp */
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6	/* Size of conflict section */
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7	/* Size of library list */
+#define DT_CHECKSUM	0x6ffffdf8
+#define DT_PLTPADSZ	0x6ffffdf9
+#define DT_MOVEENT	0x6ffffdfa
+#define DT_MOVESZ	0x6ffffdfb
+#define DT_FEATURE_1	0x6ffffdfc	/* Feature selection (DTF_*).  */
+#define DT_POSFLAG_1	0x6ffffdfd	/* Flags for DT_* entries, effecting
+					   the following DT_* entry.  */
+#define DT_SYMINSZ	0x6ffffdfe	/* Size of syminfo table (in bytes) */
+#define DT_SYMINENT	0x6ffffdff	/* Entry size of syminfo */
+#define DT_VALRNGHI	0x6ffffdff
+#define DT_VALTAGIDX(tag)	(DT_VALRNGHI - (tag))	/* Reverse order! */
+#define DT_VALNUM 12
+
+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+   Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+
+   If any adjustment is made to the ELF object after it has been
+   built these entries will need to be adjusted.  */
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_GNU_CONFLICT	0x6ffffef8	/* Start of conflict section */
+#define DT_GNU_LIBLIST	0x6ffffef9	/* Library list */
+#define DT_CONFIG	0x6ffffefa	/* Configuration information.  */
+#define DT_DEPAUDIT	0x6ffffefb	/* Dependency auditing.  */
+#define DT_AUDIT	0x6ffffefc	/* Object auditing.  */
+#define	DT_PLTPAD	0x6ffffefd	/* PLT padding.  */
+#define	DT_MOVETAB	0x6ffffefe	/* Move table.  */
+#define DT_SYMINFO	0x6ffffeff	/* Syminfo table.  */
+#define DT_ADDRRNGHI	0x6ffffeff
+#define DT_ADDRTAGIDX(tag)	(DT_ADDRRNGHI - (tag))	/* Reverse order! */
+#define DT_ADDRNUM 10
+
+/* The versioning entry types.  The next are defined as part of the
+   GNU extension.  */
+#define DT_VERSYM	0x6ffffff0
+
+#define DT_RELACOUNT	0x6ffffff9
+#define DT_RELCOUNT	0x6ffffffa
+
+/* These were chosen by Sun.  */
+#define DT_FLAGS_1	0x6ffffffb	/* State flags, see DF_1_* below.  */
+#define	DT_VERDEF	0x6ffffffc	/* Address of version definition
+					   table */
+#define	DT_VERDEFNUM	0x6ffffffd	/* Number of version definitions */
+#define	DT_VERNEED	0x6ffffffe	/* Address of table with needed
+					   versions */
+#define	DT_VERNEEDNUM	0x6fffffff	/* Number of needed versions */
+#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */
+#define DT_VERSIONTAGNUM 16
+
+/* Sun added these machine-independent extensions in the "processor-specific"
+   range.  Be compatible.  */
+#define DT_AUXILIARY    0x7ffffffd      /* Shared object to load before self */
+#define DT_FILTER       0x7fffffff      /* Shared object to get values from */
+#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
+#define DT_EXTRANUM	3
+
+/* Values of `d_un.d_val' in the DT_FLAGS entry.  */
+#define DF_ORIGIN	0x00000001	/* Object may use DF_ORIGIN */
+#define DF_SYMBOLIC	0x00000002	/* Symbol resolutions starts here */
+#define DF_TEXTREL	0x00000004	/* Object contains text relocations */
+#define DF_BIND_NOW	0x00000008	/* No lazy binding for this object */
+#define DF_STATIC_TLS	0x00000010	/* Module uses the static TLS model */
+
+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
+   entry in the dynamic section.  */
+#define DF_1_NOW	0x00000001	/* Set RTLD_NOW for this object.  */
+#define DF_1_GLOBAL	0x00000002	/* Set RTLD_GLOBAL for this object.  */
+#define DF_1_GROUP	0x00000004	/* Set RTLD_GROUP for this object.  */
+#define DF_1_NODELETE	0x00000008	/* Set RTLD_NODELETE for this object.*/
+#define DF_1_LOADFLTR	0x00000010	/* Trigger filtee loading at runtime.*/
+#define DF_1_INITFIRST	0x00000020	/* Set RTLD_INITFIRST for this object*/
+#define DF_1_NOOPEN	0x00000040	/* Set RTLD_NOOPEN for this object.  */
+#define DF_1_ORIGIN	0x00000080	/* $ORIGIN must be handled.  */
+#define DF_1_DIRECT	0x00000100	/* Direct binding enabled.  */
+#define DF_1_TRANS	0x00000200
+#define DF_1_INTERPOSE	0x00000400	/* Object is used to interpose.  */
+#define DF_1_NODEFLIB	0x00000800	/* Ignore default lib search path.  */
+#define DF_1_NODUMP	0x00001000	/* Object can't be dldump'ed.  */
+#define DF_1_CONFALT	0x00002000	/* Configuration alternative created.*/
+#define DF_1_ENDFILTEE	0x00004000	/* Filtee terminates filters search. */
+#define	DF_1_DISPRELDNE	0x00008000	/* Disp reloc applied at build time. */
+#define	DF_1_DISPRELPND	0x00010000	/* Disp reloc applied at run-time.  */
+
+/* Flags for the feature selection in DT_FEATURE_1.  */
+#define DTF_1_PARINIT	0x00000001
+#define DTF_1_CONFEXP	0x00000002
+
+/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry.  */
+#define DF_P1_LAZYLOAD	0x00000001	/* Lazyload following object.  */
+#define DF_P1_GROUPPERM	0x00000002	/* Symbols from next object are not
+					   generally available.  */
+
+/* Special section indices.  */
+
+#define SHN_UNDEF	0		/* Undefined section */
+#define SHN_LORESERVE	0xff00		/* Start of reserved indices */
+#define SHN_LOPROC	0xff00		/* Start of processor-specific */
+#define SHN_HIPROC	0xff1f		/* End of processor-specific */
+#define SHN_LOOS	0xff20		/* Start of OS-specific */
+#define SHN_HIOS	0xff3f		/* End of OS-specific */
+#define SHN_ABS		0xfff1		/* Associated symbol is absolute */
+#define SHN_COMMON	0xfff2		/* Associated symbol is common */
+#define SHN_XINDEX	0xffff		/* Index is in extra table.  */
+#define SHN_HIRESERVE	0xffff		/* End of reserved indices */
+
+/* Legal values for sh_type (section type).  */
+
+#define SHT_NULL	  0		/* Section header table entry unused */
+#define SHT_PROGBITS	  1		/* Program data */
+#define SHT_SYMTAB	  2		/* Symbol table */
+#define SHT_STRTAB	  3		/* String table */
+#define SHT_RELA	  4		/* Relocation entries with addends */
+#define SHT_HASH	  5		/* Symbol hash table */
+#define SHT_DYNAMIC	  6		/* Dynamic linking information */
+#define SHT_NOTE	  7		/* Notes */
+#define SHT_NOBITS	  8		/* Program space with no data (bss) */
+#define SHT_REL		  9		/* Relocation entries, no addends */
+#define SHT_SHLIB	  10		/* Reserved */
+#define SHT_DYNSYM	  11		/* Dynamic linker symbol table */
+#define SHT_INIT_ARRAY	  14		/* Array of constructors */
+#define SHT_FINI_ARRAY	  15		/* Array of destructors */
+#define SHT_PREINIT_ARRAY 16		/* Array of pre-constructors */
+#define SHT_GROUP	  17		/* Section group */
+#define SHT_SYMTAB_SHNDX  18		/* Extended section indeces */
+#define	SHT_NUM		  19		/* Number of defined types.  */
+#define SHT_LOOS	  0x60000000	/* Start OS-specific */
+#define SHT_GNU_LIBLIST	  0x6ffffff7	/* Prelink library list */
+#define SHT_CHECKSUM	  0x6ffffff8	/* Checksum for DSO content.  */
+#define SHT_LOSUNW	  0x6ffffffa	/* Sun-specific low bound.  */
+#define SHT_SUNW_move	  0x6ffffffa
+#define SHT_SUNW_COMDAT   0x6ffffffb
+#define SHT_SUNW_syminfo  0x6ffffffc
+#define SHT_GNU_verdef	  0x6ffffffd	/* Version definition section.  */
+#define SHT_GNU_verneed	  0x6ffffffe	/* Version needs section.  */
+#define SHT_GNU_versym	  0x6fffffff	/* Version symbol table.  */
+#define SHT_HISUNW	  0x6fffffff	/* Sun-specific high bound.  */
+#define SHT_HIOS	  0x6fffffff	/* End OS-specific type */
+#define SHT_LOPROC	  0x70000000	/* Start of processor-specific */
+#define SHT_HIPROC	  0x7fffffff	/* End of processor-specific */
+#define SHT_LOUSER	  0x80000000	/* Start of application-specific */
+#define SHT_HIUSER	  0x8fffffff	/* End of application-specific */
+
+/* Legal values for sh_flags (section flags).  */
+
+#define SHF_WRITE	     (1 << 0)	/* Writable */
+#define SHF_ALLOC	     (1 << 1)	/* Occupies memory during execution */
+#define SHF_EXECINSTR	     (1 << 2)	/* Executable */
+#define SHF_MERGE	     (1 << 4)	/* Might be merged */
+#define SHF_STRINGS	     (1 << 5)	/* Contains nul-terminated strings */
+#define SHF_INFO_LINK	     (1 << 6)	/* `sh_info' contains SHT index */
+#define SHF_LINK_ORDER	     (1 << 7)	/* Preserve order after combining */
+#define SHF_OS_NONCONFORMING (1 << 8)	/* Non-standard OS specific handling
+					   required */
+#define SHF_GROUP	     (1 << 9)	/* Section is member of a group.  */
+#define SHF_TLS		     (1 << 10)	/* Section hold thread-local data.  */
+#define SHF_MASKOS	     0x0ff00000	/* OS-specific.  */
+#define SHF_MASKPROC	     0xf0000000	/* Processor-specific */
+
+/* Section group handling.  */
+#define GRP_COMDAT	0x1		/* Mark group as COMDAT.  */
+
+/* Symbol table entry.  */
+
+typedef struct
+{
+	Elf32_Word	st_name;	/* Symbol name (string tbl index) */
+	Elf32_Addr	st_value;	/* Symbol value */
+	Elf32_Word	st_size;	/* Symbol size */
+	unsigned char	st_info;	/* Symbol type and binding */
+	unsigned char	st_other;	/* Symbol visibility */
+	Elf32_Section	st_shndx;	/* Section index */
+} Elf32_Sym;
+
+typedef struct
+{
+	Elf64_Word	st_name;	/* Symbol name (string tbl index) */
+	unsigned char	st_info;	/* Symbol type and binding */
+	unsigned char st_other;		/* Symbol visibility */
+	Elf64_Section	st_shndx;	/* Section index */
+	Elf64_Addr	st_value;	/* Symbol value */
+	Elf64_Xword	st_size;	/* Symbol size */
+} Elf64_Sym;
+
+/* Relocation table entry without addend (in section of type SHT_REL).  */
+
+typedef struct
+{
+	Elf32_Addr	r_offset;	/* Address */
+	Elf32_Word	r_info;		/* Relocation type and symbol index */
+} Elf32_Rel;
+
+/* I have seen two different definitions of the Elf64_Rel and
+   Elf64_Rela structures, so we'll leave them out until Novell (or
+   whoever) gets their act together.  */
+/* The following, at least, is used on Sparc v9, MIPS, and Alpha.  */
+
+typedef struct
+{
+	Elf64_Addr	r_offset;	/* Address */
+	Elf64_Xword	r_info;		/* Relocation type and symbol index */
+} Elf64_Rel;
+
+/* Relocation table entry with addend (in section of type SHT_RELA).  */
+
+typedef struct
+{
+	Elf32_Addr	r_offset;	/* Address */
+	Elf32_Word	r_info;		/* Relocation type and symbol index */
+	Elf32_Sword	r_addend;	/* Addend */
+} Elf32_Rela;
+
+typedef struct
+{
+	Elf64_Addr	r_offset;	/* Address */
+	Elf64_Xword	r_info;		/* Relocation type and symbol index */
+	Elf64_Sxword	r_addend;	/* Addend */
+} Elf64_Rela;
+
+/* How to extract and insert information held in the r_info field.  */
+
+#define ELF32_R_SYM(val)		((val) >> 8)
+#define ELF32_R_TYPE(val)		((val) & 0xff)
+#define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff))
+
+#define ELF64_R_SYM(i)			((i) >> 32)
+#define ELF64_R_TYPE(i)			((i) & 0xffffffff)
+#define ELF64_R_INFO(sym,type)		((((Elf64_Xword) (sym)) << 32) + (type))
+
+
+/* Intel 80386 specific definitions.  */
+
+/* i386 relocs.  */
+
+#define R_386_NONE	   0		/* No reloc */
+#define R_386_32	   1		/* Direct 32 bit  */
+#define R_386_PC32	   2		/* PC relative 32 bit */
+#define R_386_GOT32	   3		/* 32 bit GOT entry */
+#define R_386_PLT32	   4		/* 32 bit PLT address */
+#define R_386_COPY	   5		/* Copy symbol at runtime */
+#define R_386_GLOB_DAT	   6		/* Create GOT entry */
+#define R_386_JMP_SLOT	   7		/* Create PLT entry */
+#define R_386_RELATIVE	   8		/* Adjust by program base */
+#define R_386_GOTOFF	   9		/* 32 bit offset to GOT */
+#define R_386_GOTPC	   10		/* 32 bit PC relative offset to GOT */
+#define R_386_32PLT	   11
+#define R_386_TLS_TPOFF	   14		/* Offset in static TLS block */
+#define R_386_TLS_IE	   15		/* Address of GOT entry for static TLS
+					   block offset */
+#define R_386_TLS_GOTIE	   16		/* GOT entry for static TLS block
+					   offset */
+#define R_386_TLS_LE	   17		/* Offset relative to static TLS
+					   block */
+#define R_386_TLS_GD	   18		/* Direct 32 bit for GNU version of
+					   general dynamic thread local data */
+#define R_386_TLS_LDM	   19		/* Direct 32 bit for GNU version of
+					   local dynamic thread local data
+					   in LE code */
+#define R_386_16	   20
+#define R_386_PC16	   21
+#define R_386_8		   22
+#define R_386_PC8	   23
+#define R_386_TLS_GD_32	   24		/* Direct 32 bit for general dynamic
+					   thread local data */
+#define R_386_TLS_GD_PUSH  25		/* Tag for pushl in GD TLS code */
+#define R_386_TLS_GD_CALL  26		/* Relocation for call to
+					   __tls_get_addr() */
+#define R_386_TLS_GD_POP   27		/* Tag for popl in GD TLS code */
+#define R_386_TLS_LDM_32   28		/* Direct 32 bit for local dynamic
+					   thread local data in LE code */
+#define R_386_TLS_LDM_PUSH 29		/* Tag for pushl in LDM TLS code */
+#define R_386_TLS_LDM_CALL 30		/* Relocation for call to
+					   __tls_get_addr() in LDM code */
+#define R_386_TLS_LDM_POP  31		/* Tag for popl in LDM TLS code */
+#define R_386_TLS_LDO_32   32		/* Offset relative to TLS block */
+#define R_386_TLS_IE_32	   33		/* GOT entry for negated static TLS
+					   block offset */
+#define R_386_TLS_LE_32	   34		/* Negated offset relative to static
+					   TLS block */
+#define R_386_TLS_DTPMOD32 35		/* ID of module containing symbol */
+#define R_386_TLS_DTPOFF32 36		/* Offset in TLS block */
+#define R_386_TLS_TPOFF32  37		/* Negated offset in static TLS block */
+/* Keep this the last entry.  */
+#define R_386_NUM	   38
+
+#endif /* ASSEMBLY */
+
+#endif /* ELF_H */
diff --exclude=CVS -uNr memtest86-3.0/init.c memtest86/init.c
--- memtest86-3.0/init.c	Tue May 21 16:52:37 2002
+++ memtest86/init.c	Sun Aug 17 04:02:42 2003
@@ -11,7 +11,6 @@
 #include "pci.h"
 #include "io.h"
 
-extern struct vars *v;
 extern short memsz_mode;
 extern short firmware;
 
@@ -47,7 +46,7 @@
 	for(i=0, pp=(char *)(SCREEN_ADR+1); i<TITLE_WIDTH; i++, pp+=2) {
 		*pp = 0x47;
 	}
-	cprint(0, 0, "      Memtest-86 v3.0       ");
+	cprint(0, 0, "      Memtest-86 v3.0.eb2   ");
 
 	/* Do reverse video for the bottom display line */
 	for(i=0, pp=(char *)(SCREEN_ADR+1+(24 * 160)); i<80; i++, pp+=2) {
@@ -82,7 +81,6 @@
 			firmware = FIRMWARE_PCBIOS;
 		}
 	}
-
 	mem_size();
 
 	/* setup pci */
@@ -402,6 +400,16 @@
 			}
 			l1_cache = cpu_id.cache_info[3];
 			l1_cache += cpu_id.cache_info[7];
+			break;
+		case 15:
+			/* FIXME distinguish between the Opteron and Athlon64 */ 
+			cprint(LINE_CPU, 0, "AMD Opteron");
+			off = 11;
+			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;
 
@@ -665,21 +673,40 @@
 static void cacheable(void)
 {
 	ulong speed, pspeed;
-	ulong paddr, mem_top, cache_top;
+	ulong paddr, mem_top, cached;
 
 	mem_top = v->pmap[v->msegs - 1].end;
-	cache_top = mem_top;
+	cached = v->test_pages;
 	pspeed = 0;
 	for (paddr=0x200; paddr <= mem_top - 64; paddr+=0x400) {
+		int i;
+		int found;
+		/* See if the paddr is at a testable location */
+		found = 0;
+		for(i = 0; i < v->msegs; i++) {
+			if ((v->pmap[i].start >= paddr)  &&
+				(v->pmap[i].end <= (paddr + 32))) {
+				found = 1;
+				break;
+			}
+		}
+		if (!found) {
+			continue;
+		}
+		/* Map the range and perform the test */
+		map_page(paddr);
 		speed = memspeed((ulong)mapping(paddr), 32*4096, 1);
 		if (pspeed) {
 			if (speed < pspeed) {
-				cache_top = paddr;
+				cached -= 32;
 			}
 			pspeed = (ulong)((float)speed * 0.7);
 		}
 	}
-	aprint(LINE_INFO, COL_CACHE_TOP, cache_top);
+	aprint(LINE_INFO, COL_CACHE_TOP, cached);
+	/* Ensure the default set of pages are mapped */
+	map_page(0);
+	map_page(0x80000);
 }
 
 
diff --exclude=CVS -uNr memtest86-3.0/lib.c memtest86/lib.c
--- memtest86-3.0/lib.c	Tue May 21 17:12:07 2002
+++ memtest86/lib.c	Sat Aug 16 22:39:41 2003
@@ -9,8 +9,6 @@
 #include "config.h"
 #include "screen_buffer.h"
 
-extern struct vars *v;
-
 int slock = 0, lsr = 0;
 short serial_cons = SERIAL_CONSOLE_DEFAULT;
 char buf[18];
@@ -641,12 +639,16 @@
 	serial_echo_print(p);
 }
 
+#if defined(SERIAL_BAUD_RATE)
+
 #if ((115200%SERIAL_BAUD_RATE) != 0)
 #error Bad ttys0 baud rate
 #endif
 
 #define SERIAL_DIV     (115200/SERIAL_BAUD_RATE)
 
+#endif /* SERIAL_BAUD_RATE */
+
 void serial_echo_init(void)
 {
 	int comstat, hi, lo;
@@ -660,10 +662,12 @@
 
 	/* now do hardwired init */
 	serial_echo_outb(0x03, UART_LCR); /* No parity, 8 data bits, 1 stop */
+#if defined(SERIAL_BAUD_RATE)
 	serial_echo_outb(0x83, UART_LCR); /* Access divisor latch */
 	serial_echo_outb(SERIAL_DIV & 0xff, UART_DLL);  /* baud rate divisor */
 	serial_echo_outb((SERIAL_DIV>> 8) & 0xff, UART_DLM);
 	serial_echo_outb(0x03, UART_LCR); /* Done with divisor */
+#endif
 
 	/* Prior to disabling interrupts, read the LSR and RBR
 	 * registers */
diff --exclude=CVS -uNr memtest86-3.0/linuxbios_tables.h memtest86/linuxbios_tables.h
--- memtest86-3.0/linuxbios_tables.h	Fri Apr 19 11:47:50 2002
+++ memtest86/linuxbios_tables.h	Sat Aug 16 23:03:00 2003
@@ -1,7 +1,7 @@
 #ifndef LINUXBIOS_TABLES_H
 #define LINUXBIOS_TABLES_H
 
-#include <stdint.h>
+#include "stdint.h"
 
 /* The linuxbios table information is for conveying information
  * from the firmware to the loaded OS image.  Primarily this
diff --exclude=CVS -uNr memtest86-3.0/memsize.c memtest86/memsize.c
--- memtest86-3.0/memsize.c	Tue May 21 15:07:01 2002
+++ memtest86/memsize.c	Sun Aug 17 03:53:09 2003
@@ -20,6 +20,7 @@
 extern volatile ulong *p;
 
 static void sort_pmap(void);
+static void sanitize_pmap(void);
 static int check_ram(void);
 static void memsize_bios(int res);
 static void memsize_820(int res);
@@ -70,6 +71,7 @@
 	}
 	/* Guarantee that pmap entries are in ascending order */
 	sort_pmap();
+	sanitize_pmap();
 	v->plim_lower = 0;
 	v->plim_upper = v->pmap[v->msegs-1].end;
 
@@ -111,6 +113,60 @@
 		}
 	}
 }
+
+static void remove_pmap_region(unsigned long res_start, unsigned long res_end)
+{
+	/* Ensure a range of addresses is absent from the pmap */
+	int i;
+	for(i = 0; i < v->msegs; i++) {
+		unsigned long start, end;
+		start = v->pmap[i].start;
+		end = v->pmap[i].end;
+		if ((start < res_start) && (end > res_start)) {
+			/* If the tail of the range overlaps the region, truncate it */
+			v->pmap[i].end = res_start;
+			if ((end > res_end) && (v->msegs < MAX_MEM_SEGMENTS)) {
+				/* If the tail extends past the end of the region
+				 * insert a new pmap entry for the tail.
+				 */
+				memmove(&v->pmap[i+2], &v->pmap[i + 1],
+					((v->msegs - 1) - i) *sizeof(v->pmap[0]));
+				v->msegs += 1;
+				i += 1;
+				start = res_start;
+				v->pmap[i].start = start;
+				v->pmap[i].end = end;
+			}
+			else {
+				end = res_start;
+			}
+		}
+		if ((start >= res_start) && (end <= res_end)) {
+			/* If the range is completely contained in the region remove it */
+			memmove(&v->pmap[i], &v->pmap[i+1],
+				((v->msegs - 1) - i) * sizeof(v->pmap[0]));
+			v->msegs -= 1;
+			i -= 1;
+		}
+		else if ((start < res_end) && (end > res_end)) {
+			/* If the start is in the middle of the region increment it */
+			start = res_end;
+			v->pmap[i].start = start;
+		}
+	}
+}
+
+static void sanitize_pmap(void)
+{
+	/* Remove any questionable addresses from the memory map */
+	/* Unless we really trust the BIOS don't test 640-1M */
+	if (firmware != FIRMWARE_LINUXBIOS) {
+		remove_pmap_region(RES_START >> 12 , (RES_END + 4095) >> 12);
+	}
+	/* Never test where our video buffer lives */
+	remove_pmap_region(SCREEN_ADR >> 12, (SCREEN_END_ADR  + 4095) >> 12);
+}
+
 static void memsize_linuxbios(void)
 {
 	int i, n;
@@ -155,16 +211,6 @@
 			start = nm[i].addr;
 			end = start + nm[i].size;
 
-			/* Don't ever use memory between 640 and 1024k */
-			if (start > RES_START && start < RES_END) {
-				if (end < RES_END) {
-					continue;
-				}
-				start = RES_END;
-			}
-			if (end > RES_START && end < RES_END) {
-				end = RES_START;
-			}
 			v->pmap[n].start = (start + 4095) >> 12;
 			v->pmap[n].end = end >> 12;
 			v->test_pages += v->pmap[n].end - v->pmap[n].start;
diff --exclude=CVS -uNr memtest86-3.0/memtest_shared.lds memtest86/memtest_shared.lds
--- memtest86-3.0/memtest_shared.lds	Mon Apr 22 00:11:15 2002
+++ memtest86/memtest_shared.lds	Sun Aug 17 02:26:29 2003
@@ -20,11 +20,11 @@
 	.hash       : { *(.hash) }
 	.dynamic    : { *(.dynamic) }
 
-	.rel.text   : { *(.rel.text) }
-	.rel.rodata : { *(.rel.rodata) }
-	.rel.data   : { *(.rel.data) }
-	.rel.got    : { *(.rel.got) }
-	.rel.plt    : { *(.rel.plt) }
+	.rel.text    : { *(.rel.text   .rel.text.*) }
+	.rel.rodata  : { *(.rel.rodata .rel.rodata.*) }
+	.rel.data    : { *(.rel.data   .rel.data.*) }
+	.rel.got     : { *(.rel.got    .rel.got.*) }
+	.rel.plt     : { *(.rel.plt    .rel.plt.*) }
 
 	. = ALIGN(4);
 	.data : {
diff --exclude=CVS -uNr memtest86-3.0/patn.c memtest86/patn.c
--- memtest86-3.0/patn.c	Wed Oct 17 17:30:32 2001
+++ memtest86/patn.c	Sat Aug 16 22:39:55 2003
@@ -18,9 +18,6 @@
 #define DEFAULT_MASK ((~0L) << 2)
 
 
-extern struct vars *v;
-
-
 /* What it does:
  *  - Keep track of a number of BadRAM patterns in an array;
  *  - Combine new faulty addresses with it whenever possible;
Binary files memtest86-3.0/precomp.bin and memtest86/precomp.bin differ
diff --exclude=CVS -uNr memtest86-3.0/reloc.c memtest86/reloc.c
--- memtest86-3.0/reloc.c	Mon Apr 15 12:54:01 2002
+++ memtest86/reloc.c	Sat Aug 16 23:23:10 2003
@@ -1,7 +1,7 @@
 #include <stddef.h>
-#include <stdint.h>
-#include <elf.h>
 #include <string.h>
+#include "stdint.h"
+#include "elf.h"
 
 #define __ELF_NATIVE_CLASS 32
 #define ELF_MACHINE_NO_RELA 1
@@ -68,7 +68,7 @@
 {
 	Elf32_Addr ls_addr, s_addr;
 	Elf32_Addr value;
-	if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE)
+	if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE) 
 	{
 		*reloc_addr += map->l_addr - map->ll_addr;
 		return;
diff --exclude=CVS -uNr memtest86-3.0/stdint.h memtest86/stdint.h
--- memtest86-3.0/stdint.h	Wed Dec 31 17:00:00 1969
+++ memtest86/stdint.h	Sat Aug 16 23:02:10 2003
@@ -0,0 +1,52 @@
+#ifndef I386_STDINT_H
+#define I386_STDINT_H
+
+/* Exact integral types */
+typedef unsigned char      uint8_t;
+typedef signed char        int8_t; 
+
+typedef unsigned short     uint16_t;
+typedef signed short       int16_t;
+
+typedef unsigned int       uint32_t;
+typedef signed int         int32_t;
+
+typedef unsigned long long uint64_t;
+typedef signed long long   int64_t;
+
+/* Small types */
+typedef unsigned char      uint_least8_t;
+typedef signed char        int_least8_t; 
+
+typedef unsigned short     uint_least16_t;
+typedef signed short       int_least16_t;
+
+typedef unsigned int       uint_least32_t;
+typedef signed int         int_least32_t;
+
+typedef unsigned long long uint_least64_t;
+typedef signed long long   int_least64_t;
+
+/* Fast Types */
+typedef unsigned char      uint_fast8_t;
+typedef signed char        int_fast8_t; 
+
+typedef unsigned int       uint_fast16_t;
+typedef signed int         int_fast16_t;
+
+typedef unsigned int       uint_fast32_t;
+typedef signed int         int_fast32_t;
+
+typedef unsigned long long uint_fast64_t;
+typedef signed long long   int_fast64_t;
+
+/* Types for `void *' pointers.  */
+typedef int                intptr_t;
+typedef unsigned int       uintptr_t;
+
+/* Largest integral types */
+typedef long long int      intmax_t;
+typedef unsigned long long uintmax_t;
+
+
+#endif /* I386_STDINT_H */
diff --exclude=CVS -uNr memtest86-3.0/test.c memtest86/test.c
--- memtest86-3.0/test.c	Tue May 21 17:13:32 2002
+++ memtest86/test.c	Thu Jan 30 17:20:16 2003
@@ -9,7 +9,6 @@
 extern int segs, bail;
 extern volatile ulong *p;
 extern ulong p1, p2;
-extern struct vars *v;
 extern int test_ticks, nticks;
 extern struct tseq tseq[];
 void poll_errors();
@@ -1282,7 +1281,7 @@
  * Print an ecc error
  */
 void print_ecc_err(unsigned long page, unsigned long offset, 
-	int corrected, unsigned char syndrom, int channel)
+	int corrected, unsigned short syndrome, int channel)
 {
 	update_err_counts();
 	++(v->ecc_ecount);
@@ -1293,7 +1292,7 @@
 
 	cprint(v->msg_line, 36, 
 		corrected?"corrected           ": "uncorrected         ");
-	hprint2(v->msg_line, 56, syndrom, 2);
+	hprint2(v->msg_line, 56, syndrome, 4);
 	cprint(v->msg_line, 66, "ECC"); 
 	dprint(v->msg_line, 71, channel, 2, 0);
 }
diff --exclude=CVS -uNr memtest86-3.0/test.h memtest86/test.h
--- memtest86-3.0/test.h	Tue May 21 15:06:16 2002
+++ memtest86/test.h	Sun Aug 17 04:04:33 2003
@@ -44,6 +44,7 @@
 #define RES_START	0xa0000
 #define RES_END		0x100000
 #define SCREEN_ADR	0xb8000
+#define SCREEN_END_ADR  (SCREEN_ADR + 80*25*2)
 
 #define TITLE_WIDTH	28
 #define LINE_TIME	9
@@ -129,7 +130,7 @@
 void find_ticks(void);
 void print_err(ulong *adr, ulong good, ulong bad, ulong xor);
 void print_ecc_err(ulong page, ulong offset, int corrected, 
-	unsigned char syndrom, int channel);
+	unsigned short syndrome, int channel);
 void mem_size(void);
 void adj_mem(void);
 ulong getval(int x, int y, int result_shift);




More information about the coreboot mailing list