2315 Commits

Author SHA1 Message Date
Travis Geiselbrecht
804de7cec2 WIP telnetd 2022-03-19 14:46:01 -07:00
Travis Geiselbrecht
8b81805b0e WIP start of IRC app 2022-03-19 14:46:01 -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
9caf62273c [lib][minip] start of TCP connect state machine
A few miscellaneous tweaks outside of that.
2022-03-19 14:43:55 -07:00
Travis Geiselbrecht
dc09bac586 [lib][elf] tweak to a printf to be more useful 2022-03-13 13:49:28 -07:00
Travis Geiselbrecht
ce9f4f6db2 [arch][riscv] using a new trick utilize real instructions to zero fpu state
Previously was hard coding the instructions to work around a limitation
of the assembler that did not allow using fpu instructions when the code
was being compiled without support. Move the zeroing routine into a
separate assembly file and override the architure at the top.
2022-03-12 17:39:00 -08:00
Travis Geiselbrecht
4bd6de50b0 [scripts][do-qemux86] add a few more virtio devices and tweaks 2022-02-27 19:37:48 -08:00
Travis Geiselbrecht
e555db5bda [bus][pci] at least register that MSIX is available
Doesn't yet have support for it, but set the bool and remember it was
present when scanning devices.
2022-02-27 19:36:59 -08:00
Pedro Falcato
a9a631152f [fdtwalk] Fix a bug in #address-cells parsing
Fixes issue #314
2022-02-13 14:00:22 -08: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
8ed7d0fc70 [scripts][make-parallel] add uname cases for netbsd and openbsd as well 2022-02-10 22:48:14 -08:00
Travis Geiselbrecht
3db7e86b59 [arch][arm64] save the boot arg registers (x0-x3) in a temporary spot in the boot path
Much of the start.S path avoids using these registers up until now to
avoid trashing any state, but its getting fairly difficult and error
prone to keep this up. Save the args as soon as its known that its the
boot cpu in a temporary place prior to calling lk_main. Wastes 32 bytes
of memory but should be more solid.
2022-02-10 22:34:02 -08:00
Travis Geiselbrecht
e2cda72095 [arch][arm64] tweak the arm64_elX_to_el1 routine to avoid using x0-x3
It's called immediately upon entering the kernel entry vector, prior
to knowing if it's the boot cpu or needing to save any boot arguments,
so avoid using these registers
2022-02-10 22:34:02 -08:00
Wencheng Yang
fbb838d1f8 [arch][x86] left shift 32 bits rather 31 bits to construct msr value 2022-02-09 12:22:30 -08:00
Travis Geiselbrecht
979cebecf2 [bus][pci] Make sure there's a fallback range in release mode 2022-02-06 20:50:24 -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
d5f394859d [bus][pci] first stab at assigning bus numbers to unconfigured bridges
Had to rearrange the proble logic somewhat, but now the bus manager will
assign consequtive bus numbers as it finds bridges and recursively
drills down to discover the entire bus structure.

Does not assign resources yet, but need to do this in the first pass
to find all of the devices before can figure out how much space they
occupy.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
ba21aa9236 [bus][pci] quick hack to not dive into bridges that appear unconfigured
This fixes an infinite recursion where it was stepped into bridge a
bridge that has the secondary bus set to 0, which caused it to start
over and probe bus 0 until it blew the stack.

Better fix is to actually assign busses.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
07f847e38a [bus][pci] add accessors for bridge ranges and print on dump 2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
95443413e8 [bus][pci] break the bus manager file into separate cpp files per object
No functional change aside from rearranging things.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
5e92f0adf7 [bus][pci] move the bus manager code into a subdir 2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
ef8d252a8a [bus][pci] load BARs for bridges as well
Dump them in the pci dump
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
ef67d619a5 [bus][pci] load bars for devices even if their address is 0
Probe the size first, and if that turns up anything, mark the bar as
valid, even if the address is set to 0. The address can be configured in
a later pass of the bus manager.

