mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-09 21:51:45 +00:00
fusee: execute more ccplex boot code out of iram
This commit is contained in:
parent
dcfd01cf59
commit
6b3a3ecb44
4 changed files with 24 additions and 16 deletions
|
@ -14,15 +14,15 @@ PHDRS
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
main : ORIGIN = 0xF0000000, LENGTH = 0x10000000
|
main : ORIGIN = 0xF0000000, LENGTH = 0x10000000
|
||||||
high_iram : ORIGIN = 0x40010000, LENGTH = 0x20000
|
high_iram : ORIGIN = 0x40010000, LENGTH = 0x8000
|
||||||
low_iram : ORIGIN = 0x40003000, LENGTH = 0x8000
|
low_iram : ORIGIN = 0x40003000, LENGTH = 0x8000
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
PROVIDE(__start__ = 0xF0000000);
|
PROVIDE(__start__ = 0xF0000000);
|
||||||
PROVIDE(__stack_top__ = 0x90020000);
|
PROVIDE(__stack_top__ = 0x40020000);
|
||||||
PROVIDE(__stack_bottom__ = 0x90010000);
|
PROVIDE(__stack_bottom__ = 0x40018000);
|
||||||
PROVIDE(__heap_start__ = 0x90020000);
|
PROVIDE(__heap_start__ = 0x90020000);
|
||||||
PROVIDE(__heap_end__ = 0xA0020000);
|
PROVIDE(__heap_end__ = 0xA0020000);
|
||||||
|
|
||||||
|
|
|
@ -82,19 +82,26 @@ static void cluster_enable_power(uint32_t regulator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool cluster_is_partition_powered(volatile tegra_pmc_t *pmc, uint32_t status) {
|
||||||
|
return (pmc->pwrgate_status & status) == status;
|
||||||
|
}
|
||||||
|
|
||||||
static void cluster_pmc_enable_partition(uint32_t part, uint32_t toggle) {
|
static void cluster_pmc_enable_partition(uint32_t part, uint32_t toggle) {
|
||||||
volatile tegra_pmc_t *pmc = pmc_get_regs();
|
volatile tegra_pmc_t *pmc = pmc_get_regs();
|
||||||
|
const uint32_t status = (toggle << part);
|
||||||
|
|
||||||
/* Check if the partition has already been turned on. */
|
/* Check if the partition has already been turned on. */
|
||||||
if (pmc->pwrgate_status & (toggle << part)) {
|
if (cluster_is_partition_powered(pmc, status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t i = 5001;
|
int timeout = 5000;
|
||||||
while (pmc->pwrgate_toggle & 0x100) {
|
while (true) {
|
||||||
|
if ((pmc->pwrgate_toggle & 0x100) == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
udelay(1);
|
udelay(1);
|
||||||
i--;
|
if ((--timeout) < 0) {
|
||||||
if (i < 1) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,14 +109,15 @@ static void cluster_pmc_enable_partition(uint32_t part, uint32_t toggle) {
|
||||||
/* Turn the partition on. */
|
/* Turn the partition on. */
|
||||||
pmc->pwrgate_toggle = (part | 0x100);
|
pmc->pwrgate_toggle = (part | 0x100);
|
||||||
|
|
||||||
i = 5001;
|
timeout = 5000;
|
||||||
while (i > 0) {
|
while (true) {
|
||||||
/* Check if the partition has already been turned on. */
|
if (cluster_is_partition_powered(pmc, status)) {
|
||||||
if (pmc->pwrgate_status & (toggle << part)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
udelay(1);
|
udelay(1);
|
||||||
i--;
|
if ((--timeout) < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -35,14 +35,14 @@ static bool is_soc_mariko() {
|
||||||
|
|
||||||
void nxboot_finish(uint32_t boot_memaddr) {
|
void nxboot_finish(uint32_t boot_memaddr) {
|
||||||
bool is_mariko = is_soc_mariko();
|
bool is_mariko = is_soc_mariko();
|
||||||
|
|
||||||
/* Boot up Exosphère. */
|
/* Boot up Exosphère. */
|
||||||
MAILBOX_NX_BOOTLOADER_IS_SECMON_AWAKE = 0;
|
MAILBOX_NX_BOOTLOADER_IS_SECMON_AWAKE = 0;
|
||||||
MAILBOX_NX_BOOTLOADER_SETUP_STATE = NX_BOOTLOADER_STATE_DRAM_INITIALIZED_4X;
|
MAILBOX_NX_BOOTLOADER_SETUP_STATE = NX_BOOTLOADER_STATE_DRAM_INITIALIZED_4X;
|
||||||
|
|
||||||
/* Terminate the display. */
|
/* Terminate the display. */
|
||||||
display_end();
|
display_end();
|
||||||
|
|
||||||
if (is_mariko) {
|
if (is_mariko) {
|
||||||
/* Boot CPU0. */
|
/* Boot CPU0. */
|
||||||
cluster_boot_cpu0(boot_memaddr);
|
cluster_boot_cpu0(boot_memaddr);
|
||||||
|
|
Loading…
Reference in a new issue