Commit graph

754 commits

Author SHA1 Message Date
Tony Wasserka ad636f7216 Modernize C++ usage (#144)
* Stratosphere: Use modern C++ idioms in some places

* algorithms like std::for_each are used instead of raw loops

* Stratosphere: Replace more raw loops with algorithms

* Stratosphere: Add a utility predicate function to test for equality with a reference element

This can be used to rewrite some common raw loops using algorithms instead

* fs.mitm: Use variant

* fs.mitm: Use enum class

* fs.mitm: Turn RomFSSourceInfo::Cleanup into a destructor

This obsoletes the need for a custom deleter in other places

* fs.mitm: Use enum class some more

* fs.mitm: Use unique_ptr

* fs.mitm: Simplify initialization

* Stratosphere: Simplify initialization

* fs.mitm: Use unique_ptr (fix memory leak along the way)

The previous code was using "delete" rather than "delete[]"

* fs.mitm: Use vector::emplace_back rather than push_back

emplace_back constructs elements in-place, hence avoiding a redundant element copy.

* Stratosphere: Replace more raw loops with algorithms

* Stratosphere: Use unique_ptr

* fs.mitm: Replace more raw loops with algorithms

* Stratosphere: Prefer move-construction over copy-construction when moving sink parameters around
2018-06-19 11:07:31 -07:00
hexkyz f1c326aec3
Merge pull request #147 from TheDgtl/fusee_stage2_patch_fix
Fix a few issues in the secondary kernel_patches.c file
2018-06-18 16:06:01 +01:00
Drakia a446aca2c4 Fix a few issues in the secondary kernel_patches.c file 2018-06-17 19:28:19 -07:00
hexkyz fca9ed2a15
Merge pull request #145 from Traiver/master
fusee: Add 4.1.0 kernel patch definitions
2018-06-17 16:56:36 +01:00
hexkyz f32f42e791
Merge pull request #141 from DavidBuchanan314/master
fusee: Add 3.0.0/3.0.1 kernel hash, corrected 4.x free_code_space_offset
2018-06-17 16:48:41 +01:00
Traiver 33af704ee2
Update kernel_patches.c 2018-06-17 15:54:06 +02:00
Traiver 57819fa345
Update kernel_patches.c 2018-06-17 14:02:08 +02:00
Traiver 0295c8a51d
Update kernel_patches.c 2018-06-17 12:38:57 +02:00
Traiver b211a7cf05
add kernel patches for 4.1.0 2018-06-17 11:00:42 +02:00
Michael Scire f41b780c0a PM: Fix remaining issues, now works properly again. 2018-06-15 00:47:07 -06:00
Michael Scire 4d36697080 Make PM Compile. Note: Currently broken. 2018-06-14 23:32:01 -06:00
Michael Scire c2d9ac8f5c fs.mitm: WIP LayeredFS impl (NOTE: UNUSABLE ATM)
Also greatly refactors libstratosphere, and does a lot of other things.
There is a lot of code in this one.
2018-06-14 17:51:18 -06:00
DavidBuchanan314 20a721a4a6 fusee: correct 4.x free_code_space_offset value 2018-06-13 22:26:00 +01:00
DavidBuchanan314 58d2f8f0a5 fusee: Add 3.0.0-3.0.1 kernel hash (and free_code_space_offset) 2018-06-13 22:08:18 +01:00
TuxSH 82b248aeac
Merge pull request #138 from desowin/sdmmc-frequency
Rework sdmmc clocking configuration
2018-06-13 17:31:19 +02:00
Michael Scire 237ff0d1e7 libstratosphere/fs.mitm: Push WIP support for Domains. Not yet fully working. 2018-06-12 16:01:04 -06:00
Tomasz Moń 206c10f333 Rework sdmmc clocking configuration
Use 204 MHz as host clock in SDR104 mode instead of 136 MHz.
Due to this, also change the frequency init divider so the
initialization frequency is below 400 kHz.
This makes the clocks for SDMMC1 in all modes to match the TRM table.

Make it clear in the code that HS200/HS400 modes in fact use PLLP_OUT0
and not PLLC4_OUT2_LJ like the comment suggest. In fact selecting the
PLLC4_OUT2_LJ as clock source results in freeze after switching to
HS200/HS400 mode. This is most likely related to the PLLC4 not being
enabled, but it should be checked later.

Set the HS200/HS400 divider to 3, as this is what the code really did
set prior to this change - so this commit does not change that.

Configure Legacy 12 MHz clock to run at 12 MHz using the SW default
configuration (as per TRM) for the SDMMC legacy timer.

Introduce initial version of sdmmc_host_clock_delay() in order to use it
in places where the wait is host clock dependent. The way it is
implemented now does not change the sleep that was used instead.
2018-06-12 17:20:15 +02:00
Max K d8c9399cff fusee: Run periodic autocal only on the uSD controller (#137) 2018-06-10 21:09:48 -07:00
Michael Scire 5c80016c81 fs.mitm: Add HANS-style redirection for System Data Archives. 2018-06-10 11:11:23 -06:00
hexkyz ceb93867b4
Merge pull request #132 from tslater2006/master
Add sdmmc_dump_regs function
2018-06-10 16:21:18 +01:00
hexkyz 80be253c1e
Merge pull request #134 from desowin/sdmmc-stage2
Fix race conditions and misconfiguration in sdmmc
2018-06-10 16:19:20 +01:00
Michael Scire 931e38742b fs.mitm: Fix sm^H^Hfshax 2018-06-10 03:12:34 -06:00
Michael Scire 3cbdf0b2b9 fs.mitm: Get Title ID on fsp-srv init, Add worker to handle subinterfaces. 2018-06-10 03:07:15 -06:00
misson20000 ec78fa5977 sm: add compile-time option to put a lower bound on session limits, which lets us do things like accessing fsp-ldr without killing ldr. (#136)
This time with style fixes.
2018-06-10 00:29:42 -07:00
Michael Scire 548903e3fb fs.mitm: Remove debugging test, fix postprocessing. 2018-06-10 01:19:29 -06:00
Michael Scire ff9412feef fs.mitm: Add hook for postprocessing mitm messages. 2018-06-10 01:17:00 -06:00
Michael Scire 40a6b7bb54 fs.mitm: Fix pointer buffer size passed to mitm'd commands 2018-06-09 19:36:01 -06:00
Michael Scire 6a58307d83 fs.mitm: Remove unnecessary permissions from json. 2018-06-09 19:34:25 -06:00
Michael Scire c1c211f542 fs.mitm: Implement basic passthrough framework for input commands. 2018-06-09 19:33:22 -06:00
Tomasz Moń 804a40830e Fix race conditions and misconfiguration in sdmmc
Properly configure pull up and pull down offsets for autocal.
Run autocal prior to every transfer.

Prevent race conditions in sdmmc_wait_for_event() - make sure the fault
handler has highest priority, then the target irq, state conditions and
finally the error mask.

Do not clear all bits (|=) when acknowledging fault conditions,
only acknowledge the fault conditions itself.

Enable interrupts before preparing command registers - if sdmmc is fast
enough it can actually finish transfer before we enabled the interrupts.
Enabling interrupts clears the COMMAND COMPLETE status bit.

Temporarily print all the sdmmc messages in stage2 - for yet unknown
reason respecting the log level results in some failures.

This results in working microsd card in stage2 on my switch with Samsung
EVO+ 256GB microsd card.
2018-06-09 17:37:53 +02:00
Timothy Slater a79d3454d8 Switched to mmc_debug, and use inttypes 2018-06-08 07:50:36 -05:00
misson20000 28d630a23e pm: add Atmosphere GetProcessHandle command to pm:dmnt (#133) 2018-06-07 23:32:45 -07:00
SciresM e964bcf872
Remove credit by request. 2018-06-07 20:55:57 -06:00
Tony Wasserka d55245a50d Add component overview to the readme (#131) 2018-06-07 15:57:09 -07:00
Timothy Slater 7df8ca7c4b use printf instead of printk for secondary 2018-06-07 13:05:41 -05:00
Timothy Slater ca907077af Add sdmmc_dump_regs function 2018-06-07 12:55:29 -05:00
TuxSH f5163fa35d
Merge pull request #126 from desowin/sdmmc-autocal
Make sdmmc autocalibration follow TRM procedure
2018-06-06 18:09:00 +02:00
Tomasz Moń 7b9dcd2f1a Make sdmmc autocalibration follow TRM procedure
Sleep for 1 us, not 1 ms.
Timeout after 10 ms, set driver strength code values according to TRM.

Fix typo (mS) - time is in milliseconds, not milliSiemens.
2018-06-05 19:07:14 +02:00
TuxSH 0491a21a99 Fix logic bug in stage2's main function 2018-06-05 16:18:02 +02:00
Max K 6b7da2887f package2 verification and ini1 merging fixes (#125)
* fusee: Incremet offset while reading kip1s

* fusee: Pass package2 section data along with the decrypted metadata
2018-06-04 14:04:44 -07:00
hexkyz ec164b8606
Fix credits 2018-06-04 19:31:08 +01:00
TuxSH b2139ed182 Pass screen status and mmc struct from stage1 to 2 2018-06-04 19:17:23 +02:00
hexkyz 116eb6c67c
Merge pull request #73 from Resaec/uart
Add UART register enumerators
2018-06-04 16:33:43 +01:00
hexkyz 7e5fda86b2
Merge pull request #114 from desowin/sdmmc-errata
Set SDMMC controller to SDR104 as a workaround
2018-06-04 16:20:19 +01:00
hexkyz bfaa618749
Merge pull request #121 from langerhans/lh/kernel-hash-4x
fusee: Add kernel hash for 4.x
2018-06-04 16:17:22 +01:00
Kate Temkin 810f7095a9
remove myself from the list of maintainers 2018-06-04 00:08:54 -06:00
TuxSH af8f63c187
Merge pull request #122 from neobrain/master
Build fix
2018-06-03 18:35:17 +02:00
Tony Wasserka 0359d6535b Build fix 2018-06-03 18:31:03 +02:00
langerhans 41429e9120 fusee: Add kernel hash for 4.x 2018-06-03 16:59:21 +02:00
Tony Wasserka edc099f026 Use "final" and "override" where appropriate (#117) 2018-06-02 22:46:27 -07:00