OEMs may want to override certain bio functions, hence mark
`open_block_device` and `open_async_block_device` as WEAK. This allows
OEMs to customize any of the bio functions
Forgot to expand the variable in the call to the TOBOOL function which
would cause the result to always be true. In this case always resulted
in the test code for these three modules to be included.
No real functional change except how the smaller ARCH_DEFAULT_PAGE_SIZE
is now computed and set in defines.h instead of rules.mk for arch/arm to
be consistent with the other arch that has a large/small build (riscv).
Not enabled by default, but if you want to use this one for now while
things are stabilized feel free. Going to move off astyle since this
seems to be superior now (wasn't always).
Also switched scripts/codestyle to use clang-format
ssize_t is annoying with formatting, since %zd doesn't really know how
to match it, so the usual strategy is to use %ld, since ssize_t is
always defined as a signed long on LK.
The platform_watchdog_ methods are optional features that the target
platform can choose to implement.
If they are implemented, then BootService.SetWatchdogTimer() would call
them to setup the hardware watchdog.
If they are not implemented (for example presubmit targets), then
BootService.SetWatchdogTimer() would test the WEAK symbol against a NULL
pointer and error out.
To use BootService.SetWatchdogTimer(), platforms can choose to either
implement platform_watchdog_init and platform_watchdog_set_enabled, or
override the entire BootService.SetWatchdogTimer() method.
GBL debug target will use GetVariable to get a variable called
gbl_debug. If the variable exists, it waits for the gdb to be started.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
GBL needs to read an UEFI variable called "gbl_debug".
We add 2 commands. "uefi_set_var" to set an UEFI variable. And
"uefi_list_var" to list the UEFI variables.
For GBL, we can use "uefi_set_var gbl_debug 1" to enable its
debug mode.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
The UEFI variable names are in UTF-16. We add several helper
functions to convert US-ASCII to UTF-16.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Add a new API to bio layer(read_async) where function will
return immediately, and a callback function will be called from
interrupt context, when block driver completes the IO request.
This allows OEMs to customize exactly how their memories are allocated.
For examples, OEMs might want to allocate certain parts of the UEFI
from high address kernel space, for ease of access in LK world.
Since UEFI spec requires everything to be identity mapped, the default
implementation of memory allocation is identity mapped.
This commit adds the functionality of generate EfiDebugImageInfo
while loading the image.
This feature is described in UEFI Spec 2.10. Section 18.4.3.
The implementation ensures support for hardware-assisted debugging and
provides a standardized mechanism for debuggers to discover the load
address of an EFI application.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
EfiDebugImageInfoTable is used to store EfiLoadedImage for
debug purpose. This commit adds the table to the EfiConfigurationTable.
This feature is described in UEFI Spec version 2.10. Section 18.4.
The implementation ensures support for hardware-assisted debugging and
provides a standardized mechanism for debuggers to discover and interact
with system-level debug resources.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Add EfiSystemTablePointer structure for remote debugger to locate
the address of EfiSystemTable.
This feature is described in UEFI SPEC version 2.10. Section 18.4.2.
The implementation ensures support for hardware-assisted debugging and
provides a standardized mechanism for debuggers to discover the EFI
system table.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Setting the vendor string makes us easier for testing the
SystemTablePointer. When we discover SystemTable we can check
if the vendor string is set with proper value.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
This is to prepare events API for interrupt based async block I/O,
in which case UEFI events will be signaled from block driver callback(in
in interrupt context).
Testing script works by reading output of subprocess and checking if
output matches expectation. To ensure that we can see output in timely
fashion, disable buffering.
According to `man 3 errno`:
```
The value of errno is never set to zero by any system
call or library function.
```
So we must set it to 0 ourselves before each `read` and `write` call to
ensure we don't get stuck in an error loop.
Since UEFI requires app to be run in physical address space,
we allocate memory that are identity mapped. Previous identity
mapping works as follows:
1. call vmm_alloc_contigious to obtain a VA1(virtual address) mapping to
PA1(physical address)
2. Use arch_mmu_query to obtain PA1 from VA1
3. arch_mmu_unmap VA1 <-> PA1
4. arch_mmu_map PA1 <-> PA1
Now we can return PA1 as a valid virtual address pointer, which is
mapped to physical memory. However, this has problems. LK allocates a
vmm_region_t struct for each call to vmm_alloc_* . This struct can
never be free'ed, as the associated virtual address VA1 is forever
lost. We can't even free PA1, as PA1 is not a valid argument to
vmm_free(PA1 does not have associated vmm_region_t struct).
The new approach uses pmm_alloc and vmm_reserve_space, allowing
vmm_free_region to be called.
This should cut down on the number of github builders, but having only
one per arch per toolchain per debug per ubsan. Still a lot, but working
on it.
Also means it automatically builds every project in the tree, instead of
just the curated list.
Clean up make targets list-arch and list-toolchain to be much faster and
work without needing to invoke the archtecture's arch rules.mk. This
should make it work on machines that do not have that particular
toolchain in the path.
This is setting up for using it in the github action script.