Commit Graph

278 Commits

Author SHA1 Message Date
Martin Whitaker 3a107018e5 Reset EHCI controller after port scan if no keyboards are found.
Low and full speed USB devices that are attached directly to an EHCI port
have to be handled by a companion controller (either UHCI or OHCI). We hand
over ports when we detect a low or full speed device is attached by setting
the Port Owner bit in the Port Status and Control register. However some AMD
companion controllers fail to detect the device after this has been done.
Resetting the EHCI controller works around this quirk.

This fixes issue #6 and issue #71.
2022-05-21 20:22:03 +01:00
Sam Demeulemeester dce2cfb079 Fix a detection issue caused by some Pre-ZEN AMD CPUs sometimes incorrectly reporting SMT as supported 2022-05-21 01:31:06 +02:00
Sam Demeulemeester 3bc72c1fd4 Remove unused strings and useless smb_idx argument in get_spd() 2022-05-20 19:10:00 +02:00
Sam Demeulemeester e0cee8e2c3 Add SMBUS support for Intel 82371AB (PIIX4) and AMD Bulldozer/Kabini (SB800/900) 2022-05-20 18:07:22 +02:00
Sam Demeulemeester 6b253adb9a Include unistd.h in pci.c to use usleep() 2022-05-20 13:46:29 +02:00
Sam Demeulemeester bc8235f50d
Add a way to handle hardware quirks at init or later in the code. Add ASUS TUSL2-C ASB100 Mux as (working) example (#77) 2022-05-20 13:23:25 +02:00
Sam Demeulemeester d901f9e8a1 Fix an issue where DDR4 Bank switch fail because DMI tables have multiples Type 17 structs reporting unpopulated slots as Type 2 (unknown), overwriting the valid struct with the populated slot. Code cleanup to improve readability 2022-05-20 01:59:27 +02:00
Lionel Debroux caa07482a0 Reorganize struct spd_infos for better alignment (#2), fix left shifts of count > width of type, fix whitespace, improve comments. 2022-05-19 18:45:13 +02:00
Sam Demeulemeester c2d033b4b4 Correct tCL detection on SDRAM 2022-05-19 17:16:13 +02:00
Sam Demeulemeester 076e133415 Add support for non-DDR RAM in display.c 2022-05-19 16:02:31 +02:00
debrouxl c1d0c17f23 Add SPD decoding for SDRAM. 2022-05-19 15:07:09 +02:00
Sam Demeulemeester 37edb221d7 Importing minor bug fixes in smbus.c from delayed PR #44
Co-authored-by: 01e3 <01e3@ans.pl>
Co-authored-by: debrouxl <lionel_debroux@yahoo.fr>
2022-05-19 12:01:05 +02:00
Martin Whitaker f16be176ed Fix triple-fault when starting APs with program loaded above 16MB (issue #63).
In a .code16 section, the default coding for the lgdt instruction only loads
a 24 bit base address from the GDT descriptor. When loaded above 16MB, we
need it to load the full 32 bits.
2022-05-15 12:18:07 +01:00
Martin Whitaker f98ceb1613 Set the kernel_alignment and min_alignment fields in the Linux setup header.
This shouldn't be needed because we don't set the relocatable_kernel flag,
but the GRUB linuxefi command pays no attention to that. Currently the
linuxefi command also ignores the alignment values, but set them now in
case that changes in the future.
2022-05-15 12:18:07 +01:00
Sam Demeulemeester 722b1b2899 Fix console kernel parameters parsed too late at boot (#66). Reorder global init to start tty after config parsed. Allow a wider options for console argument (ie: console - console=ttySx - console=ttySx,115200 2022-05-12 16:55:52 +02:00
Sam Demeulemeester c56fbe3257 Change serial console baud rate parameters to match conventional linux kernel - ie: console=ttyS0,115200 for 115200 bps (#64) 2022-05-10 23:59:20 +02:00
Martin Whitaker e8c8ef69eb Simplify allocation of memory in efisetup.c. 2022-05-09 18:41:14 +01:00
Martin Whitaker ef3f0bc1e5 Call cpuid_init() before the first call to map_region().
map_region() uses the long mode flag, so that must be initialised first.
2022-05-09 18:17:19 +01:00
Martin Whitaker e429abec9f Support boot options when booting directly from EFI image (issue #53). 2022-05-08 22:46:27 +01:00
Sam Demeulemeester a67d346ef7
Update README.md
- Add 'console' parameters details in boot options
- Change the header for the release for binary release
- Remove solved known bugs
2022-05-05 23:19:50 +02:00
Martin Whitaker af54067228 Execute smp_init() before keyboard_init() in case ACPI tables are overwritten.
When USB keyboard detection is enabled, physical memory pages are reserved
for use by the USB drivers. The physical memory map exposed by pmem.h does
not indicate where the ACPI tables reside, so we may end up using pages
that contain ACPI tables (or for that matter, the boot parameters and boot
command line). So rather than introduce a more complicated memory allocation
scheme, make sure we have finished with all the data passed to us by the
BIOS and/or boot loader before we start probing for USB devices.

The only downside to this is that it is no longer possible to interactively
disable parsing of the ACPI tables - that can now only be done by using the
"nosmp" boot option.
2022-05-04 22:42:31 +01:00
Martin Whitaker 7b41830c40 Change "smp" boot option to "nosmp".
SMP is now enabled by default, so we need an option to disable it.
2022-05-04 22:16:14 +01:00
Martin Whitaker eaf29f1e39 Mark keyboard reports passed to process_usb_keyboard_report() as const. 2022-05-01 22:43:04 +01:00
Martin Whitaker 260c113bb2 Detect and ignore the HID keyboard "phantom condition" (excessive roll-over). 2022-05-01 22:40:42 +01:00
Martin Whitaker ddaa8bff3f uhci: update the data toggle bit when reenabling an interrupt transfer.
For the same reason as the preceeding ehci fix.
2022-05-01 22:05:40 +01:00
Martin Whitaker f7d31df412 ehci: update the data toggle bit when reenabling an interrupt transfer.
Previously every second transfer was dropped. We didn't notice, because
they were normally key release events, which we ignored anyway. However
the new keyboard report handler needs to see the release events.
2022-05-01 18:27:13 +01:00
Martin Whitaker c3bdb556d1 Move probe_usb_controller() into private functions section of usbhcd.c
No functional change. It was just in the wrong place.
2022-05-01 18:24:39 +01:00
Martin Whitaker 97d6c7140d Improved USB keyboard report handling.
A USB keyboard may return key codes in any of the 6 key code array
positions (issue #48). So we have to compare the latest report to
the previous one to detect new key presses and handle rollover. As
the same change is needed for all HCI types, factor out the common
code into the base driver.
2022-05-01 16:44:46 +01:00
Martin Whitaker 3aebe091cb xhci: mark legacy support regs as volatile and preserve reserved bits. 2022-05-01 11:49:39 +01:00
Martin Whitaker 8284e98761 Don't disable bus master capability when probing USB PCI configuration.
That can cause the SMM to freeze the system when legacy support is
enabled on some AMD XHCI controllers (issue #56).
2022-04-30 11:30:00 +01:00
martinwhitaker 93c9c8ded5
Rework memory mapping to allow for larger program size (#54)
* Improve abstraction in vmem.h and limit memory benchmarking to first 2GB.

The third GB may get used for remapping memory regions that are only
accessed during startup, so it's not safe to use it for the memory
speed tests.

* Fix calculation of end limit for locating memory benchmark workspace.

* Document vmem.h.

* Use window number, not current start address, to detect first window.

* Increase the program low-load range from 1MB to 4MB and make more robust.

If the BIOS has reserved some parts of low memory, there may not be
enough contiguous space left to load the program there (issue #49).
So increase the low-load range to include the first 3MB of high
memory. Also guard against the program being initially loaded
straddling the new boundary.

Co-authored-by: Martin Whitaker <memtest@martin-whitaker.me.uk>
2022-04-28 23:04:01 +02:00
Martin Whitaker aa40bfb738 Accept up to 4 digits when reading CPU numbers in config menu (issue #50). 2022-04-23 16:06:53 +01:00
Martin Whitaker e0c0cd55c6 Tidy up code for performing reset via the EFI runtime sevices.
Make this entirely local to hwctrl.c.
2022-04-23 13:25:33 +01:00
Martin Whitaker a14a6b8e65 Fix start address calculation when booting from 32-bit EFI (issue #52) 2022-04-23 13:17:59 +01:00
Martin Whitaker faab0a321d Only look for the RDSP in the appropriate EFI system table.
We don't support mixed-mode boot, so we will never find a 32-bit EFI
system table when running from a 64-bit binary.
2022-04-23 09:16:42 +01:00
Martin Whitaker 80bb3f452d ohci: fix startup when the controller is in SUSPEND or RESUME state. 2022-04-23 08:57:55 +01:00
Martin Whitaker 0bd19d9d91 ohci: rename variable used to preserve the frame interval.
For code clarity. No functional change.
2022-04-23 08:49:30 +01:00
Martin Whitaker 0939c5e127 Work around bug in SiS OHCI controllers (issue #43).
The SiS OHCI controller ignores writes to its FmInterval and PeriodicStart
registers when in SUSPEND state, so delay initialisation of these registers
until after we start the controller running.
2022-04-23 08:37:42 +01:00
Sam Demeulemeester 2a7631daab Enumerate all XMP 3.0 profiles on DDR5 to find the fastest. Solve a rounding issue with DDR5 timings 2022-04-22 00:49:54 +02:00
Martin Whitaker 66c6dfa357 Reduce pause at start delay to 3 seconds. 2022-04-17 22:53:39 +01:00
Martin Whitaker 644a13c730 Add usbdebug command line option and conditionally pause at end of USB scan.
If the usbdebug option is present, pause at the end of the USB scan until
a key is pressed. Otherwise, if the keyboard=usb option is present and no
USB keyboards were discovered, pause for 10 seconds. Otherwise don't pause.
2022-04-17 22:46:17 +01:00
Martin Whitaker d1cafa9f64 Fix grub-iso build on systems with grub2-mkimage. 2022-04-17 22:42:56 +01:00
Sam Demeulemeester a95afe88db Make ISO volume name ISO9660 compliant and allow alternative name for grub2-mkimage (ie: Debian package use grub-mkimage instead of grub2-mkimage) 2022-04-17 16:59:57 +02:00
Sam Demeulemeester 3ac3aa995e Add detection for some manufacturers related to RDRAM 2022-04-16 18:38:32 +02:00
Sam Demeulemeester be9502ac01 Add detection for Rambus RDRAM modules & support for ICH1/2/3 2022-04-16 18:36:58 +02:00
Sam Demeulemeester fec8bc258b Correct SMT/HTT flag according to AP-485 2022-04-16 18:34:49 +02:00
Lionel Debroux ea6e32cb48
Add support for parsing DMI struct type 1 (System Information), whose presence is mandatory, and use it as fallback for DMI struct type 2 (Baseboard Information), which often gives more useful data, but is optional. Fixes part of issue #36. (#39) 2022-04-16 13:40:50 +02:00
Sam Demeulemeester 7b2964dd21 Fix display of Paging Mode (PAE/LM/*NONE*) on 32bit binary 2022-04-16 13:31:28 +02:00
Sam Demeulemeester 2a994e7ff5 Various code cleanup following PR review 2022-04-16 13:31:28 +02:00
Sam Demeulemeester eae5dd2796 Correct TTY to match the new temperature location on display 2022-04-16 13:31:28 +02:00