File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -45,24 +45,26 @@ static void print_hv_banner(void);
45
45
static uint16_t get_pcpu_id_from_lapic_id (uint32_t lapic_id );
46
46
static uint64_t start_tsc __attribute__((__section__ (".bss_noinit" )));
47
47
48
- static void init_percpu_lapic_id (void )
48
+ static bool init_percpu_lapic_id (void )
49
49
{
50
50
uint16_t i ;
51
51
uint16_t pcpu_num ;
52
52
uint32_t lapic_id_array [CONFIG_MAX_PCPU_NUM ];
53
+ bool success = false;
53
54
54
55
/* Save all lapic_id detected via parse_mdt in lapic_id_array */
55
56
pcpu_num = parse_madt (lapic_id_array );
56
- if (pcpu_num == 0U ) {
57
- /* failed to get the physcial cpu number */
58
- panic ("failed to get the physcial cpu number" );
59
- }
60
57
61
- phys_cpu_num = pcpu_num ;
58
+ if (pcpu_num != 0U ) {
59
+ phys_cpu_num = pcpu_num ;
62
60
63
- for (i = 0U ; (i < pcpu_num ) && (i < CONFIG_MAX_PCPU_NUM ); i ++ ) {
64
- per_cpu (lapic_id , i ) = lapic_id_array [i ];
61
+ for (i = 0U ; (i < pcpu_num ) && (i < CONFIG_MAX_PCPU_NUM ); i ++ ) {
62
+ per_cpu (lapic_id , i ) = lapic_id_array [i ];
63
+ }
64
+ success = true;
65
65
}
66
+
67
+ return success ;
66
68
}
67
69
68
70
static void pcpu_set_current_state (uint16_t pcpu_id , enum pcpu_boot_state state )
@@ -132,7 +134,9 @@ void init_pcpu_pre(uint16_t pcpu_id_args)
132
134
133
135
early_init_lapic ();
134
136
135
- init_percpu_lapic_id ();
137
+ if (!init_percpu_lapic_id ()) {
138
+ panic ("failed to init_percpu_lapic_id!" );
139
+ }
136
140
137
141
ret = init_ioapic_id_info ();
138
142
if (ret != 0 ) {
You can’t perform that action at this time.
0 commit comments