755 Commits

Author SHA1 Message Date
Travis Geiselbrecht
7c2c8d8e56 [dev][interrupt][riscv_plic] merge now 3 implementations of the same plic driver into one
Move a copy of the PLIC driver out of one of the platforms and make the
setup of the interrupt controller a bit more dynamic.
2023-03-09 23:09:32 -08:00
Travis Geiselbrecht
c66ad44efa WIP [target][visionfive2] Add initial support for a VisionFive 2 RISC-V board
Still TODO:
-Set the timer rate properly
-Fix nonzero based hart secondary cpu boot
-Try to parse the device tree for some information
2023-03-06 01:06:27 -08:00
Travis Geiselbrecht
91d0a5f7d1 [lib][fdtwalk] add routine to find and parse /reserved-memory node
Add logic to the riscv virt platform to properly mark off memory
claimed by OpenSBI.
2022-12-17 17:12:35 -08:00
Travis Geiselbrecht
2d561b4fcf [platform][qemu-virt-riscv] seems the first 512K are now used by opensbi 1.1
Looks like this is described in /reserved_memory/mmode_resv@<address> as
patched by opensbi on top of the existing qemu provided dtb.

Future patch should parse this instead of hard coding it.
2022-12-17 00:57:37 -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
2367686854 [make] add a way for a module to opt into additional warnings
Move -Wmissing-declarations and -Wmissing-prototypes into this bucket.
Opt in most of the core top level modules in the system. More to follow.
2022-10-23 23:16:48 -07:00
Pedro Falcato
165f826ca3 [platform] [riscv-virt] Fix PLIC_PRIORITY macro
Old PLIC_PRIORITY macro had an off-by-one bug, causing you to set the
priority for the wrong IRQ.
2022-09-28 19:36:13 -07:00
Michael Bishop
f4b2fa9a6b [dev][power][psci] refactor out of the qemu-virt-arm module 2022-09-25 18:14:50 -07:00
Travis Geiselbrecht
c44c6ed86e Merge from luka177:f4-update
Update the stm32f4xx ST peripheral libraries.
2022-08-14 19:07:35 -07:00
Travis Geiselbrecht
f2cf99bf73 [platform][stm32f4xx] append the necessary #define to GLOBAL_COMPILEFLAGS
GLOBAL_CFLAGS will only work for .c files, which breaks on the first
inclusion of the headers by a .cpp file. *_COMPILEFLAGS is for all
language types (C, asm, C++)
2022-08-14 19:05:20 -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
497c52115b [platform][rosco-m68k] microoptimize the duart irq 2022-08-06 17:55:35 -07:00
Travis Geiselbrecht
b8de922781 [platform][rosco-m68k] delete some unused #defines 2022-08-06 17:41:12 -07:00
Travis Geiselbrecht
c3ea652c1f [platform][qemu-virt-m68k] fix timer interrupts
The IRQ calculation for the virtio range was off by 8, which caused the
virtio code to override the interrupt registration for the RTC, which
caused it to stop firing. Clean up the #defines that define irq mappings
to fix this issue.
2022-08-06 17:28:12 -07:00
Travis Geiselbrecht
c429ffcc7a [arch][x86] add more comprehensive feature bit routine
Cache copies of the first few cpuid leaves from each bank at bootup if
present. Add a fast routine to test feature bits out of this array.
2022-07-24 16:59:45 -07:00
Travis Geiselbrecht
cd96c43006 [make] define and undefine some make variables
Based on building with --warn-undefined-variables, find a few places in
the build system where undefined variables were used incorrectly, or
never set due to unused code.
2022-07-22 23:45:42 -07:00
luka177
17a2af5ceb [platform-stm32f4xx] Updata chip defenition 2022-07-21 19:19:31 +03:00
Travis Geiselbrecht
095aca80f1 [arch][riscv][sbi] add the pmu extension, tweak boot messages, qemu-virt use reset calls 2022-05-29 14:48:04 -07:00
Travis Geiselbrecht
d496ca1902 [platform][rosco-m68k] add proper support for the system data block
A block of data left behind by the firmware to tell the system important
things such as the size of memory.
2022-05-21 17:26:49 -07:00
Peter Collingbourne
4a15661ee0 [arch][arm64] use SMC when booted at EL2 in QEMU
If we were booted at EL2 (e.g. when passing -machine
virt,virtualization=on), we need to use SMC instead of HVC for PSCI
calls. Change psci_call() to do this and add a flag to do-qemuarm to
allow testing this scenario.
2022-04-19 18:32:12 -07:00
Travis Geiselbrecht
8cdd71ab00 [platform][rosco-m68k] default to WITH_LINKER_GC on 2022-04-18 01:15:45 -07:00
Travis Geiselbrecht
9d1802fa2c [platform][rosco-m68k] change the tick rate to 100Hz
1000kHz is probably a bit much for this board.
2022-04-18 00:48:50 -07:00
Travis Geiselbrecht
49644a2c39 [platform][rosco-m68k] Add port to the Rosco M68k board
Port to the really neat 68010 based board at https://rosco-m68k.com/

