hv: replace improper use of ASSERT with panic for parse_madt

ASSERT could be used in some situations, such as, there are some pre-assumption
for some code, using ASSERT here for debug. It could not be used for detect error
when system booting where panic should be used.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Li, Fei1 2019-01-30 20:04:16 +08:00 committed by wenlingz
parent 9291fbe4d6
commit 5214a60bbf
2 changed files with 9 additions and 7 deletions

View File

@ -39,7 +39,7 @@ static void init_percpu_lapic_id(void)
pcpu_num = parse_madt(lapic_id_array); pcpu_num = parse_madt(lapic_id_array);
if (pcpu_num == 0U) { if (pcpu_num == 0U) {
/* failed to get the physcial cpu number */ /* failed to get the physcial cpu number */
ASSERT(false); panic("failed to get the physcial cpu number");
} }
phys_cpu_num = pcpu_num; phys_cpu_num = pcpu_num;

View File

@ -248,15 +248,17 @@ local_parse_madt(struct acpi_table_madt *madt, uint32_t lapic_id_array[CONFIG_MA
/* The lapic_id info gotten from madt will be returned in lapic_id_array */ /* The lapic_id info gotten from madt will be returned in lapic_id_array */
uint16_t parse_madt(uint32_t lapic_id_array[CONFIG_MAX_PCPU_NUM]) uint16_t parse_madt(uint32_t lapic_id_array[CONFIG_MAX_PCPU_NUM])
{ {
struct acpi_table_madt *madt; uint16_t ret = 0U;
acpi_rsdp = get_rsdp(); acpi_rsdp = get_rsdp();
ASSERT(acpi_rsdp != NULL, "fail to get rsdp"); if (acpi_rsdp != NULL) {
struct acpi_table_madt *madt = (struct acpi_table_madt *)get_acpi_tbl(ACPI_SIG_MADT);
if (madt != NULL) {
ret = local_parse_madt(madt, lapic_id_array);
}
}
madt = (struct acpi_table_madt *)get_acpi_tbl(ACPI_SIG_MADT); return ret;
ASSERT(madt != NULL, "fail to get madt");
return local_parse_madt(madt, lapic_id_array);
} }
void *get_dmar_table(void) void *get_dmar_table(void)