Commit Graph

2833 Commits

Author SHA1 Message Date
Kelvin Zhang
9fc4532ad7 [app][uefi] Imlement get_memory_map UEFI protocol 2024-11-06 10:12:16 -08:00
Kelvin Zhang
5ea19f1b0a [app][uefi] Setup skeleton for UEFI boot service 2024-11-06 10:12:16 -08:00
Kelvin Zhang
6b903f480c [git] Ignore common linux build files, update README 2024-11-06 10:12:15 -08:00
Travis Geiselbrecht
dbef9ff15d [platform][qemu-m68k] expand the bootinfo parsing code
Break into a separate .c file.
2024-09-07 15:13:20 -07:00
Travis Geiselbrecht
d9362e4dd5 [arch][arm] update stackusage script for python3
The old regexp needed to be updated to remove a warning.
2024-09-07 21:28:08 +00:00
Joshua Seaton
7538a6df67 [git] Sort .gitignore 2024-08-12 17:05:34 -07:00
Joshua Seaton
1b2c449ceb [scripts] Introduce scripts/fetch-toolchains.py
This change introduces $LK_ROOT/toolchain as an official installation
directory for toolchains, as well as a new script for conveniently
installing them there (versus manual GETs + untarring).

getting_started.md is updated to suggest its use.
2024-08-11 22:40:14 -07:00
Travis Geiselbrecht
6f24850de8 [dev][arm-generic-timer] print initialization configuration
This may be unsafe if the platform hasn't initialized a uart or console
by the time this is run. May need to revert or change this if it's an
issue.
2024-08-11 12:18:32 -07:00
Travis Geiselbrecht
84053e4cde [platform][qemu-virt-arm] move uart initialization first
It should be safe to do this since the uart does not use the gic or
timers. This will allow printing from the gic or timer driver.
2024-08-11 12:16:18 -07:00
Travis Geiselbrecht
fdf48a80c8 [scripts][do-qemuarm] add support for using HVF on mac
Detect if it's being run on a darwin host and try to use HVF if the -k
switch is passed.
2024-08-11 12:06:54 -07:00
Travis Geiselbrecht
80e36e4925 [platform][qemu-arm] switch to using the virtual timer interrupt
On mac qemu, trying to use the physical timer does not seem to work, but
really the virtual timer is what you should be using most of the time,
especially when running under emulation.
2024-08-11 12:01:39 -07:00
Travis Geiselbrecht
baaa474628 [console][help] dont print command blocks if no commands are available
When in crash mode, a lot of the commands are unavailable, so delay
printing the command block header until the first unmasked command is
printed.
2024-08-09 19:50:27 -07:00
Travis Geiselbrecht
a7116b18ed [docs] Update getting_started.md with new toolchain path 2024-08-09 19:46:39 -07:00
Joshua Seaton
f10d685722 [console] List commands alphabetically by name in normal mode
This change updates the `help` console command to list the available
commands alphabetically, but only when we're not panicking. This makes
`help`'s helping more helpful.
2024-08-09 19:41:54 -07:00
Travis Geiselbrecht
3579bf2545 [gitignore] add a few more files to .gitignore 2024-08-09 19:31:49 -07:00
Travis Geiselbrecht
e03d4196a3 [platform][halt] refactor the default halt/reboot/shutdown logic
Move common logic into a default routine in platform/power that other
platforms can reuse to implement the general default shutdown logic.
Add helper routines to print the cause.
Refactor the platforms that had substantial halt logic to reuse the
default implementation.
2024-08-09 19:30:20 -07:00
Travis Geiselbrecht
6fd2626359 [dev][uart][pl011] switch configuration to a structure
This should be a bit easier to deal with going forward.
2024-08-09 18:20:30 -07:00
Travis Geiselbrecht
21bc71d8a2 [dev][uart][pl011] add defines for the bits that are used 2024-08-09 18:05:35 -07:00
Travis Geiselbrecht
51bcea6525 [dev][uart][pl011] have the uart be data driven
Initialize the uart by passing in the base and irq, as well as a flag
specifying if it's the debug uart and should directly put data into the
console buffer (if present).
2024-08-09 18:05:35 -07:00
Travis Geiselbrecht
5fa540dd31 [dev][uart][pl011] first step moving pl011 driver out of qemu-virt-arm
No real functional change, but move the driver implementation out to a
separate place so it can be made to be platform independent.
2024-08-09 18:05:35 -07:00
Travis Geiselbrecht
b236992933 [github][ci] update CI build to ubuntu 24.04
Remove clang-13 from the build list, since it's not present in ubuntu
24.04.

