Commit Graph

2356 Commits

Author SHA1 Message Date
Michael Bishop
4e54f0fedc [timer] make periodic timers more accurate 2021-11-12 19:31:27 -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
9de18e0828 [lib][acpi_lite] get acpi_lite building and working
Didn't require much work to port to LK, since the zircon kernel is
fairly close.

Issue #310
2021-11-11 00:16:40 -08:00
Travis Geiselbrecht
7d95b64e7e [lib][acpi_lite] import from fuchsia repository
Import verbatim at fuchsia repository at commit 645dbffdfbf52f72491187a1c59af1a677e3dd00
which is the initial commit before it was more excessively converted to
fuchsia style C++.

Issue #310
2021-11-11 00:08:33 -08:00
Travis Geiselbrecht
1550939102 [libc][inittypes] add entry for PRIxPTR 2021-11-11 00:03:39 -08:00
Travis Geiselbrecht
dbd1b6d903 [kernel][C++] add some simple C++ wrapper and RAII holders for various locks
Just a wrapper around mutex and spinlock for now.
2021-11-10 22:57:07 -08:00
Travis Geiselbrecht
98ca62d1e8 [build] c++filt the dump and size map as well 2021-11-10 01:35:32 -08:00
Travis Geiselbrecht
552606651c [lib][console] include stdalign.h and use alignof/alignas
Instead of manually calling out the alignment to a void *, use alignas
to the real type.
2021-11-09 23:29:20 -08:00
Travis Geiselbrecht
b4e6747a62 [compiler.h] add __USED to all __SECTION entries
This keeps the compiler from eliding things that are explicitly placed
in particular sections that it thinks aren't used.
2021-11-09 23:29:20 -08:00
Mark Hill
31efe5fa5e Fix module.mk to use the correct include flag
--include is not a real gcc flag. Maybe it exists for other compilers
or I'm just bad at reading docs though.

Anyway, now that this uses the expected gcc flag, `ccache` works when
added to this build system. Without this, `ccache` thinks there's
multiple input files and refuses to cache results. Now, it works and has
a great hit rate.
2021-11-09 22:36:26 -08:00
Travis Geiselbrecht
0257ac8c1f [dev][pcnet32] get the pcnet32 driver building and working again
Not enabled by default since it uses the experimental driver api and
depends on lwip. But, builds and works if selected.
2021-11-09 00:44:55 -08:00
Travis Geiselbrecht
6fec0cb2bf [scripts][x86] spiff up the qemu x86 script to handle a virtio disk and net device 2021-11-09 00:29:57 -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
Travis Geiselbrecht
75eaa5c489 [app][warnings] fix -Wmissing-declarations warnings in app/ 2021-10-21 23:16:57 -07:00
Travis Geiselbrecht
fcb65c9a88 [dev/lib][warnings] fix -Wmissing-declarations warnings in dev/ and lib/ 2021-10-21 23:16:20 -07:00
Travis Geiselbrecht
a895bcece5 [kernel][warnings] fix a few -Wmissing-declarations warnings in the kernel 2021-10-21 23:14:27 -07:00
Travis Geiselbrecht
a6ddffd80b [arch][warnings] fix -Wmissing-declarations warnings 2021-10-21 23:08:38 -07:00
Travis Geiselbrecht
1e88a6c354 [build] add commented out -Wmissing-declarations
This is a useful warning to have on, but keep it off for now since there
are a ton of warnings here, and probably in external projects that use
LK.

CLs incoming to fix the most egregious warning violations this uncovers.
2021-10-21 23:05:24 -07:00
Travis Geiselbrecht
699842fad2 [dev][usb] fix a few unchecked mallocs and add some comments
A few routines had unchecked mallocs. One was unused, so remove it but
add fallback code for the rest of them.
2021-10-20 22:12:05 -07:00
Travis Geiselbrecht
daf1d671b5 [arch][arm-m] fix the pendsv handler for leaving a misaligned stack
The pendsv_ asm handler has been pushing 9 words on the stack prior to
calling into C code. This violates the ABI which requires 8 byte
alignment. It has worked mostly fine and thus hasn't been caught before.

Add an extra bump of the stack to align it after pushing the registers.
2021-10-17 23:01:37 -07:00
Travis Geiselbrecht
11a39f545b [arch][arm] add debug asserts to the non SMP spinlock routines
This should assert that the spinlock is not already held when acquiring
and vice-versa and that interrupts are disabled.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
e7c42e22ce [arch][arm-m] Fix a bug with a mismatched acquire/release of the thread lock
Release the thread lock before context switching to a thread that was
preempted and thus not holding the thread lock. Add a few asserts to
make sure this invariant is maintained in the context switch and PENDSV
handler.

This has never mattered before because the thread lock (and other
spinlocks) were not being tested for validity on by definition single
processor cortex-m systems. After adding some code to test the
spinlocks' values this discrepancy was uncovered.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
392dd18cfc [external][ARM][CMSIS] save a copy of the CMSIS patch
Save a formatted patch of the last commit to help reapplying in the
future.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
4e25fdd11b [external][ARM][CMSIS] reapply the systick patch to cmsis
SysTick_Config() tries to set the systick priority to max. Comment out
this line since arch/arm/arm-m/arch.c sets the priority to medium to
compete with the rest of the exceptions in the system.

