I have managed to launch haiku uefi on opensuse:
qemu-system-arm -bios /usr/share/qemu/qemu-uefi-aarch32.bin -M virt -cpu cortex-a7 -m 1024 -cdrom haiku-mmc.image --device ramfb -serial stdio
And Now the kernel is launched, showing the gray icons:
And I have add the test code as @X512 mentioned showing the blue screen, now it freezed when setup pl011 uart device.
ArchUARTPL011::InitEarly()
{
// Perform special hardware UART configuration
Barrier();
// ** Loopback test
uint32 cr = PL01x_CR_UARTEN;
// Enable UART
cr |= PL011_CR_TXE;
// Enable TX
cr |= PL011_CR_LBE;
// Enable Loopback mode
Out32(PL011_CR, cr);
And the qemu report a invalid address accessed, it will break. I have checked the qemu virt machine, the pl011 reg addres is 0x09000000, same as the init process
gArchDebugUART = arch_get_uart_pl011(0x9000000, 0x16e3600);
And I have checked the different code for pl011, and I found little kernel is the most simple: https://github.com/littlekernel/lk/blob/master/platform/qemu-virt-arm/include/platform/qemu-virt.h
#if ARCH_ARM64`Preformatted text`
#define PERIPHERAL_BASE_VIRT (0xffffffffc0000000ULL) // -1GB
#else
#define PERIPHERAL_BASE_VIRT (0xc0000000UL) // -1GB
#endif
/* individual peripherals in this mapping */
#define FLASH_BASE_VIRT (PERIPHERAL_BASE_VIRT + 0)
#define FLASH_SIZE (0x08000000)
#define CPUPRIV_BASE_VIRT (PERIPHERAL_BASE_VIRT + 0x08000000)
#define CPUPRIV_BASE_PHYS (PERIPHERAL_BASE_PHYS + 0x08000000)
#define CPUPRIV_SIZE (0x00020000)
#define UART_BASE (PERIPHERAL_BASE_VIRT + 0x09000000)
when I tried it with:
gArchDebugUART = arch_get_uart_pl011(0xC9000000, 0x16e3600);
it will not meet the segment, but it will hang when reading from reg:
while (In32(PL01x_FR) & PL01x_FR_BUSY)
Barrier();
That’s all about pl011.
maybe we have the different peripherals memory map for setting up registers. Some one could give some valid message?