Commit Graph

437 Commits

Author SHA1 Message Date
Lionel Debroux 8d966d98f4
Refactor the memrw functions to reduce the redundancy. (#415)
The impact is limited now, but will increase when adding support for more architectures and more bit widths.
2024-07-16 08:55:13 +01:00
Chao Li fa583c906b app/main: Adjust the inline ASM to i386 only
Make the inline ASM code in function run_at() x86 arch only.

Singed-off-by: Chao Li <lichao@loongson.cn>
2024-07-07 20:32:58 +02:00
Chao Li 28689102a4 boot: Export the startup64 symbol
Export the startup64 symbol for use by some archs.

Signed-off-by: Chao Li <lichao@loongson.cn>
2024-07-07 20:32:58 +02:00
Chao Li d84c8eebee boot/peimage: Add LoongArch and RISC-V PE machine numbers.
Added LoongArch32, LoongArch64 machine numbers, which are defined in Microsoft PE SPEC.
[Lionel Debroux: added RISC-V 32, RISC-V 64, RISC-V 128 PE machine numbers as well, since we already have the ARM machine numbers anyway.]

Signed-off-by: Chao Li <lichao@loongson.cn>
Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2024-07-07 20:32:58 +02:00
Martin Whitaker 5c12c1b2e4 Fix hexadecimal conversion in read_value(). 2024-06-21 22:58:25 +01:00
Martin Whitaker f52751d325 Fix read_value() to correctly scale value when shift parameter is negative. 2024-06-21 22:28:41 +01:00
Pete Batard 3f86696f00 Add GPT partition support
People creating the media through File System Transposition [1] rather than DD
copy may end up with a media that uses a GPT partition table rather than MBR.

So add GPT support to GRUB, as a low cost beneficial change.

For reference, File System Transposition is the default method used by Rufus
and other utilities for creating bootable media from an ISO, and it allows
users to select GPT instead over MBR, in which case memtest86+ will not boot.

[1] https://lists.gnu.org/archive/html/grub-devel/2022-06/msg00024.html
2024-05-24 10:27:20 +02:00
Martin Whitaker 778c7b4cc4 Fix the behaviour of sort_pm_map() (issue #392)
The existing algorithm both read and wrote data beyond the end of the
array and, when moving data, moved it in the wrong direction. Replace
it with a bog-standard insertion sort algorithm. The resulting code
is smaller and probably faster, as memmove() is not in-lined.
2024-04-09 20:07:09 +01:00
Lionel Debroux 53ca89f8ae
Add initial NUMA awareness support (#378)
* Add a file containing useful macro definitions, currently a single top-level macro for obtaining the size of an array; use it to replace a sizeof(x) / sizeof(x[0]) construct in system/smbus.c . This requires switching the GCC build mode from C11 to C11 with GCC extensions.

* Initial NUMA awareness (#12) support: parse the ACPI SRAT to build up new internal structures related to proximity domains and affinity; use these structures in setup_vm_map() and calculate_chunk() to skip the work on the processors which don't belong to the proximity domain currently being tested.

Tested on a number of 1S single-domain, 2S multi-domain and 4S multi-domain platforms.

SKIP_RANGE(iterations) trick by Martin Whitaker.
2024-03-13 01:43:26 +01:00
Martin Whitaker ded371e9da Note that BadRAM patterns exclude errors found in tests 0 and 7.
This was mentioned in the individual test descriptions in the README,
but easily missed (issue #384). Add a note in the BadRAM section of
the README and also in the error display heading.
2024-03-05 23:12:51 +00:00
Martin Whitaker 7b70c6e026 Fix typo in README. 2024-03-05 09:42:59 +00:00
martinwhitaker 20fca09752
Add boot options to perform display rotation and set preferred screen resolution (#383)
* Add boot option to rotate screen display through 90 degrees.

Some machines have a detachable display that can be used in either
portrait or landscape orientations, and require software to rotate
the displayed image accordingly. There is no way to detect the
current orientation through the BIOS, so provide a boot option to
control this. Hopefully we only need to support one (+90 degree)
angle.

Note that the rotate option only works in graphical mode. When booted
by a legacy BIOS using text mode, we have to rely on the BIOS to do
what's necessary.

* Extend boot command line options for display screen control.

Replace "rotate" option with "screen.rhs-up" and "screen.lhs-up" to
allow rotation in either direction. Add a "screen.mode=<w>x<h>"
option to set a preferred width <w> and height <h> for the UEFI
frame buffer. Also allow "screen.mode=bios" to use the default
UEFI frame buffer resolution.

* Add more debug output for EFI frame buffer mode.

* Replicate command line parsing of screen options in efisetup.c.

Trying to do it only once in screen.c didn't work, because static
variables initialied to zero are placed in the bss section, and we
don't zero the bss section until after efisetup() is executed.

The resulting code is in fact smaller, because the compiler can
optimise better when everything is local.

* Add a boot command line option for efisetup debug.

* Improve EFI debug test screen pattern.

* Document the new screen and efidebug boot command line options.

* Fix typo in README.
2024-03-04 14:49:13 +01:00
Sam Demeulemeester 2d3b14ed1a Add detection for various JEDEC Manufacturers 2024-01-07 15:20:19 +01:00
dependabot[bot] 9ac78de289
Bump actions/stale from 8 to 9 (#362)
Bumps [actions/stale](https://github.com/actions/stale) from 8 to 9.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v8...v9)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 15:10:22 +01:00
Sam Demeulemeester 5dde13b0a1
Preliminary ECC support for AMD Zen CPUs (#353)
* Initial commit for ECC support. Preliminary support for AMD Zen.

* Clear ECC registers at startup

* Add config flag (enable_ecc_polling) to toggle ECC polling. (Currently disabled by default for v7 release)
2023-11-29 12:53:05 +01:00
Lionel Debroux 9b9c65b968
Reduce padding and relocations (#355)
* Optimize the JEP106 list by using __attribute__((packed)) to remove padding. The x86 & x86_64 series support unaligned accesses just fine, after all, and this is not remotely a hot path.

* Optimize several string-related constructs by switching to fixed-length char arrays, which avoids pointers + relocations.

* app/interrupt.c: array of different-length strings, but most of those are lengthy enough for this to be a clear win, especially on x86_64;
* system/usbhcd.c: array of same-length strings;
* tests/tests.h: array of structs containing same-length strings.

* Reduce the size of the list of tests by using a narrower type for the cpu mode, which reduces padding.
2023-11-29 12:45:17 +01:00
Lionel Debroux 34eb8186fd
Significantly optimize test_mov_inv_walk1() for size by moving the ternary operators related to inverse and pattern outside hot paths, which prevents generated code duplication and shortens one of the sides of duplicated loops. (#351)
Before:
   text    data     bss     dec     hex filename
   3019       0       0    3019     bcb build32/tests/mov_inv_walk1.o
   2640       0       0    2640     a50 build64/tests/mov_inv_walk1.o

After:
   text    data     bss     dec     hex filename
   1705       0       0    1705     6a9 build32/tests/mov_inv_walk1.o
   1464       0       0    1464     5b8 build64/tests/mov_inv_walk1.o
2023-11-19 17:14:08 +01:00
Martin Whitaker bda3776df1 Fix list item references in README (issue #352)
Markdown does not support using roman numerals for numbered lists, so
change all list item references in the text to arabic numerals.
2023-11-15 21:48:05 +00:00
Jonathan Teh 50f59d411d
cpuinfo: Fix VIA Samuel 2 L2 cache (#341)
* cpuinfo: Fix VIA Samuel 2 L2 cache (Hardcode to 64K)
2023-09-16 18:30:04 +02:00
dependabot[bot] 3813da8bc0
Bump actions/checkout from 3 to 4 (#338)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 23:31:43 +02:00
Sam Demeulemeester fc2826726b Early Bump to v7.00
Requested by many betatesters due to the amount of changes since 6.20 release
ECC support for a few platforms planned before v7.00 release
2023-08-06 20:33:30 +02:00
Sam Demeulemeester 10782c2aad Remove HOW_TO_DEBUG_WITH_GDB.md from root 2023-08-06 20:28:57 +02:00
Sam Demeulemeester d892a6851d
Carry on after a unsafe read on a non-existent MSR (#310)
Allow Memtest86+ to continue if a MSR read instruction lead to a GPF
2023-08-06 20:26:33 +02:00
Sam Demeulemeester 555908137e Move HOW_TO_DEBUG_WITH_GDB.md to doc/ 2023-08-06 17:28:16 +02:00
Regina König bcf8171593 Script to debug memtest86plus (efi-version) with GDB in QEMU (#177)
* Add HOW_TO_DEBUG_WITH_GDB file
* Add debug_memtest.sh
* Add debug target to Makefile
* Add binaries and generated files for debugging to gitignore
* Add DEBUG code for memset and memcpy
* Add debug additions to Makefile in build32
* Add debug_memtest.sh to build32

[Lionel Debroux: post-merge fixups: removed a couple whitespace changes and a backup file; undone Github squash merge authorship damage.]
2023-07-30 22:09:25 +02:00
Lionel Debroux df803bf294 Fix memory error addresses displayed by badram reporting mode (#308). 2023-07-28 09:39:54 +02:00
Sam Demeulemeester 03b6cbe4e4 Add IMC polling for AMD Rembrandt
Refactor cpuinfo() for AMD Family 19h CPUs and add detection for AMD Chagall, Storm Peak, Rembrandt, Phoenix and Granite Ridge
2023-06-01 22:00:02 +02:00
Sam Demeulemeester 43aab9d231
Fix GitHub Actions 404 Errors due to lack of apt-get update (#312) 2023-05-21 00:26:28 +02:00
Jonathan Teh a1ef11c3ba
cpuinfo: Add support for Vortex86 (#290)
* cpuinfo: Add support for Vortex86

Hardcode cache for family 5, use CPUID cache info for family 6.

* cpuinfo: Add support for Vortex86EX

The EX does not have brand string so hardcode name and cache.

* In determine_cache_size(), add an additional test to ensure that only
Vortex86 CPUs are handled, allowing Zhaoxin CPUs to fall through.
2023-05-20 20:10:05 +02:00
Sam Demeulemeester de4f4768fc Fix various temperature-related issues on older Atom CPUs
Also, remove the no_temperature var to keep only the enable_temperature flag
Older Atom still have the enable_temperature flag hard-coded to false until further tests are done
2023-05-18 16:03:48 +02:00
Kimon Hoffmann 0b251df68d
Enable using custom objcopy during build. (#291)
Signed-off-by: Kimon Hoffmann <Kimon.Hoffmann@lawo.com>
2023-05-17 17:37:10 +02:00
Sam Demeulemeester 9e3958714b
Add support for MMIO UART console (#300)
8/16/32-bit MMIO supported, with configuration options as kernel parameters.
2023-05-12 15:49:00 +02:00
Kimon Hoffmann acea409a51
Fix compiler used by "Build and tests" action (#292)
* Make sure the build workflow actually uses the chosen compiler.

Also clean up the repetitive nature of the workflow by defining the word
size as another matrix axis and making iso the default target.

Signed-off-by: Kimon Hoffmann <Kimon.Hoffmann@lawo.com>

* Disabled clang as a compiler alongside gcc.

The state of the current makefiles/source code is not compatible with
clang, so it makes no sense to try to build with it.

Signed-off-by: Kimon Hoffmann <Kimon.Hoffmann@lawo.com>
2023-05-12 15:46:52 +02:00
Sam Demeulemeester 7aeac7271f
Add Memory Controller Registers polling to get current DRAM Timings/Frequency (#306)
Read the memory controller configuration (instead of just relying on SPD data) to get the actual live settings.

Currently supported platforms:
* Intel SNB to RPL (Core 2nd Gen to Core 13th Gen) - Desktop only (no Server nor Mobile)
* AMD SMR to RPL (Zen to Zen4) - Desktop only (no Server, Mobile nor APU).


Individual commits below for archival:

* First functions skeleton for reading IMC/ECC Registers

* Change directory name from 'chipsets' to 'mch' (Memory Controller Hub)

* Add Intel HSW and fix new files encoding

* First Intel HSW IMC implementation

* Add an option to disable MCH registers polling

* Remove old include from Makefiles

* Better Makefile and padding fixes

* Statically init 'imc' struct to generate string relocation record

* Small typos & code fixes

* Add IMC support for Intel Core 6/7/8/9th Gen (SKL/KBL/CFL/CML) This is a bit more complex than Haswell and below because MMIO switched to 64-bit with Skylake (lot of) betatesting needed

* Add IMC read support for Intel SNB/IVB (2nd/3rd gen Core)

* Fix hard-lock on Intel SNB/IVB due to wrong access type on MCHBAR pointer

* Move AMD SMN Registers & offsets to a specific header file

* Add IMC Read support for AMD Zen/Zen2 CPUs

* Change 'IMC' to 'MCH' in Makefiles to match actual mch/ directory

* Add IMC Reading support for Intel ADL&RPL CPUs (Core Gen12&13)

* Add support for Intel Rocket Lake (Core 11th Gen) and AMD Vermeer

* Add IMC reading for AMD Zen4 'Raphael' AM5 CPUs

* Various Cleanup #1 
Change terminology from Intel-based 'MCH' (Memory Controller Hub) to more universal 'IMC' (Integrated Memory Controller) Integrate imc_type var into imc struct. Remove previously created AMD SNM header file

* Various Cleanup 2

* Change DDR5 display format for IMC specs
DDR5 Freq can be > 10000 and timings up to 63-127-127-127, which overwflow the available space.
This commit remove the raw frequency on DDR5 (which may be incorrect due to Gear mechanism) and leave a bit of space to display the Gear engaged in the future
2023-05-12 15:33:28 +02:00
Sam Demeulemeester 5dcd424ea7 Bump version to v6.20 2023-05-07 16:55:03 +02:00
Sam Demeulemeester 1f1fe5bfe8 Generalize the SMBus IO Enable quirk on all Intel ICHs
This has been tested safe on every ICH since the very first one by CPU-Z.
It also solves various SMBus access issues on Mobile PCHs (like #157)
2023-04-26 00:42:58 +02:00
Sam Demeulemeester 0fd2e4c37a Add support for Intel AlderLake-N CPUs 2023-04-24 00:29:37 +02:00
Sam Demeulemeester fa4e903509 Fix APIC Timer detection fail on some modern mobile/embedded PCH
On some modern ULV cores (eg: Gracemont), the 2 following I/O reads to check APIC Timer working status are fused in the frontend, leading to the same value being reported twice and the code falling back to the (unusually disabled on these platforms) PIT timer.

Whether this behavior is intentional or not is unknown.

As usleep/sleep is not available at this point, a dirty delay is added between the two reads.
2023-04-23 22:45:27 +02:00
dependabot[bot] bfbb167a72
Bump actions/stale from 7 to 8 (#287)
Bumps [actions/stale](https://github.com/actions/stale) from 7 to 8.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-29 18:34:20 +02:00
Sam Demeulemeester 79bb781431 Better handling of big FAIL banned in case of errors 2023-03-29 18:29:59 +02:00
Sam Demeulemeester c6b04e5414 Display big banner only once 2023-03-29 17:58:12 +02:00
Sam Demeulemeester 5cbcd2046b Add 'Jade Star' & 'InnoDisk' JEDEC Manufacturers 2023-03-09 23:08:01 +01:00
Sam Demeulemeester bf0dae04bc Remove deprecated ubuntu-18.04 job 2023-03-07 00:34:31 +01:00
Jonathan Teh dcca756e48
[cpuinfo] Fix old CPUs (P5/P6-class) name and cache info (#267)
* cpuinfo: Fix WinChip and Cyrix/NSC CPU name and cache info

Always populate the cache info from extended CPUID, it is not used for
Intel CPUs, even though it is present, and is useful for non-Intel CPUs.

Fix the CPU name and cache sizes for Centaur and Cyrix/NSC CPUs without
brand string, which are the WinChip C6 and all Cyrix CPUs except the
Media GXm.

For the Media GXm and Geode GXm/GXLV/GX1, which are available with both
Cyrix and NSC vendor strings, hardcode the L1 cache size. The Geode GX2
uses standard cache info.

* Add 'Intel' in CPU names for older CPUs

* Add 'Transmeta' and 'IDT' in CPU names for older CPUs
-------

Co-authored-by: Sam Demeulemeester <github@x86-secret.com>
2023-03-03 13:21:27 +01:00
Sam Demeulemeester 262aac4f85
[SMBUS] Add support for ALi M1533/1535/1543C (#273)
Closes #126
2023-02-20 18:31:33 +01:00
Sam Demeulemeester 66bd82f12a
[SMBus] Add support for ALi M1563 Southbridge (#272) 2023-02-19 17:29:56 +01:00
Sam Demeulemeester ee0c400821 [SMBUS] Add support for VIA VT8233 Southbridge 2023-02-18 19:01:59 +01:00
Sam Demeulemeester e1fc02bfe0 [SMBUS] Add support for VIA VT8233A Southbridge 2023-02-18 18:58:34 +01:00
Sam Demeulemeester a1d046fc3a Fix a typo in README.md (serial console baud rate) 2023-02-18 18:51:02 +01:00
Sam Demeulemeester 1a38f513de
[Temperature] Add support for CPUs with specific TjMax (#269)
Solve an issue where reading MSR_IA32_TEMPERATURE_TARGET makes the system crash (e.g. Early Mobile Yonah)
2023-02-18 18:43:38 +01:00