Commit Graph

230 Commits

Author SHA1 Message Date
Michael Scire
a292e95c2f Finish bootup_misc_mmio() - Cur build gets to end of pk2ldr. 2018-03-02 13:44:21 -08:00
Michael Scire
ca7b441079 Add call to se_generate_stored_vector() before validating 2018-03-02 12:59:12 -08:00
Michael Scire
3388198a26 Add coldboot mmio init (for non 4.x), required for FLOW writes to succeed. 2018-03-02 12:45:37 -08:00
Michael Scire
e7e62ef90b Implement half of bootup_misc_mmio() 2018-03-02 12:16:30 -08:00
Michael Scire
b3dbfd8ee0 Update pk2ldr outline, prepare for bootup_misc_mmio() impl 2018-03-02 11:28:05 -08:00
Michael Scire
303e189559 Implement a few TODOs with CAR driver. 2018-03-01 23:33:43 -08:00
Michael Scire
5f7308efd1 Implement Clock/Reset Driver. 2018-03-01 22:50:07 -08:00
TuxSH
cad9cdc6e0 Reintroduce unmap_* in package2.c 2018-03-02 07:33:47 +01:00
Michael Scire
78bee60485 Fix dangling comments 2018-03-01 21:24:22 -08:00
Michael Scire
7b6d15ec36 Fix up package2.c, current build makes it to the panic() on hardware 2018-03-01 21:15:19 -08:00
Michael Scire
2390df4d07 Fix start.s to pass reloc_list properly to package2ldr 2018-03-01 20:39:49 -08:00
Michael Scire
0a80a7caf5 Fix coldboot init, Exosphere makes it to PK2LDR in this commit. 2018-03-01 20:10:05 -08:00
TuxSH
63d0b08ac4 Rewrite relocation stuff 2018-03-02 02:47:19 +01:00
TuxSH
6903b20579 Fix wrong subsection name 2018-03-01 21:28:50 +01:00
TuxSH
82f10b4320 Implements missings parts of pk2ldr, refactor relocation a bit 2018-03-01 19:11:09 +01:00
TuxSH
568781bc7e Strongly validate SPL's buffer address 2018-03-01 12:35:02 +01:00
Michael Scire
9553c69c8f Properly detect PK21 master key rev. 2018-03-01 03:28:34 -08:00
Michael Scire
205d3b8b80 Fix PK2LDR bugs, Fix SE bugs 2018-03-01 03:25:12 -08:00
TuxSH
7850d3fd57 Put the loaded bootconfig in the evt page 2018-03-01 11:06:55 +01:00
Michael Scire
b67ce08f84 Fix Modulus Exponentiation in SE driver 2018-03-01 02:00:39 -08:00
Michael Scire
4025781f1c Make clear_bss work regardless of load address 2018-03-01 00:59:48 -08:00
TuxSH
1d621f3bf4 Fix tzram_map_all_segments 2018-03-01 02:36:16 +01:00
TuxSH
78b9698260 Finish writing coldboot_main 2018-03-01 01:40:09 +01:00
TuxSH
19dda5ed48 Can't copy to VAs if VA don't exist (at that point of the program) 2018-03-01 01:13:10 +01:00
TuxSH
e34d86b16f Fix the set_memory_registers_enable_mmu call 2018-03-01 00:05:18 +01:00
TuxSH
3d4dcdde13 Fix ttbl init pointer arith bug, other fixes 2018-02-28 23:35:30 +01:00
TuxSH
0a89831193 Clear bss at runtime like Nintendo actually does 2018-02-28 22:29:17 +01:00
TuxSH
303774aeb7 Use bic instead of and in finalize_powerdown 2018-02-28 20:01:42 +01:00
TuxSH
6be5b0a52f Implement flush_dcache_all_tzram_pa and invalidate_icache_all_inner_shareable_tzram_pa for the crt0s 2018-02-28 19:06:41 +01:00
TuxSH
e5f293e004 Implement and use set_memory_registers_enable_mmu 2018-02-28 13:32:18 +01:00
TuxSH
64c8612342 Fix wrongly named register in __set_memory_registers, add prototype 2018-02-28 07:32:14 +01:00
Michael Scire
c5b0639b8a Implement BootConfig. 2018-02-27 20:28:34 -08:00
Michael Scire
d0b74d7751 Panic Bright Red on failed master key detection. 2018-02-27 20:00:48 -08:00
Michael Scire
694872b4cc Fix decrypt_data_into_keyslot 2018-02-27 19:59:51 -08:00
Michael Scire
0508ee29d8 Clean up SE TODOs, implement GIC nonsecure init 2018-02-27 19:58:56 -08:00
Michael Scire
1463266190 Status callback keys have guaranteed atomicity from caller locks. 2018-02-27 19:50:31 -08:00
Michael Scire
66b3b3a706 Implement Panic() stub. 2018-02-27 19:43:07 -08:00
Michael Scire
fba3d1c2d9 Finish implementing Security Engine context save 2018-02-27 19:05:45 -08:00
Michael Scire
a8a2f8c3f6 Implement more SE context save functionality 2018-02-27 17:40:59 -08:00
TuxSH
93634d08e3 Implement __set_memory_registers 2018-02-28 02:37:08 +01:00
Michael Scire
924d469344 Implement the rest of smcCpuSuspend with skeleton SE API calls. 2018-02-27 17:07:30 -08:00
TuxSH
a90a431d61 Refactor save/restore_current_core_context, fix memory ordering issue with inline asm 2018-02-28 01:59:50 +01:00
Michael Scire
c18af9f3d2 Finish smcCpuOff 2018-02-27 16:35:35 -08:00
Michael Scire
7a9e031bff Uncomment more sleep/suspend code 2018-02-27 16:10:51 -08:00
Michael Scire
235b7b65e1 Uncomment BPMP firmware copy in LP0 2018-02-27 16:01:09 -08:00
Michael Scire
c2c6745f60 Implement save/restore current core context 2018-02-27 15:40:05 -08:00
Michael Scire
9a5bc05259 Fix missing titlekey revision assignment 2018-02-27 15:14:23 -08:00
TuxSH
602507ee8f Rename cache.s/.h to arm.s/.h 2018-02-27 22:29:47 +01:00
TuxSH
5bade9ee1c Use specs file, remove -nostartfiles 2018-02-27 20:14:12 +01:00
TuxSH
0258324872 Use provided __libc_init_array and __libc_fini_array, bugfixes 2018-02-27 16:10:56 +01:00
TuxSH
24b15dad40 Unstub lma2vma code 2018-02-27 13:26:51 +01:00
TuxSH
b0cb819b06 Add proper linkscript...
...adapted from @fincs' own linkscripts
2018-02-27 04:19:38 +01:00
Michael Scire
c4789a5a11 Skeleton smcCpuOff, fix building, fix smcConfigureCarveout 2018-02-26 17:41:31 -08:00
TuxSH
23e9a8369a Fix Makefile 2018-02-27 01:00:58 +01:00
TuxSH
9384546753 Adapt code to match last commit, link in bpmpfw_bin(_size) 2018-02-26 22:30:51 +01:00
TuxSH
984ade3ede
Merge pull request #58 from MerryMage/context_id-rename
Rename set_core_entrypoint_and_context_id
2018-02-26 22:26:46 +01:00
TuxSH
c7d83c6eb6 Rewrite the memory map-related code...
...other style fixes, etc.
2018-02-26 22:09:35 +01:00
MerryMage
3d40051146 Rename set_core_entrypoint_and_context_id 2018-02-26 17:11:49 +00:00
Michael Scire
bda9dcbe73 Start implementing smcCpuSuspend 2018-02-26 02:00:17 -08:00
TuxSH
18d0a81bd5
Merge pull request #51 from lioncash/const
memory_map: Remove unnecessary const
2018-02-26 10:26:58 +01:00
Mat M
1de6b336bb all: Make file-scope variables internally linked where applicable (#57)
Narrows the scope of visible symbols to where they're actually used. Also
makes it easier to see true globals in source files
(ones used from multiple translation units)
2018-02-26 00:42:21 -08:00
Mat M
c94cfe4898 lock: Use stdatomic.h (#56)
Provides the same assembly output while using the standardized interface

e.g.

0000000000000000 <set_priv_smc_in_progress>:
   0:   90000000    adrp    x0, 0 <set_priv_smc_in_progress>
   4:   91000000    add x0, x0, #0x0
   8:   52800022    mov w2, #0x1                    // #1
   c:   d503201f    nop
  10:   085ffc01    ldaxrb  w1, [x0]
  14:   08037c02    stxrb   w3, w2, [x0]
  18:   35ffffc3    cbnz    w3, 10 <set_priv_smc_in_progress+0x10>
  1c:   72001c3f    tst w1, #0xff
  20:   54ffff81    b.ne    10 <set_priv_smc_in_progress+0x10>  // b.any
  24:   d65f03c0    ret
2018-02-25 22:59:48 -08:00
Mat M
461105a501 fuse: simplify checks in fuse_get_reserved_odm and fuse_get_spare_bit (#54)
A separate variable isn't particularly necessary here, and given that the type
is unsigned, we only need to test the upper bound.

This also resolves two -Wtype-limits warnings
2018-02-25 21:23:31 -08:00
Mat M
fff3912c81 mc: Remove dead code in get_carveout_by_id (#52) 2018-02-25 21:13:07 -08:00
Mat M
991d4f1355 se: Remove memset in se_perform_aes_block_operation (#53)
We can just initialize the array to be zeroed out. This is safer and less error-prone,
since the initializer is now associated with the variable directly, making it
impossible to put code relying on the zeroed out state before it (unlike with memset).
2018-02-25 21:12:49 -08:00
Lioncash
b328effd9b
memory_map: Remove unnecessary const
Since the return value isn't a pointer thing doesn't have much use.
2018-02-25 23:56:47 -05:00
TuxSH
4d3f1f6ae8 Remove built files that somehow got here 2018-02-25 22:36:32 +01:00
TuxSH
969b781a68 Failed attempt to fix loops not being unrolled, other fixes. 2018-02-25 21:41:16 +01:00
TuxSH
b0ea9c1a0b Move source files to src/, add Makefile, fix all build and linkage errors, etc. 2018-02-25 20:00:50 +01:00
TuxSH
4c7aa566f0 Fix user page mmu mapping and naming scheme 2018-02-25 15:12:49 +01:00
TuxSH
ab38217720 Fix mmu descriptor mistakes 2018-02-25 14:37:44 +01:00
Michael Scire
c46a3cc794 Map userpage in at appropriate address (TODO: Invalidate TLB) 2018-02-25 01:31:45 -08:00
Michael Scire
78c8fe36fe Fix read64le 2018-02-25 01:26:40 -08:00
Michael Scire
82b4c6763d Implement getters for fuse values, fill out smcGetConfig 2018-02-25 01:21:52 -08:00
TuxSH
b0079e404d Clear pk2ldr in coldboot_main 2018-02-25 03:54:28 +01:00
TuxSH
a00e68e94a Write a significant chunk of coldboot init...
...merge start.cold.s and start.warm.s, other changes, etc.
2018-02-25 03:34:15 +01:00
TuxSH
be67169390
Merge pull request #50 from lioncash/error
memory_map: Fix most compilation issues
2018-02-25 00:14:50 +01:00
Mat M
a081c93094 bootconfig/configitem: Fix includes and identifiers (#49) 2018-02-24 12:46:57 -08:00
Lioncash
a34813bcf4
memory_map: Fix most compilation issues 2018-02-24 15:38:48 -05:00
Mike H
f6008d947d
More previously unknown fuses 2018-02-24 18:48:11 +00:00
Mike H
3929ba77e6
Adding FUSE_RESERVED_SW 2018-02-24 18:34:49 +00:00
hexkyz
e2d45878c3 Preliminary Exosphere FUSE driver 2018-02-24 18:15:47 +00:00
TuxSH
cc4f6f7f84 Introduce memory_map.h 2018-02-24 17:22:55 +01:00
Michael Scire
ed5850ebbf Implement se_trigger_interrupt, fix up some configitems 2018-02-24 07:25:38 -08:00
Michael Scire
e8b1e0b965 Implement exception vectors. 2018-02-24 07:06:29 -08:00
Michael Scire
422cd14aac Implement driver for the GIC-400. 2018-02-24 05:33:16 -08:00
Michael Scire
c94fe287cb Exosphere I2C Driver. 2018-02-24 04:27:34 -08:00
Michael Scire
672d76cb31 Fix I2C success mask 2018-02-24 04:27:34 -08:00
Mat M
56f5b56235 smc_user: Correct cache_flush to flush_dcache_range (#48)
cache_flush is a non-existent function
2018-02-23 20:38:21 -08:00
Mat M
44a2b7a344 smc_user: Add missing gcm.h include (#47)
Resolves an implicit declaration warning for gcm_decrypt_key
2018-02-23 16:09:55 -08:00
Mat M
e3897bb731 se: Add missing string.h include (#46)
Resolves implicit declaration warnings for memcpy and memset
2018-02-23 16:09:44 -08:00
Mat M
34d8a859ab timers: Fix identifier name in wait's spin-lock (#45)
Also resolves implicit definition warnings for wait by including the necessary header where applicable
2018-02-23 16:09:34 -08:00
Michael Scire
dbf2eb7ed1 Clean up BPMPFW I2C prototypes.
Prototypes for internal functions shouldn't be in shared headers.
2018-02-23 12:07:02 -08:00
TuxSH
0a0a1b088d
Merge pull request #43 from lioncash/prototype
i2c: Fix -Wmissing-prototypes warnings
2018-02-23 19:18:46 +01:00
Lioncash
b4229f0fa8
mmu: Remove phys_addr parameter from mmu_unmap_range
It's unused
2018-02-23 09:25:21 -05:00
Lioncash
296b43744c
i2c: Fix -Wmissing-prototypes warnings 2018-02-23 09:19:32 -05:00
TuxSH
8e4a5bf32b
Merge pull request #17 from lioncash/include
Add missing string.h includes
2018-02-23 14:51:27 +01:00
TuxSH
dd3498a356
Merge pull request #27 from lioncash/param
mmu: Fix compilation issues
2018-02-23 14:50:54 +01:00
Mat M
9dfa6e2732 start.cold/warm: Correct MSR instructions (#42)
The second operand needs to be an immediate
2018-02-23 05:46:06 -08:00
Mat M
7b1fa3a8f0 start.cold/warm.s: Correct DSB instruction instances (#41)
DSB requires that the barrier option be specified
2018-02-23 05:42:55 -08:00