Port Features:
-10Mhz 68010
-1MB ram
-Dual UART + timer implemented as a 68c681 chip
-timer running at 1Khz, UART A for console
-interrupt driven RX support

Some amount of extending of the 68k exceptinon code was needed to
support the autovectored irqs that the 68681 uart uses. Added build
system support for 68010.
2022-04-12 00:25:12 -07:00
Travis Geiselbrecht
6ad3643165 [lib][minip] add an arg to the ethernet transmit callback
Already had the registration hook for it, but was never used.
2022-03-19 15:06:57 -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
cc21c06eb6 [platform][m68k-virt] parse the BOOTINFO structure qemu uses to pass info
Pull out the memory size of the system and use it to initialize the
novm.
2022-02-11 00:37:51 -08:00
Travis Geiselbrecht
f1431b81d0 [bus][pci] Support for dynamically assigning BARs and bridges if needed
In the case of platforms where a bios or firmware has not already
assigned all the resources, do so. Requires the platform supply one or
more ranges of physical address space and IO that can be mapped into
BARs.

Handles iterating through bridges, computing the sizes of all the
peripherals downstream and rolling that up as well.
2022-02-06 19:46:39 -08: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
06ab680159 [lib][fdtwalk] add support to return the io/mmio pci aperture as well
FDT encodes the range of available mmio and io ports that the PCI bus
can use to map bars. Return this information out of the FDT walker
helper routines to feed into the PCI bus manager in the future.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
2ab1af0bf3 [bus][pci] add a virtual module that references all the pci drivers
Not sure if this is the right way to go forward, but it at least keeps
from having to copy/paste the same module list in a few different
places.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
91d5c67fc2 [platform][qemu-virt] make sure the PCI bus builds properly
Implement stubbed out versions of the msi allocation routines.

Add a stubbed out routine to allocate MSI vectors.
2022-02-06 19:46:05 -08:00
Travis Geiselbrecht
4d276a2406 [platform][pc] add a routine to read the cmos memory 2022-01-09 18:20:14 -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
c9eae714db [platform][qemu-virt-riscv] pick the PCIE ecam out of FDT and initialize PCI bus 2021-11-12 21:23:09 -08:00
Travis Geiselbrecht
3d95143d27 [platform][qemu-virt-arm] bootstrap pci from the FDT
Look up the ECAM information out of the device tree and bootstrap the
pci bus with it.
2021-11-12 21:08:35 -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
7285a2d1fd [bus][pci] convert the pci driver's back end to simple C++ objects
It was already rolling a vtable so go ahead and just implement it as
actual c++ objects.
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
a2b41c11d2 [dev][pci] move the pci console commands into the pci bus driver
Remove app/pcitests since it was just the console commands.
2021-11-09 00:19:53 -08:00
Travis Geiselbrecht
911900f3df [arch][m68k] Merge in Motorola 68k port 2021-11-08 23:24:37 -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
Onath Claridge
3c4a0b96c1 [stm32f0xx] Fix type of overflow counter.
stm32_timer_calc_value was using uint32_t for the overflow counter,
ultimately causing timestamps to wrap as uint32_t.
2021-08-12 13:22:03 -07:00
Travis Geiselbrecht
d6fa4d5b80 [arch][m68k] add exception and irq processing
-Add interrupt controller and timer support for qemu virt machine
-Switch tty read to irq driven as well
2021-06-07 02:40:02 -07:00
Travis Geiselbrecht
12fee4b59a [arch][m68k] initial port to m68k
Uses the QEMU virt machine for 68k defined in qemu 6.0+.
Basic support that boots, prints to the console, takes input from
console, and context switches.

TODO: interrupt support, timer support.
2021-06-06 19:38:45 -07:00
Travis Geiselbrecht
a0b166c33b [platform][tms570] remove stale platform
Never fully worked.
2021-05-30 18:14:15 -07:00