mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
HV: refine acpi rsdp initialize interface
In previous code, the rsdp initialization is done in get_rsdp() api implicitly. The function is called multiple times in following acpi table parsing functions and the condition (rsdp == NULL) need to be added in each parsing function. This is not needed since the panic would occur if rsdp is NULL when do acpi initialization. Tracked-On: #5626 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
parent
59de88d6bc
commit
ff1f6bc975
@ -148,6 +148,7 @@ void init_pcpu_pre(bool is_bsp)
|
|||||||
|
|
||||||
early_init_lapic();
|
early_init_lapic();
|
||||||
|
|
||||||
|
init_acpi();
|
||||||
#ifdef CONFIG_ACPI_PARSE_ENABLED
|
#ifdef CONFIG_ACPI_PARSE_ENABLED
|
||||||
ret = acpi_fixup();
|
ret = acpi_fixup();
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
@ -63,13 +63,14 @@ static struct acpi_table_rsdp *found_rsdp(char *base, uint64_t length)
|
|||||||
* If it is NULL, the hypervisor can't be booted
|
* If it is NULL, the hypervisor can't be booted
|
||||||
*/
|
*/
|
||||||
static struct acpi_table_rsdp *get_rsdp(void)
|
static struct acpi_table_rsdp *get_rsdp(void)
|
||||||
|
{
|
||||||
|
return acpi_rsdp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_acpi(void)
|
||||||
{
|
{
|
||||||
struct acpi_table_rsdp *rsdp = NULL;
|
struct acpi_table_rsdp *rsdp = NULL;
|
||||||
|
|
||||||
/* If acpi_rsdp is already parsed, it will be returned directly */
|
|
||||||
if (acpi_rsdp != NULL) {
|
|
||||||
rsdp = acpi_rsdp;
|
|
||||||
} else {
|
|
||||||
rsdp = (struct acpi_table_rsdp *)(get_acrn_multiboot_info()->mi_acpi_rsdp_va);
|
rsdp = (struct acpi_table_rsdp *)(get_acrn_multiboot_info()->mi_acpi_rsdp_va);
|
||||||
if (rsdp == NULL) {
|
if (rsdp == NULL) {
|
||||||
uint16_t *addr;
|
uint16_t *addr;
|
||||||
@ -106,10 +107,6 @@ static struct acpi_table_rsdp *get_rsdp(void)
|
|||||||
|
|
||||||
/* After RSDP is parsed, it will be assigned to acpi_rsdp */
|
/* After RSDP is parsed, it will be assigned to acpi_rsdp */
|
||||||
acpi_rsdp = rsdp;
|
acpi_rsdp = rsdp;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return rsdp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool probe_table(uint64_t address, const char *signature)
|
static bool probe_table(uint64_t address, const char *signature)
|
||||||
@ -213,16 +210,11 @@ local_parse_madt(struct acpi_table_madt *madt, uint32_t lapic_id_array[MAX_PCPU_
|
|||||||
uint16_t parse_madt(uint32_t lapic_id_array[MAX_PCPU_NUM])
|
uint16_t parse_madt(uint32_t lapic_id_array[MAX_PCPU_NUM])
|
||||||
{
|
{
|
||||||
uint16_t ret = 0U;
|
uint16_t ret = 0U;
|
||||||
struct acpi_table_rsdp *rsdp = NULL;
|
|
||||||
|
|
||||||
rsdp = get_rsdp();
|
|
||||||
if (rsdp != NULL) {
|
|
||||||
struct acpi_table_madt *madt = (struct acpi_table_madt *)get_acpi_tbl(ACPI_SIG_MADT);
|
struct acpi_table_madt *madt = (struct acpi_table_madt *)get_acpi_tbl(ACPI_SIG_MADT);
|
||||||
|
|
||||||
if (madt != NULL) {
|
if (madt != NULL) {
|
||||||
ret = local_parse_madt(madt, lapic_id_array);
|
ret = local_parse_madt(madt, lapic_id_array);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -232,10 +224,7 @@ uint8_t parse_madt_ioapic(struct ioapic_info *ioapic_id_array)
|
|||||||
uint8_t ioapic_idx = 0U;
|
uint8_t ioapic_idx = 0U;
|
||||||
uint64_t entry, end;
|
uint64_t entry, end;
|
||||||
const struct acpi_madt_ioapic *ioapic;
|
const struct acpi_madt_ioapic *ioapic;
|
||||||
const struct acpi_table_madt *madt;
|
const struct acpi_table_madt *madt = (const struct acpi_table_madt *)get_acpi_tbl(ACPI_SIG_MADT);
|
||||||
|
|
||||||
if (get_rsdp() != NULL) {
|
|
||||||
madt = (const struct acpi_table_madt *)get_acpi_tbl(ACPI_SIG_MADT);
|
|
||||||
|
|
||||||
if (madt != NULL) {
|
if (madt != NULL) {
|
||||||
end = (uint64_t)madt + madt->header.length;
|
end = (uint64_t)madt + madt->header.length;
|
||||||
@ -253,7 +242,6 @@ uint8_t parse_madt_ioapic(struct ioapic_info *ioapic_id_array)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ioapic_idx;
|
return ioapic_idx;
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,7 @@ struct acpi_table_tpm2 {
|
|||||||
uint32_t start_method;
|
uint32_t start_method;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
void init_acpi(void);
|
||||||
void *get_acpi_tbl(const char *signature);
|
void *get_acpi_tbl(const char *signature);
|
||||||
|
|
||||||
struct ioapic_info;
|
struct ioapic_info;
|
||||||
|
Loading…
Reference in New Issue
Block a user