Skip to content

Commit 1bb7f61

Browse files
philmdpm215
authored andcommitted
tests/qtest/boot-serial-test: Initialize PL011 Control register
The tests using the PL011 UART of the virt and raspi machines weren't properly enabling the UART and its transmitter previous to sending characters. Follow the PL011 manual initialization recommendation by setting the proper bits of the control register. Update the ASM code prefixing: *UART_CTRL = UART_ENABLE | TX_ENABLE; to: while (true) { *UART_DATA = 'T'; } Note, since commit 51b61dd ("hw/char/pl011: Warn when using disabled transmitter") incomplete PL011 initialization can be logged using the '-d guest_errors' command line option. Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Peter Maydell <[email protected]>
1 parent 80b8b01 commit 1bb7f61

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/qtest/boot-serial-test.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,20 @@ static const uint8_t kernel_plml605[] = {
7070
};
7171

7272
static const uint8_t bios_raspi2[] = {
73-
0x08, 0x30, 0x9f, 0xe5, /* ldr r3, [pc, #8] Get &UART0 */
73+
0x10, 0x30, 0x9f, 0xe5, /* ldr r3, [pc, #16] Get &UART0 */
74+
0x10, 0x20, 0x9f, 0xe5, /* ldr r2, [pc, #16] Get &CR */
75+
0xb0, 0x23, 0xc3, 0xe1, /* strh r2, [r3, #48] Set CR */
7476
0x54, 0x20, 0xa0, 0xe3, /* mov r2, #'T' */
7577
0x00, 0x20, 0xc3, 0xe5, /* loop: strb r2, [r3] *TXDAT = 'T' */
7678
0xff, 0xff, 0xff, 0xea, /* b -4 (loop) */
7779
0x00, 0x10, 0x20, 0x3f, /* UART0: 0x3f201000 */
80+
0x01, 0x01, 0x00, 0x00, /* CR: 0x101 = UARTEN|TXE */
7881
};
7982

8083
static const uint8_t kernel_aarch64[] = {
8184
0x02, 0x20, 0xa1, 0xd2, /* mov x2, #0x9000000 Load UART0 */
85+
0x21, 0x20, 0x80, 0x52, /* mov w1, 0x101 CR = UARTEN|TXE */
86+
0x41, 0x60, 0x00, 0x79, /* strh w1, [x2, #48] Set CR */
8287
0x81, 0x0a, 0x80, 0x52, /* mov w1, #'T' */
8388
0x41, 0x00, 0x00, 0x39, /* loop: strb w1, [x2] *TXDAT = 'T' */
8489
0xff, 0xff, 0xff, 0x17, /* b -4 (loop) */

0 commit comments

Comments
 (0)