If someone thinks this is an issue, please drop an email and we can see
about adding it back.
2024-08-09 17:57:43 -07:00
Travis Geiselbrecht
6ed970dbb0 [github][ci] bump gcc to 14.2.0 2024-08-09 17:42:45 -07:00
Joshua Seaton
410eaac0c2 [vscode] Update workspace file to better respect local style
This change updates lk.code-workspace to specify
* editor.detectIndentation as false, as otherwise that overrides
  the desired editor.tabSize setting.
* editor.insertSpaces as true, since spaces are preferred over tabs.
* editor.formatOnSave as false for C and C++ files, as - in the absence
  of a .clang-format file - the clangd extension is likely to default to
  choices that don't respect the local style.
2024-08-08 09:53:29 -07:00
Kelvin Zhang
87b7245a6b [github-ci] Add uefi_load unittest to github CI 2024-06-24 14:10:33 -07:00
Travis Geiselbrecht
d1f4b4a546 [target][banana pi f3] quick n dirty port to the bananapi f3 board
A decent 8 core riscv64 board with dual ethernet and 2 or 4GB ram.

Fairly easy to bring up on, though not a lot of docs at the moment.
2024-06-19 16:43:16 -07:00
Travis Geiselbrecht
bd423cad4d [lib][fdtwalk] skip scanning pci busses marked 'disabled' 2024-06-19 16:18:28 -07:00
Travis Geiselbrecht
e3a5f9c363 [lib][fdtwalk] fix some unfound bugs in the riscv isa string detection 2024-06-17 00:45:20 -07:00
Travis Geiselbrecht
e63c132f9c [dev][interrupt][plic] kick the max irqs to 256
Will need to figure out a cleaner way of doing this, but for now just
keep increasing the size.
2024-06-17 00:45:20 -07:00
Travis Geiselbrecht
69b8bccd76 [riscv] switch stimecmp/stimecmph registers to using the raw integer format
Though using the named nmemonics is a generally better idea it has the
unforunate property of not working on older compilers. In this case,
these new registers are for the Sstic extension, which is new enough
that even reasonably recent compilers as GCC 12.1 doesn't understand it.

Fixes issue #410
2024-06-16 22:37:10 -07:00
Travis Geiselbrecht
371a03357a [vscode] some recommended extensions 2024-06-16 22:37:10 -07:00
Travis Geiselbrecht
907d2d5579 [app][uefi] fix warning in uefi code 2024-06-16 22:37:10 -07:00
Travis Geiselbrecht
74864a56c0 [scripts][buildall] catch ctrl-c and abort the script 2024-06-14 15:35:58 -07:00
Travis Geiselbrecht
50b6f8c85c [include][compiler.h] fix a warning with gcc 2024-06-14 15:32:38 -07:00
Kelvin Zhang
07b80bf495 Add section loading and entry point execution to UEFI loader
This loads all sections specified by PE header at the correct memory
location, and executes the entry point function. Only the
OutputString function of text output protocol is implemented,
so the only application we can run is hello world.

Test: th
Bug: 294283461
Change-Id: I786bc8b7db9e1c0a6019b8fe4ba5a8c8ab4f2936
2024-06-14 15:26:15 -07:00
Kelvin Zhang
2e3c153a05 Add UEFI protocol headers
These headers define the API boundary between UEFI loader and
UEFI applications.

