Commit Graph

45 Commits

Author SHA1 Message Date
Travis Geiselbrecht
936ee8ac81 [arch][x86] start of an ioapic driver
Doesn't do much but provided the detection path for it and ability to
hold initialized state. The higher level platform code is going to need
to use it directly so will mostly just provide an api for access to it.

Moved ACPI sniffing back to just after the VM is initialized instead of
all the way into platform_init(). This should try to ensure that all
drivers that come up afterwards will have ioapics discovered in case
future development tries to enable and use them, kicking the machine out
of virtual-wire-mode.
2025-09-24 01:18:52 -07:00
Travis Geiselbrecht
09412c194f [platform][pc] refactor existing PIT code into separate file
Extend the PIT driver to allow for one shot timers even though it
monotonically runs a 1kHz tick. This allows it to keep time and provide
one shot events, though only at 1ms resolution.
2025-03-30 14:54:01 -07:00
Travis Geiselbrecht
1ca821ec54 WIP x86-smp squelch some warnings in no smp mode 2024-12-06 23:44:19 -08:00
Travis Geiselbrecht
1afb5d7a66 WIP x86 smp: start the framework for detecting and starting secondary cores 2024-12-06 23:40:26 -08:00
Travis Geiselbrecht
ed309d2d7f [platform][pc] use legacy memory descriptor if multiboot doesn't pass new style
Use the legacy version of the memory sizing info that just hands the
kernel 2 implicit ranges: 0 ... X and 1MB ... Y.

Not ideal, but when booting on very old machines without BIOS e820 call
implemented it's all you got.
2024-03-07 23:35:58 -08:00
Travis Geiselbrecht
bcfad25587 [arch][x86][mmu] update how mmu code accesses physical pages
Move the mmu_initial_mapping from platform into arch/x86. For this
architecture the default mappings are basically hard coded in arch/x86
anyway, so move ownership of this data there, closer to where it's
actually initialized.
Update the 32 and 64bit paging code to properly use the paddr_to_kvaddr
and vice versa routines.
Update to allocate page tables directly from the pmm instead of the heap
(on 32bit code).
2022-11-02 23:48:49 -07:00
Travis Geiselbrecht
0d0568612a [lib][acpi_lite] update to use the VMM to map acpi tables in
The old method assumed that all of the tables were mapped within the
kmap area of the kernel. This basically works on 64bit machines but on a
32bit x86 its entirely likely the ACPI tables are at higher physical
addresses that can be reached, which is currently limited to 1GB.

By using the VM it means it can individually map the headers and each
individual table.
2022-11-02 21:44:15 -07:00
Travis Geiselbrecht
62e2e7dba0 [platform][pc] move the multiboot header into generic space
Share the header with arch/x86 code
Clean up the use of the boot flags
Add code to print the framebuffer information, if present
2022-08-07 23:04:23 -07:00
Travis Geiselbrecht
8643334914 [platform][pc] update the multiboot memory detection code
Parse up to 16 pmm arenas from the multiboot memory data structure. Roll
the 32bit code to properly trim at 1GB as before, but using new logic.
Remove conditional checks on WITH_KERNEL_VM in x86 code, which only
really compiles with the mmu and the vm on.
2022-08-07 16:28:03 -07:00
Travis Geiselbrecht
fe28bd8a95 [lib][minip] add a mechanism to wait for the stack to be configured
Configured in this case means an ip address assigned and a nic
installed.
2022-03-19 14:46:01 -07:00
Travis Geiselbrecht
36e73e0fac [bus][pci] add routines to pass in PCI bus resources prior to starting the pci bus manager
Wire them up on arm and riscv which need them. x86-pc does not, so dont
call it.