Also print the bars on boot.
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
0679f91b9a [dev][net][e1000] only build with platforms with the VM enabled 2022-02-06 16:30:47 -08:00
Travis Geiselbrecht
2205aa54dc [dev][e1000] fail to start if the pci bars have not been configured 2022-02-06 15:58:28 -08:00
thomas
a7d2752b28 [kernel][vm] try the next arena if current is out of free pages 2022-01-26 12:16:53 -08:00
Travis Geiselbrecht
278c551821 [dev][pci] read and cache BAR sizes at probe time
Since probing the size of a BAR requires writing and reading back from
the address field, do it at probe time and cache the data instead of at
api time. This should avoid fouling up any mmio transactions in flight.
2022-01-11 01:24:17 -08:00
Travis Geiselbrecht
f3a337789c [dev][e1000] add an atomic counter to number the e1000s found 2022-01-11 00:15:10 -08:00
Travis Geiselbrecht
18330c5948 [arch][x86] start of cpu detection and feature detection 2022-01-09 18:20:14 -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
9d94fac5e3 [minip][dhcp] convert the dhcp utility into a C++ class
Mostly jsut a consolidation of what was already an object oriented
piece of code.
2021-12-31 20:37:40 -08:00
Travis Geiselbrecht
9e80081ea6 [minip] fix warning in new changes
Building with -Werror locally.
2021-12-31 20:37:40 -08:00
Travis Geiselbrecht
35da2d1260 [minip][dhcp] spiff up the state machine to handle more edge cases
-Add TAP option to scripts/qemux86
2021-12-31 17:23:57 -08:00
Travis Geiselbrecht
0617d6c845 [scripts][do-qemux86] add ability to set the network driver 2021-12-27 22:24:31 -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
b5a9c2d8b2 [lib][minip] a few fixes
-Add C++ header guards around the public api.
-Fix a divide by zero bug in the test console routine.
-Add a new pktbuf api to assist with resetting a pktbuf back to default
values for reuse in an ethernet driver.
2021-12-27 22:24:31 -08:00
Travis Geiselbrecht
06105c5835 [lib][minip] fix a bug in the dhcp code
Minor bug where it would get the mac address out of sync with what the
hardware really has.
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
522e62f648 [arch][x86][mmu] squelch an extraneous printf 2021-12-27 22:24:31 -08:00
Travis Geiselbrecht
be6169820d [kernel][vm] Move the VM postheap init hook back one step
This is a cheesy solution to adding another top level hook, which really
should be done.
2021-12-27 22:24:31 -08:00
Travis Geiselbrecht
b74a4e33d4 [lib][cpp] add a auto_call class
useful for calling routines at the exit of a function.
2021-12-27 19:49:14 -08:00
Travis Geiselbrecht
fa9a0a0683 [lib][cpp] add a type_traits header
mostly for std::move and friends.
2021-12-27 19:49:09 -08:00
Travis Geiselbrecht
dd438d2f1f [arch][test][mmu] add a simple test case to map a page and query the restult
Currently x86 fails the test but arm64 and riscv pass.
2021-12-05 23:24:04 -08:00
Travis Geiselbrecht
a01c181ea7 [arch][arm64] fix setting of UXN and PXN bits for NX permission
Previously would only set both UXN and PXN for no execute pages, but for
pages not marked no execute, neither bit was set. Change to mask out the
other privilege mode.
2021-12-05 23:22:54 -08:00
Travis Geiselbrecht
1a54b73e84 [arch][x86] don't set the G bit on inner page table entries
This is ignored on Intel cpus, but triggers a page fault on AMD cores.
2021-11-21 02:08:58 -08:00
Travis Geiselbrecht
a47cf76f14 [scripts][do-qemuarm] hard disable network if not selected
Turns out qemu was putting a e1000 nic on the PCI bus if no options were
selected. No reason to do so if the network is explicitly not called
for.
2021-11-20 17:42:41 -08:00