Commit graph

593 commits

Author SHA1 Message Date
Hector Martin
b5cbf7360e exception: handle PMC FIQs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-18 17:55:55 +09:00
Hector Martin
cf640de6db utils.h: add BIT() macro
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-18 17:55:55 +09:00
Hector Martin
17aca31498 utils.h: move reg_{clr,set,mask} here from chickens.c
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-18 17:55:55 +09:00
Hector Martin
86a7d9c0f3 cpu_regs.h: s/SYS_/SYS_APL_/
This synchronizes the register naming convention with Linux

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-18 17:55:55 +09:00
Sven Peter
f3eed1c7d7 MMU: correctly map MMIO/PCIe ranges
Previously all MMIO was mapped twice with different attributes
which may or may not lead to strange behaviour when the same
physical range is accessed from both mappings.

We now have a better idea which ranges require nGnRE and nGnRnE
and can just do it correctly instead.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-02-18 16:16:55 +09:00
Sebastian Gräßl
ed0bd4aebc tooling: Add container setup for build environment
Signed-off-by: Sebastian Gräßl <mail@bastilian.me>
2021-02-18 16:14:15 +09:00
Sven Peter
870fead39c proxyclient: add ops for writeread{8,16,32,64}
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-02-18 16:12:28 +09:00
Sven Peter
1ccf2e2af5 utils.h: add writeread{8,16,32,64}
These functions all perform a store direcly followed by a load.
This is useful to e.g. useful to find busy bits which might
already be cleared a few cycles after a write.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-02-18 16:12:28 +09:00
Sven Peter
24938db17a MMU: use alle2 instead of vmalls12e1is to invalidate TLBs
I can't remember why I used vmalls12e1is but this leads to
the following bug:

  1. Load m1n1 with normal MMU setup
  2. Disable all mappings, recompile and chainload to that m1n1
  3. Everything will work fine for a while even though it should explode
     when enabling the MMU.

This happens becuse there are still stale TLB entries in some cache.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-02-15 01:37:39 +09:00
Khoa Hoang
2789b6f3e0 proxyclient: add input support for tty mode
Use miniterm from pyserial for tty passthrough mode

Signed-off-by: Khoa Hoang <admin@khoahoang.com>
2021-02-13 02:48:58 +09:00
Hector Martin
d46d51d7ed exception: fix vtimer FIQ masking
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-11 01:35:23 +09:00
Hector Martin
207767472b Add find_all_regs.py (brute-force system regs)
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-11 00:56:19 +09:00
Hector Martin
063b9a1d27 exception: Add GUARD_SILENT feature to suppress logs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-11 00:55:59 +09:00
Hector Martin
c1b9ef89b5 utils.py: guard mrs/msr/etc
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-11 00:55:59 +09:00
Hector Martin
7d3dd54441 utils.py: replace manual reg list with a full dump
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-11 00:55:59 +09:00
Hector Martin
eab71ee92b fb, kboot: handle Retina flag correctly
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 22:27:45 +09:00
Hector Martin
1eab053781 README.md: update with build instructions & payload stuff
Closes: #16

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
5dbc82a9ee payload: add support for booting in-line payloads
Usage:

$ cat m1n1.macho Image.gz apple-j274.dtb initramfs.gz \
    > m1n1-payload.macho

