Fix multicore ntsc artifact on PI4

pull/306/head 09f43ff
IanSB 2022-11-27 22:48:25 +00:00
rodzic 1ef3ff8127
commit 09f43ff1e0
3 zmienionych plików z 39 dodań i 20 usunięć

Wyświetl plik

@ -520,12 +520,27 @@ donerpi0_1_c:
#ifdef USE_MULTICORE
.section ".text._init_core"
_init_core: //only called with multicore Pi models
#ifndef USE_MULTICORE_ON_PI2
bl _get_hardware_id
cmp r0, #_RPI2
ble skip_init //don't run on Pi 2, just fall into spin core instead
#if defined(RPI4)
ldr r1,=0xff842000
mov r2,#0
str r2,[r1] // disable GIC on rpi4
#endif
// On a Raspberry Pi 2 we enter in HYP mode, and need to force a switch to supervisor mode
//1. Set the CPACR for access to CP10 and CP11, and clear the ASEDIS and D32DIS bits:
ldr r0, =(0xf << 20)
mcr p15, 0, r0, c1, c0, 2
// 2. Set the FPEXC EN bit to enable the NEON MPE:
mov r0, #0x40000000
vmsr fpexc, r0
// if kernel_old=0 enter in HYP mode and need to force a switch to SVC mode
//
// for now we assume kernel_old=1 and don't execute this core
//
// The logs show:
// SVC mode: cpsr ends with 1d3
// HYP mode: cpsr ends with 1a3
mrs r0, cpsr
eor r0, r0, #CPSR_MODE_HYP
tst r0, #CPSR_MODE_MASK
@ -572,16 +587,6 @@ _init_continue:
msr cpsr_c, #(CPSR_MODE_SVR | CPSR_IRQ_INHIBIT | CPSR_FIQ_INHIBIT )
sub sp, r4, # C1_SVR_STACK
// Enable VFP ------------------------------------------------------------
//1. Set the CPACR for access to CP10 and CP11, and clear the ASEDIS and D32DIS bits:
ldr r0, =(0xf << 20)
mcr p15, 0, r0, c1, c0, 2
// 2. Set the FPEXC EN bit to enable the NEON MPE:
mov r0, #0x40000000
vmsr fpexc, r0
bl run_core
skip_init:
#endif

Wyświetl plik

@ -24,7 +24,7 @@
#define USE_MULTICORE
//#define USE_MULTICORE_ON_PI2
#define DONT_USE_MULTICORE_ON_PI2
// Define how the Pi Framebuffer is initialized
// - if defined, use the property interface (Channel 8)

Wyświetl plik

@ -2003,7 +2003,7 @@ return extra;
static void start_core(int core, func_ptr func) {
printf("starting core %d\r\n", core);
#ifdef RPI4
// *(unsigned int *)(0xff80008c + 0x10 * core) = (unsigned int) func;
*(unsigned int *)(0xff80008c + 0x10 * core) = (unsigned int) func;
#else
*(unsigned int *)(0x4000008c + 0x10 * core) = (unsigned int) func;
#endif
@ -3302,7 +3302,13 @@ void rgb_to_hdmi_main() {
set_scaling(get_scaling(), 2);
resolution_warning = 0;
clear = BIT_CLEAR;
if (_get_hardware_id() >= _RPI2) {
if (get_core_1_available() !=0) {
log_info("Second core available");
} else {
log_info("Second core NOT available");
}
}
while (1) {
log_info("-----------------------LOOP------------------------");
if (profile != last_profile || last_saved_config_number != saved_config_number) {
@ -3762,8 +3768,16 @@ void kernel_main(unsigned int r0, unsigned int r1, unsigned int atags)
printf("main running on core %u\r\n", _get_core());
for (i = 0; i < 10000000; i++);
#ifdef USE_MULTICORE
log_info("Starting core 1 at: %08X", _init_core);
start_core(1, _init_core);
#ifdef DONT_USE_MULTICORE_ON_PI2
if (_get_hardware_id() >= _RPI3 ) {
#else
if (_get_hardware_id() >= _RPI2 ) {
#endif
log_info("Starting core 1 at: %08X", _init_core);
start_core(1, _init_core);
} else {
start_core(1, _spin_core);
}
#else
start_core(1, _spin_core);
#endif