2018-03-07 20:57:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
|
|
*
|
2018-05-26 01:49:13 +08:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2018-03-07 20:57:14 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <hypervisor.h>
|
|
|
|
|
|
|
|
int interrupt_init(uint32_t cpu_id)
|
|
|
|
{
|
|
|
|
struct host_idt_descriptor *idtd = &HOST_IDTR;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
set_idt(idtd);
|
|
|
|
|
|
|
|
status = init_lapic(cpu_id);
|
|
|
|
ASSERT(status == 0, "lapic init failed");
|
|
|
|
if (status != 0)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
status = init_default_irqs(cpu_id);
|
|
|
|
ASSERT(status == 0, "irqs init failed");
|
|
|
|
if (status != 0)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2018-03-20 03:49:46 +08:00
|
|
|
#ifndef CONFIG_EFI_STUB
|
2018-03-07 20:57:14 +08:00
|
|
|
CPU_IRQ_ENABLE();
|
2018-03-20 03:49:46 +08:00
|
|
|
#endif
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|