Also fix a few miscellaneous bugs, notably PCI not detecting 64bit bars
properly due to an off by one bit error.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
caafb3e2ad [dev][net][e1000] First stab at a working e1000 driver.
-Works against qemu's e1000 and e1000e driver.
-Untested on real hardware yet.
2021-12-27 22:24:31 -08:00
Travis Geiselbrecht
fb1e414a09 [dev][bus][pci] major refactor of the PCI bus driver
-Add a bus manager level, which is an object oriented walk of the pci
busses to build a per device object for later manipulation.
-Add features to enable MSI interrupts.
-Extend generic interrupt api to allow the platform to allocate vectors
for MSI interrupts.
-Rearrange a bit of the pc platform for the platform api changes.
-Add PC platform support for using the local apic to EOI MSI vectors.
-Fix up a few existing PCI drivers for small API changes.
-Add a few stubbed out routines for non PC platforms that use PCI.
2021-12-27 22:24:31 -08:00
Travis Geiselbrecht
a23282cc30 [platform][pc] print some ACPI table information at boot 2021-11-12 21:07:53 -08:00
Travis Geiselbrecht
0c27d8fe45 [bus][pci] first stab at PCI-e ECAM support 2021-11-12 20:44:47 -08:00
Travis Geiselbrecht
ff0f09ae4d [lib][acpi_lite] add definition of MCFG table
MCFG describes the PCIe memory configuration region. Add support for
this table and print the information on boot on PC.
2021-11-11 01:00:18 -08:00
Travis Geiselbrecht
0cf8b5b3c6 [platform][pc] add acpi_lite to the build
Probe ACPI after threads are up and running. Does nothing at the moment
except probe.
2021-11-11 00:16:40 -08:00
Travis Geiselbrecht
445f3e4ee7 [platform/target][warnings] fix -Wmissing-declarations warnings in platform/ and target/
Mostly driver code in various platforms. There are still some warnings
in this part of the tree in lesser-used platforms.
2021-10-21 23:18:09 -07:00
Travis Geiselbrecht
a44bc7863d [dev][bus][pci] move the pci driver out of platform/pc into generic space
No functional change.
2020-03-07 18:17:36 -08:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Travis Geiselbrecht
4c29a608e9 [platform][pc] fix up bios32 PCI support, get pci IDE working again
-Spiff up the device driver starting logic to allow for statically
started devices, instead of always automatic.
2018-12-31 16:47:32 -08:00
Xi Wang
63fa995789 [platform][pc] fix memory map handling in multiboot
The starting address of mmap is off by 4 bytes.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
2017-07-29 21:34:26 -07:00
Travis Geiselbrecht
ee672a5471 [arch][x86] flatten x86-64 and x86 into a single tree of code
Major refactor of x86 code into a single arch.
Also bump both 32 and 64 bit to running the kernel at a 'high' address.
2016-02-29 12:42:45 -08:00
Travis Geiselbrecht
d569c090ea [vim] remove vim expandtab comments on most of the files 2016-02-14 12:32:07 -08:00
Travis Geiselbrecht
5030e3e8c8 [platform][pc] mass reformat of pc platform to space indents
used ./scripts/codestyle.space
2015-11-06 19:32:51 -08:00
Bing Zhu
60c8eb2e56 [arch][x86_64][mmu] fix virtual addr and physical addr validity check
Canonical address is meaningful only for VIRTUAL address, for physical
address, just check max supported address reported by CPUID capability.
2015-11-05 16:52:03 -08:00
Travis Geiselbrecht
fcaac23cf6 [platform][pc] fix warnings in pc platform 2015-10-27 13:22:34 -07:00
Travis Geiselbrecht
713e138de9 [arch][x86] clean up the way memory size is detected and the vm initialized
Also fix a few warnings in arch/x86
2015-10-11 14:09:55 -07:00
Shreyas Nagaraj
57a08b7f65 [arch] [x86] - changes to MMU for x86, x86-64 and x86-PAE
fixing bugs in page table mgmt and overall MMU code clean-up

Signed-off by: Shreyas Nagaraj <shreyas.nagaraj@intel.com>
2015-07-01 00:36:12 -04:00
Sergio Rodriguez
f847e3470f removing redundant hash define 2015-06-11 16:19:09 -07:00
Sergio Rodriguez
737b76684c [arch][x86-64] Adding Virtual memory support with a 1 to 1 mapping 2014-12-11 19:22:58 -08:00
Shreyas Nagaraj
2ff04720f7 [arch][x86-64] MMU fixes - arch_mmu_query, page walking, kernel ld script 2014-12-11 19:22:37 -08:00
Shreyas Nagaraj
e2a45c32b7 [arch][x86_64] more x86-64 MMU changes 2014-12-11 19:22:37 -08:00
Shreyas Nagaraj
1d5339a815 [arch][x86-64] removing platform init code specific for x86-64 from 32 bit 2014-12-11 19:22:36 -08:00
Shreyas Nagaraj
39439a5388 [platform][pc] Separating x86 MMU init code flow for 32 bit & 64 bit Arch 2014-12-11 19:22:28 -08:00
Shreyas Nagaraj
78c4eee1c8 [arch][x86-64] MMU enabling 2014-12-11 19:21:33 -08:00
Travis Geiselbrecht
35f8e0c45e [arch][x86] remove the _heap_end symbol from arch code
Add bogus _end_of_ram to the x86|x86-64 linker script to satisfy the
heap's initial setup of it. _heap_end is still manipulated in platform
space to reflect the real memory map.
2014-07-16 20:48:43 -07:00
Sergio Rodriguez
e49f1d4f91 Creating initial commit for x86-64 for LK, this will be the base for the 64 bit version of LK. 2014-04-18 17:09:43 -07:00
Travis Geiselbrecht
98b4e0938e [make] rename DEBUGLEVEL -> LK_DEBUGLEVEL, remove DEBUG define
-Remove top level DEBUG=<N> define
-Rename DEBUGLEVEL to LK_DEBUGLEVEL to be clear.
-Fix the places that used DEBUGLEVEL and the few spots that #ifdef
on DEBUG.
2013-06-07 22:27:00 -07:00
Travis Geiselbrecht
a6f6a7fbe7 [platform] run platform/ through astyle 2012-10-31 22:09:01 -07:00
Corey Tabaka
94f3f37b4a [platform][pc] Add basic UART support and connect the console to it.
This is especially useful when using the "nographic" option of qemu like this:

qemu -kernel build-pc-x86/lk.bin -nographic

Define WITH_CGA_CONSOLE=1 to enable the CGA console instead.
2012-07-02 00:35:01 -07:00
Corey Tabaka
f463e26b40 Added support for PCI config space read/write via PCI BIOS. Added some PCI commands to query/modify config space and enum devices. 2009-04-24 11:14:38 -07:00
Corey Tabaka
47db8d46e4 Reorganization to better fit platform/target conventions. 2009-04-24 11:14:38 -07:00