Files
memtest86plus/app/badram.h
martinwhitaker 9ef7eae74e Improve BadRAM pattern collection and add more condensed error reporting modes (#454)
* badram: Make DEFAULT_MASK depend on ARCH_BITS, not x86_64 architecture.

* badram: Don't display leading zeros for BadRAM addresses.

* badram: Merge patterns immediately when there is no additional cost.

The current algorithm only starts merging patterns when num_patterns
equals MAX_PATTERNS, which can lead to having several patterns that
could have been merged into one at no additional cost. e.g.

patterns = [
  (0x00, 0xfffffffffffffff8),
  (0x08, 0xfffffffffffffff8)
]

can appear, even though

patterns = [
  (0x00, 0xfffffffffffffff0)
]

represents the exact same addresses at the same cost.

So, at the same time as we test whether an address is already covered,
also check if we can cheaply combine the new address with an existing
pattern.

* badram: Factor out code that wraps to a new line when necessary.

In preparation for next commit.

* badram: Add more modes for recording/displaying error maps.

The original code just supported recording and displaying patterns suitable
for use with the Linux BadRAM extension or GRUB badram command. With some
minor changes it can be made to record address ranges and display them
either in the format used by the Linux memmap boot command line option
or as a simple list of memory page numbers (which can be used with the
Windows bcdedit program).

* badram: Increase the number of stored patterns/ranges.

* Update README to include the new error reporting modes.
2024-11-11 23:57:21 +01:00

50 lines
1.2 KiB
C

// SPDX-License-Identifier: GPL-2.0
#ifndef BADRAM_H
#define BADRAM_H
/**
* \file
*
* Provides functions for recording and displaying faulty address locations
* in a condensed form. The display format is determined by the current value
* of the error_mode config setting as follows:
*
* - ERROR_MODE_BADRAM
* records and displays patterns in the format used by the Linux BadRAM
* extension or GRUB badram command
*
* - ERROR_MODE_MEMMAP
* records and displays address ranges in the format used by the Linux
* memmap boot command line option
*
* - ERROR_MODE_PAGES
* records and displays memory page numbers
*
*//*
* Copyright (C) 2020-2024 Martin Whitaker.
*/
#include <stdbool.h>
#include <stdint.h>
#include "test.h"
/**
* Initialises the fault record. This must be called each time error_mode is
* changed.
*/
void badram_init(void);
/**
* Inserts a single faulty address into the fault record. Returns true iff
* the fault record was changed.
*/
bool badram_insert(testword_t page, testword_t offset);
/**
* Displays the fault record in the scrollable display region in the format
* determined by error_mode.
*/
void badram_display(void);
#endif // BADRAM_H