Test: th
Bug: 294283461
Change-Id: Idf064563bb033a8bf2b994261bcd77c0ed7aa2d8
2024-06-14 15:26:15 -07:00
Kelvin Zhang
c750ed0fa3 Add basic UEFI loader to lk
Thids adds a uefi_load <block dev name> command, which will
parse the PE header and do some basic validation checks.

Bug: 294283461
Test: uefi_load virtio0
Change-Id: I97393652526bda5be1b995e59647e239c64d31d6
2024-06-14 15:26:15 -07:00
Kelvin Zhang
4e9edd234f Fix missing apps section issue on clang
Clang linker would remove apps section even though variable
insied it are marked as "used". Per clang doc, we need to add
"retain" attribute to prevent section gc.

Bug: 294283461
Test: th
Change-Id: I5fc0aee885a419f314de811a2cf92b77af230c0c
2024-06-14 15:26:15 -07:00
Travis Geiselbrecht
c572b70083 [README] add links to point to arm64 toolchains 2024-06-14 14:34:44 -07:00
Travis Geiselbrecht
ea425e5473 [dev][gicv2] switch all of the register accessors to mmio_*
This fixes a bug when trying to start on qemu + kvm on an arm host.

A few minor fixes as suggested by clang tidy.
2024-06-04 20:28:03 -07:00
Travis Geiselbrecht
14bd7728a6 [arch][riscv][feature] add a few more feature bits
These may be useful in the future.
2024-06-02 15:31:30 -07:00
Travis Geiselbrecht
c4effaeef0 [arch][riscv] add SSTC extension support
Pretty simple extension, just directly set the supervisor timer compare
register (new) instead of calling through to SBI to set it for you.
2024-06-02 15:29:53 -07:00
Travis Geiselbrecht
b9c3603c59 [arch][riscv] fix typo matching against the zifencei feature 2024-06-02 14:51:53 -07:00
Travis Geiselbrecht
59f97195d4 [vscode] add a new (mostly empty) code workspace and a clang tidy file
The clang tidy file is mostly a copy of the fuchsia one, with a few
tweaks here and there.
2024-06-01 17:45:48 -07:00
Travis Geiselbrecht
566b25d1ec [arch][riscv] read the riscv feature string out of device tree
Also added initial implementation of a way to query run time features of
the cpu.
2024-06-01 17:21:01 -07:00
Travis Geiselbrecht
479f7fb9b7 Revert "[arch][arm64][mmio] add 'Z' to the mmio write accessor inline asm"
Sadly this doesn't really work in all situations and only happens to
work with gcc + binutils for 32bit accesses, presumably because gnu as
replaces a literal 0 with wzr.

Clang doesn't understand it at all.

This reverts commit 6c14941dec.
2024-06-01 14:59:53 -07:00
Travis Geiselbrecht
0e25214ed8 [README] update link to gcc 14.1 2024-05-28 22:07:04 -07:00
Travis Geiselbrecht
f99cc0f584 [project][fs] add partition sniffing code to the default fs virtual project 2024-05-25 16:22:12 -07:00
Travis Geiselbrecht
6c14941dec [arch][arm64][mmio] add 'Z' to the mmio write accessor inline asm
This allows the compiler to use the xzr register if writing a zero
value, instead of uselessly moving 0 into a register first.
2024-05-24 22:33:32 -07:00
Travis Geiselbrecht
7791ec047c [gitignore] ignore .cache directory
Seems to be where some clangd stuff is tossed.
2024-05-23 20:47:00 -07:00
Mike McTernan
e870c0b097 trusty: arm32: fix potential double fault when printing diagnostics
When dumping_mode_regs() on a fault, avoid printing the stack beyond the
current page.  This prevents exceeding the stack base and hitting a
guard page in the case the stack use is < 128 bytes.

Bug: 336957655
Test: crash test, observe double fault fixed
Change-Id: If49b5fe5e1651557d19bf18c4026224cfb038101
2024-05-23 20:47:00 -07:00