That's it.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
ec59b0d2c7 chainload: do proper Mach-O parsing
This is required for payloads to work properly

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
93bad96311 minilzlib: fix support for non-CRC32 checksum types
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
61e2c36ef5 tinf, minzllib: support unknown input sizes
This can be used when the input file size is unknown: the decompression
functions will keep track of it and return it to the caller instead.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
0cd328214c exception: handle all 4 available timer FIQs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
d12ac86448 utils.py: add more timer registers
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
5fbb25942d Makefile: disable -Wmultichar
minlzma uses multi-character constants

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
1bb05d056f linux.py: Fix and simplify argument count handling
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
5aff13c404 proxy: add missing SPDX header
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
5e5627cd0b clang-format: Add include block configs, reformat
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Janne Grunau
57c4ddd00d linux.py: add support for setting boot arguments
Signed-off-by: Janne Grunau <j@jannau.net>
2021-02-06 12:16:04 +09:00
Janne Grunau
214173ba51 linux.py: support xz compressed payload
3 second faster load and uncompress time for small kernel
(5.6M uncompressed, 2.1M gz and 1.6M xz). Compression method is
autodetect by the filename suffix or can be set by the '--compression'
command line option.
Also supports uncompressed payloads (no auto detection).

Signed-off-by: Janne Grunau <j@jannau.net>
2021-02-06 12:16:04 +09:00
Janne Grunau
128368751c linux.py: use argparse and pathlib
Signed-off-by: Janne Grunau <j@jannau.net>
2021-02-06 12:16:04 +09:00
liv
9019ccf4ab readme: Fix typo
Signed-off-by: lv <~@l1v.in>
2021-02-06 12:14:40 +09:00
Ariel Machado
476182e1f8 utils.h: Fix 'asm-operand-widths' warnings with clang
Signed-off-by: Ariel Machado <ariel@fe.up.pt>
2021-02-06 12:13:29 +09:00
Witold Baryluk
62db38ae91 Fix #! and exec bits for scripts
Signed-off-by: Witold Baryluk <witold.baryluk@gmail.com>
2021-02-06 12:01:15 +09:00
Hector Martin
8691fcee8a kboot: fix fb debug print
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 03:49:20 +09:00
Hector Martin
5970824491 utils.py: add more ID registers
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
19f915b779 aic_test.py: more experiments
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
60665a2ee2 linux.py: spin up secondaries
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
234a511e35 kboot: add spin-table and SMP support
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
aaab2c6ca1 chickens: set WFI mode to clockgate only
This preserves CPU registers.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
64e6595f64 dts update for new kernel
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
e35ef6eb8c smp: fix IRQs on secondary CPUs
Seems one of the registers is some kind of system-level CPU spinup flag,
without which the CPU runs but the rest of the system thinks it's still
dead.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Hector Martin
cb7e7f7918 exception.c: print MPIDR with IRQs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-05 02:58:08 +09:00
Iris Johnson
7fc52bc799 Fix broken hexdumps in proxy.py
Proxy.py has a few typos that appear if you try to use debug mode and dump a region of memory. This should fix those.

Signed-off-by: Iris Johnson <iris@modwiz.com>
2021-02-05 02:57:36 +09:00
Hector Martin
4c999733da setup.py: restore timeout properly after the baudrate guesswork
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-03 04:52:17 +09:00
Hector Martin
053f2edbc3 proxyclient: handle baud rate switching properly for non-Glasgow UARTs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-03 03:51:41 +09:00
Hector Martin
96d133e854 mmu: map device memory as non-executable
This fixes the random SErrors after returning from a page fault. Turns
out the M1 was randomly deciding to speculate an instruction fetch from
address 0, triggering a fabric error.

Quoting the ARM ARM:

"Hardware does not prevent speculative instruction fetches from a memory
location with any of the Device memory attributes unless the memory
location is also marked as Execute-never for all Exception levels.

This means that to prevent speculative instruction fetches from memory
locations with Device memory attributes, any location that is assigned
any Device memory type must also be marked as execute-never for all
Exception levels. Failure to mark a memory location with any Device
memory attribute as execute-never for all Exception levels is a
programming error."

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-31 13:42:48 +09:00
Hector Martin
b65e2ca0e4 mmu: also set up high-VA translation
Just an alias

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
f247643fe6 chainload.py: shut down mmu and flush caches when chainloading
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
2d5fb878f8 Makefile: build for armv8.2-a
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
b2ef461114 get rid of another warning pragma
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00