Commit graph

463 commits

Author SHA1 Message Date
Hector Martin
826bdb709c sysreg.py: Correct SPSR definition for AArch64 mode
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 20:05:54 +09:00
Hector Martin
4d64c33ca6 hv: Implement basic exception handling
Allows Python to handle hypervisor exceptions, and implements exception
info display and basic debug commands.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:36:23 +09:00
Hector Martin
b015dcf272 shell.py: Make usable as a module
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:35:19 +09:00
Hector Martin
315fcf36aa uartproxy: Add support for nested invocations
This allows the proxy to call back to Python for handling exceptions or
other events, passing reason information about why it was invoked and
returning normally when the exception has been handled.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:34:08 +09:00
Hector Martin
38b716c33c hv.py: Do not fail if ADT was already mutated
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:32:18 +09:00
Hector Martin
23c723003f sysreg.py: Move sysreg definitions here from proxyutils
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:31:41 +09:00
Hector Martin
35d564801a utils.py: Add Register class to handle register fields
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:26:41 +09:00
Hector Martin
4cc0f45c9d arm_cpu_regs.h: Add SYS_ESR_EL2
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:25:46 +09:00
Hector Martin
785dba33ad exception_asm: Fix missing register restores
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:24:52 +09:00
Hector Martin
a326aca956 hv: Enable physical timer for EL1 properly
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:23:35 +09:00
Hector Martin
23304719cd hv: Move VM code to hv_vm.c
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 15:38:17 +09:00
Hector Martin
2df4654555 hv.py: Disable secondary CPUs for now
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 01:52:58 +09:00
Hector Martin
95542a4619 kboot: Handle missing CPUs properly
This is necessary to boot Linux in UP mode if we're in EL1 and the HV
does not support SMP yet.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 01:52:58 +09:00
Hector Martin
948e507031 hv: Update ADT to fix SEPFW address and disable HV USB
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-03 21:30:30 +09:00
Hector Martin
9584e7d312 uartproxy: Add IODEV_WHOAMI feature to get current iodev
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-03 21:19:35 +09:00
Hector Martin
a3e50e8f44 proxy.py: Use the enum module for GUARD_/USAGE_/IODEV_
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-03 21:19:35 +09:00
Hector Martin
ec9221cf32 adt.py: Support serializing back to binary ADT
This should losslessly round-trip

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-03 21:19:15 +09:00
Hector Martin
7d18e8afb9 hv.py: Add missing file
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-03 21:18:57 +09:00
Hector Martin
1ae60ad715 hv: Beginnings of a hypervisor
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:21:33 +09:00
Hector Martin
1ff5b82aab iodev/usb: Do not crash if USB was not initialized
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:04:38 +09:00
Hector Martin
4547773edf setup.py: Remove unnecessary imports
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:04:01 +09:00
Hector Martin
63366e43d2 proxy.py: Fix typo
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:03:46 +09:00
Hector Martin
5fdeb1c3e3 chainload.py: Remove useless import
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:03:21 +09:00
Hector Martin
68156fd806 utils.h: Add alignment and field macros
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:02:49 +09:00
Hector Martin
8b1ea3f04d proxyutils: Make heap size configurable
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:02:25 +09:00
Hector Martin
2a1a04ea0d setup.py: Move baudrate auto setup to proxyutils
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:02:20 +09:00
Hector Martin
26c4ab3888 formatting: Sort main include first
clang-format is supposed to do this, but for some reason it's "sticky"
and doesn't...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 18:31:58 +09:00
Hector Martin
45a0054f63 Add build-time printf() argument checking and fix warnings
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 18:23:44 +09:00
Hector Martin
7c2dace0b0 chainload.py: Cleanup, move Mach-O loader to macho.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 15:16:02 +09:00
Hector Martin
a489a646bd Add tools for ARM sysreg database management
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 15:14:35 +09:00
Hector Martin
7bb490eb58 utils.py: New file for misc util functions (non proxy)
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 15:13:29 +09:00
Hector Martin
aaf4b2785b Rename utils.py -> proxyutils.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 15:13:06 +09:00
Hector Martin
882610b50e cpu_regs.h: s/SYS_APL/SYS_IMP_APL/ to match Linux
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-29 15:45:44 +09:00
Hector Martin
fcd103b2a4 proxy.py: Reopen port on reboot if necessary
This is needed for USB mode, as the device re-enumerates after a reboot.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-27 19:49:59 +09:00
Hector Martin
80f73926e8 proxy.py: Move M1N1DEVICE/UART port open logic into UartInterface
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-27 19:49:59 +09:00
Jean-Francois Bortolotti
82978081f8 chainload.py: Fix el1 support
Signed-off-by: Jean-Francois Bortolotti <jeff@borto.fr>
2021-04-18 02:29:32 +09:00
Hector Martin
c2e2094b95 usb_dwc3: Add missing space to product name string
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 19:10:41 +09:00
Hector Martin
f6297437c0 linux.py: Allow specifying a separate TTY device
This allows e.g. opening a TTY on the UART serial device after
booting the kernel via USB.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 18:12:59 +09:00
Hector Martin
7dfe24ee2c Rework kboot/chainload flow to shut down before calling the next stage
Next stage boots now exit back to main() after replying to the proxy
command, allowing shutdown functions to be called. Introduces a new
P_VECTOR proxy op, distinct from P_CALL. The Python side is reworked
to remain compatible with older versions that do not support this.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 18:12:59 +09:00
Hector Martin
bcece01769 usb: Hook up to iodev and bring up after payload boot attempt
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:47:43 +09:00
Hector Martin
4f7ae843fa usb_dwc3: Fix read/write transfer pumping, add missing funcs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:45:19 +09:00
Hector Martin
df9218582e usb_dwc3: Use new VID/PID
Not official yet, PR:
https://github.com/pidcodes/pidcodes.github.com/pull/635/files

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:45:19 +09:00
Hector Martin
108f104e96 usb_dwc3: USB compliance improvements
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:45:19 +09:00
Hector Martin
fcdf2aede9 smp: Print success message on CPU#0
SMP secondary prints only go to UART, so we need something on the main
CPU for other iodev consoles.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:45:19 +09:00
Hector Martin
34c1dc50ae iodev: Add iodev_handle_events() and iodev_console_flush()
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:45:19 +09:00
Hector Martin
d3957cc89d iodev: Fix error returns for iodev_read/write
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:45:19 +09:00
Hector Martin
565753980a iodev: Move primary core check into iodev, always use in_iodev logic
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:45:19 +09:00
Hector Martin
303118fd93 uartproxy: Convert to iodev
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:26:41 +09:00
Hector Martin
88e1612c09 uartproxy: s/CRCERR/CSUMERR/ and actually use it
It's not a CRC.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-17 16:25:48 +09:00
Hector Martin
8104ec02c4 iodev: Add proxy ops
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-15 23:18:57 +09:00