File tree Expand file tree Collapse file tree 6 files changed +26
-9
lines changed Expand file tree Collapse file tree 6 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 26
26
#include <cat.h>
27
27
#include <vboot.h>
28
28
#include <sgx.h>
29
+ #include <uart16550.h>
29
30
30
31
#define CPU_UP_TIMEOUT 100U /* millisecond */
31
32
#define CPU_DOWN_TIMEOUT 100U /* millisecond */
@@ -106,6 +107,14 @@ void init_pcpu_pre(bool is_bsp)
106
107
/* Clear BSS */
107
108
(void )memset (& ld_bss_start , 0U , (size_t )(& ld_bss_end - & ld_bss_start ));
108
109
110
+ (void )parse_hv_cmdline ();
111
+ /*
112
+ * WARNNING: here assume that vaddr2paddr is identical mapping.
113
+ * Enable UART as early as possible.
114
+ * Then we could use printf for debugging on early boot stage.
115
+ */
116
+ uart16550_init (true);
117
+
109
118
/* Get CPU capabilities thru CPUID, including the physical address bit
110
119
* limit which is required for initializing paging.
111
120
*/
Original file line number Diff line number Diff line change @@ -26,8 +26,6 @@ static void init_depri_boot(void)
26
26
struct multiboot_info * mbi = NULL ;
27
27
28
28
if (!depri_initialized ) {
29
- (void )parse_hv_cmdline ();
30
-
31
29
mbi = (struct multiboot_info * ) hpa2hva (((uint64_t )(uint32_t )boot_regs [1 ]));
32
30
if ((mbi == NULL ) || ((mbi -> mi_flags & MULTIBOOT_INFO_HAS_DRIVES ) == 0U )) {
33
31
pr_err ("no multiboot drivers for depri_boot found" );
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ uint16_t console_vmid = ACRN_INVALID_VMID;
24
24
25
25
void console_init (void )
26
26
{
27
- uart16550_init ();
27
+ uart16550_init (false );
28
28
}
29
29
30
30
void console_putc (const char * ch )
Original file line number Diff line number Diff line change @@ -131,23 +131,24 @@ static void uart16550_set_baud_rate(uint32_t baud_rate)
131
131
uart16550_write_reg (uart , temp_reg , UART16550_LCR );
132
132
}
133
133
134
- void uart16550_init (void )
134
+ void uart16550_init (bool eraly_boot )
135
135
{
136
136
if (!uart .enabled ) {
137
137
return ;
138
138
}
139
139
140
+ if (!eraly_boot && !uart .serial_port_mapped ) {
141
+ hv_access_memory_region_update ((uint64_t )uart .mmio_base_vaddr , PDE_SIZE );
142
+ return ;
143
+ }
144
+
140
145
/* if configure serial PCI BDF, get its base MMIO address */
141
146
if (!uart .serial_port_mapped ) {
142
147
serial_pci_bdf .value = get_pci_bdf_value (pci_bdf_info );
143
148
uart .mmio_base_vaddr =
144
149
hpa2hva (pci_pdev_read_cfg (serial_pci_bdf , pci_bar_offset (0 ), 4U ) & PCIM_BAR_MEM_BASE );
145
150
}
146
151
147
- if (!uart .serial_port_mapped ) {
148
- hv_access_memory_region_update ((uint64_t )uart .mmio_base_vaddr , PDE_SIZE );
149
- }
150
-
151
152
spinlock_init (& uart .rx_lock );
152
153
spinlock_init (& uart .tx_lock );
153
154
/* Enable TX and RX FIFOs */
Original file line number Diff line number Diff line change 127
127
/* UART oscillator clock */
128
128
#define UART_CLOCK_RATE 1843200U /* 1.8432 MHz */
129
129
130
- void uart16550_init (void );
130
+ void uart16550_init (bool early_boot );
131
131
char uart16550_getc (void );
132
132
size_t uart16550_puts (const char * buf , uint32_t len );
133
133
void uart16550_set_property (bool enabled , bool port_mapped , uint64_t base_addr );
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+
7
+ #include <types.h>
8
+
9
+ void uart16550_init (__unused bool early_boot ) {}
You can’t perform that action at this time.
0 commit comments