Commit Graph

29 Commits

Author SHA1 Message Date
Lionel Debroux
408fdb8db6 Switch to an array of heaps in the heap manager, and heap IDs in the allocation functions. 2022-07-25 12:53:21 +02:00
martinwhitaker
e6e0f0c8e7
USB improvements (#116)
* Add new heap manager.

* Convert OHCI driver to use new heap manager.

* Convert UHCI driver to use new heap manager.

* Convert EHCI driver to use new heap manager.

* Convert XHCI driver to use new heap manager.

* Convert SMP to use new heap manager.

* Add a "usbinit" boot option to handle various buggy USB devices.

This replaces the "keyboard=buggy-usb" option, and adds a second
workaround to handle the problem seen in issue #107.
2022-07-16 13:34:08 +02:00
Sam Demeulemeester
680e6ad79b Typo on smp.c (missing ;) 2022-06-19 16:39:03 +02:00
Sam Demeulemeester
231b389b3c Various minor cosmetic changes on acpi.c/h (mainly comments and code format) 2022-06-19 16:39:03 +02:00
Sam Demeulemeester
eac4d03462 Parse FADT to find ACPI Timer Base Address and specs 2022-06-19 16:39:03 +02:00
Sam Demeulemeester
221a66da1a Split ACPI Functions from SMP functions.
Add ACPI Table detection for FADT & HPET (as we need better timers)
2022-06-19 16:39:03 +02: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
Sam Demeulemeester
d356a7e3f0 Parse MADT table header with the correct struct (#29) 2022-04-01 13:46:04 +02:00
Martin Whitaker
c13bb30893 Fix mapping of MADT (issue #29)
We need to pass the physical address of the MADT to parse_madt(), not the
virtual address of the table signature, because parse_madt() needs to call
map_region() again to ensure the full table is mapped into virtual memory.
2022-04-01 10:22:25 +01:00
Martin Whitaker
4078b7760e Faster barrier implementation.
The old barrier implementation was very slow when running on a multi-socket
machine (pcmemtest issue 16).

The new implementation provides two options:

  - when blocked, spin on a thread-local flag
  - when blocked, execute a HLT instruction and wait for a NMI

The first option might be faster, but we need to measure it to find out. A
new boot command line option is provided to select between the two, with a
third setting that uses a mixture of the two.
2022-02-28 22:05:21 +00:00
Martin Whitaker
b3d350f454 Add support for 64-bit local APIC addresses found in the MADT.
This is untested, as I don't have any hardware that uses this option.
2022-02-28 22:05:21 +00:00
Martin Whitaker
9fca23105a Don't search for the RDSP at bootparams.acpi_rsdp_addr.
This field is only used internally by the Linux kernel, so will always
be zero when bootparams is passed to us by a bootloader.
2022-02-28 22:05:21 +00:00
Martin Whitaker
da7829d4c3 Ensure the ACPI tables and local APIC are mapped into an accessible region.
We only map the first 4GB of physical address space, so if the ACPI tables
or local APIC are located above 4GB, or are overlaid when we remap something
else (e.g. the video frame buffer), we need to map them to somewhere we can
access. The ACPI tables are only used during startup, but the local APIC
will be needed when we are running tests if we are saving power by halting
idle CPU cores and using a NMI to wake them up.
2022-02-28 22:05:21 +00:00
Martin Whitaker
d1382b7a53 Increase timeout delay for starting APs. 2022-02-13 20:25:11 +00:00
Martin Whitaker
2bf1623733 Halt CPU cores that are not active in a test.
This saves a lot of power when performing sequential tests.
2022-02-12 19:30:14 +00:00
Martin Whitaker
de32bc5412 Ensure we only use 32-bit reads and writes when accessing APIC registers. 2022-02-12 09:39:18 +00:00
Martin Whitaker
7dd17c26c0 Check whether the BIOS has enabled x2APIC mode, and disable SMP if so. 2022-02-05 18:03:32 +00:00
Martin Whitaker
29b8bbece8 Rework AP startup based on how it's done in Linux. 2022-02-05 18:03:32 +00:00
Martin Whitaker
da0d2a9fc3 The apic_id_to_cpu_num[] map needs to be unsigned to support > 256 cores. 2022-02-01 15:40:52 +00:00
Martin Whitaker
16d55b7dad Remove distinction between physical and virtual CPUs.
This is no longer needed, now we can display as many CPUs as we can
physically handle.
2022-01-31 22:59:14 +00:00
Martin Whitaker
17093a96f9 Optimise the AP startup code to reduce the startup delay. 2022-01-31 19:47:32 +00:00
Martin Whitaker
ec676ccab2 Add debug trace for ACPI RSDP search results. 2020-12-11 16:18:45 +00:00
Martin Whitaker
bb667b600f Use ACPI RSDP address from boot_params if provided by bootloader. 2020-12-11 16:18:04 +00:00
Martin Whitaker
1d2bf57403 Improve and fix scanning for ACPI tables. 2020-12-11 13:27:05 +00:00
Martin Whitaker
27c5fe363f Add startup option to enable/disable SMP. 2020-12-10 13:51:39 +00:00
Martin Whitaker
366e7a1af4 Improve code readability. 2020-06-30 13:58:33 +01:00
Martin Whitaker
7d00dbe26a Remove duplicate EFI table definitions. 2020-06-30 13:57:15 +01:00
Martin Whitaker
9492c086fe Move boot_params definitions into separate header file. 2020-06-29 12:09:13 +01:00
Martin Whitaker
fbd3376668 Initial commit. 2020-05-24 21:30:55 +01:00