Also include lk/compiler.h to avoid redundant cmsis macros.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
a0b27a955a [external][ARM][CMSIS] update to cmsis 5.3.2
Taken from https://github.com/ARM-software/CMSIS_5/tree/develop/CMSIS/Core/Include

End of line changed in this patch from DOS to unix so the change looks
larger than it is. View without whitespace diffs to get a cleaner look.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
189c0e8cd4 [target][stm32f7-discovery] update the openocd script
Use a newer name for the stlink.cfg file.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
d836b07279 [console] add a panic time alternate version of the thread list
This works if the thread lock is held at panic time to keep it from
recursing.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
9d2d6feffb [arch][arm64] add cache flush by way/set
Pulled code from Fuchsia to implement way/set cache flush for arm64.

Issue #307
2021-09-29 23:22:25 -07:00
Michael Bishop
d1787042f7 [arch][arm] improve arm chainload
arch_mmu_map was failing hard, because the identity mapping does not fall within the `vmm_get_kernel_aspace`

this creates a new aspace covering the loader, so it can identity map

linux is also unable to use the FPU if lazy FPU context switching had turned it off prior to the chainload, `arm_fpu_set_enable()` is used to turn it back on
2021-09-18 17:14:55 -07:00
Travis Geiselbrecht
cf14bb4fc0 [github][CI] revise the CI builder script
Switch to a more proper matrix. Build each of the projects in a list
with DEBUG=0 and DEBUG=2 and with two versions of the toolchain (7.5.0
and 11.2.0).

Sets things up to be easier to run things like unit tests in a later
patch.
2021-09-18 16:53:52 -07:00
Travis Geiselbrecht
6973ff8bee [build][arch] have arm, arm64, and x86 resort to a default toolchain
Previously if they couldn't find the toolchain they would full stop the
build. Change to print a warning and then go with the default prefix.

Hopefully this doesn't break anyone downstream but it's helpful for the
CI builder which wants to read from the build system which toolchain to
grab prior to having it in the path.
2021-09-18 16:52:38 -07:00
Travis Geiselbrecht
ddd7cba04d [build] add a few pseudo targets to assist with building
list-arch and list-toolchain will compute and print the architecture and
toolchain needed to build the project the build is set to.

Used by the CI builder to decide what toolchain to grab.
2021-09-18 16:51:15 -07:00
Travis Geiselbrecht
20af129a81 [lib][fs] error code for null from malloc 2021-09-18 14:39:59 -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
77fa084cd0 [warnings][gcc 11] Fix a few annoying out of bounds pointer warnings
It seems to be in the case of a string op against a raw address, the
compiler decides the destination object is 0 bytes long and throws a
particular warning. Work around it by not using memcpy in one case and
by disabling the warning in the other.

Both are fairly benign code that basically operates in a hard coded way
that knows the destination buffer is valid.
2021-06-27 00:31:01 -07:00
Travis Geiselbrecht
476b750102 [kernel][ports] double the size of the port message on 64bit hosts
It seems the initial port packet size was sized to hold two words for a
32bit machine. In the 64bit case double the size from 8 bytes to 16.
2021-06-27 00:30:58 -07:00
Travis Geiselbrecht
4b508cecc9 [arch][m68k] use a jsr in the initial start routine to main
It's non ideal, since there's no relaxation done in the linker so we
have to assume the branch target is > 16 bits away and do what the
compiler usually does and emit a full 32bit jsr.
2021-06-11 21:34:34 -07:00
Travis Geiselbrecht
bd12570f3c [arch][m68k] fix and optimize interrupt disable/enable/restore
Mostly rewrote to be cleaner and more obvious what it's doing, but turns
out the real problem was a lack of "memory" and/or volatile. In one of
the test cases the compiler was rearranging the arch_ints_disabled()
check.
2021-06-11 21:14:22 -07:00
Travis Geiselbrecht
0d721ca245 [arch][m68k] add idle loop 2021-06-11 21:13:56 -07:00
Travis Geiselbrecht
adf64f2e88 [github][ci] add qemu-virt-m68k-test to the build matrix 2021-06-07 02:44:22 -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
893b894dd5 [README] fix some formatting on the top level
Guess I need to read the docs on this particular flavor of markup.
2021-06-04 13:25:52 -07:00
Jorge Troncoso
685f557c18 [arch][arm64] unmask_interrupt needs the same numbers as register_int_handler
Signed-off-by: Jorge Troncoso <jatron@users.noreply.github.com>
2021-06-03 18:52:26 -07:00
Travis Geiselbrecht
a0b166c33b [platform][tms570] remove stale platform
Never fully worked.
2021-05-30 18:14:15 -07:00
Travis Geiselbrecht
e3d90834ae [README]
Update the top level readme with a bit more information and a pointer into the docs folder.
2021-05-29 16:58:11 -07:00
Travis Geiselbrecht
7c6cdb9f1d [docs][todo] start a todo file in a new docs folder 2021-05-29 16:46:43 -07:00