mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
🆕 HPET驱动
This commit is contained in:
@ -27,9 +27,9 @@ void apic_io_apic_init()
|
||||
acpi_iter_SDT(acpi_get_MADT, &madt_addr);
|
||||
madt = (struct acpi_Multiple_APIC_Description_Table_t *)madt_addr;
|
||||
|
||||
//kdebug("MADT->local intr controller addr=%#018lx", madt->Local_Interrupt_Controller_Address);
|
||||
//kdebug("MADT->length= %d bytes", madt->header.Length);
|
||||
// 寻找io apic的ICS
|
||||
// kdebug("MADT->local intr controller addr=%#018lx", madt->Local_Interrupt_Controller_Address);
|
||||
// kdebug("MADT->length= %d bytes", madt->header.Length);
|
||||
// 寻找io apic的ICS
|
||||
void *ent = (void *)(madt_addr) + sizeof(struct acpi_Multiple_APIC_Description_Table_t);
|
||||
struct apic_Interrupt_Controller_Structure_header_t *header = (struct apic_Interrupt_Controller_Structure_header_t *)ent;
|
||||
while (header->length > 2)
|
||||
@ -181,7 +181,7 @@ void apic_init_ap_core_local_apic()
|
||||
kdebug("cmci = %#018lx", *(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_CMCI));
|
||||
*/
|
||||
//*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_TIMER) = 0x10000;
|
||||
//io_mfence();
|
||||
// io_mfence();
|
||||
/*
|
||||
*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_THERMAL) = 0x1000000;
|
||||
io_mfence();
|
||||
@ -628,4 +628,46 @@ uint apic_get_ics(const uint type, ul ret_vaddr[], uint *total)
|
||||
return APIC_E_NOTFOUND;
|
||||
else
|
||||
return APIC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 构造RTE Entry结构体
|
||||
*
|
||||
* @param entry 返回的结构体
|
||||
* @param vector 中断向量
|
||||
* @param deliver_mode 投递模式
|
||||
* @param dest_mode 目标模式
|
||||
* @param deliver_status 投递状态
|
||||
* @param polarity 电平触发极性
|
||||
* @param irr 远程IRR标志位(只读)
|
||||
* @param trigger 触发模式
|
||||
* @param mask 屏蔽标志位,(0为未屏蔽, 1为已屏蔽)
|
||||
* @param dest_apicID 目标apicID
|
||||
*/
|
||||
void apic_make_rte_entry(struct apic_IO_APIC_RTE_entry *entry, uint8_t vector, uint8_t deliver_mode, uint8_t dest_mode,
|
||||
uint8_t deliver_status, uint8_t polarity, uint8_t irr, uint8_t trigger, uint8_t mask, uint8_t dest_apicID)
|
||||
{
|
||||
|
||||
entry->vector = vector;
|
||||
entry->deliver_mode = deliver_mode;
|
||||
entry->dest_mode = dest_mode;
|
||||
entry->deliver_status = deliver_status;
|
||||
entry->polarity = polarity;
|
||||
entry->remote_IRR = irr;
|
||||
entry->trigger_mode = trigger;
|
||||
entry->mask = mask;
|
||||
|
||||
entry->reserved = 0;
|
||||
|
||||
if (dest_mode == DEST_PHYSICAL)
|
||||
{
|
||||
entry->destination.physical.phy_dest = dest_apicID;
|
||||
entry->destination.physical.reserved1 = 0;
|
||||
entry->destination.physical.reserved2 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->destination.logical.logical_dest = dest_apicID;
|
||||
entry->destination.logical.reserved1 = 0;
|
||||
}
|
||||
}
|
@ -73,8 +73,6 @@
|
||||
// 分频配置寄存器(定时器专用)
|
||||
#define LOCAL_APIC_OFFSET_Local_APIC_CLKDIV 0x3e0
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
1: LVT CMCI
|
||||
@ -269,10 +267,9 @@ ul apic_ioapic_read_rte(unsigned char index);
|
||||
*/
|
||||
void apic_ioapic_write_rte(unsigned char index, ul value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief 初始化AP处理器的Local apic
|
||||
*
|
||||
*
|
||||
*/
|
||||
void apic_init_ap_core_local_apic();
|
||||
|
||||
@ -284,13 +281,13 @@ void apic_init();
|
||||
|
||||
/**
|
||||
* @brief 读取指定类型的 Interrupt Control Structure
|
||||
*
|
||||
*
|
||||
* @param type ics的类型
|
||||
* @param ret_vaddr 对应的ICS的虚拟地址数组
|
||||
* @param total 返回数组的元素总个数
|
||||
* @return uint
|
||||
* @return uint
|
||||
*/
|
||||
uint apic_get_ics(const uint type, ul ret_vaddr[], uint * total);
|
||||
uint apic_get_ics(const uint type, ul ret_vaddr[], uint *total);
|
||||
|
||||
// =========== 中断控制操作接口 ============
|
||||
void apic_ioapic_enable(ul irq_num);
|
||||
@ -301,4 +298,21 @@ void apic_ioapic_level_ack(ul irq_num); // ioapic电平触发 应答
|
||||
void apic_ioapic_edge_ack(ul irq_num); // ioapic边沿触发 应答
|
||||
|
||||
// void apic_local_apic_level_ack(ul irq_num);// local apic电平触发 应答
|
||||
void apic_local_apic_edge_ack(ul irq_num);// local apic边沿触发 应答
|
||||
void apic_local_apic_edge_ack(ul irq_num); // local apic边沿触发 应答
|
||||
|
||||
/**
|
||||
* @brief 构造RTE Entry结构体
|
||||
*
|
||||
* @param entry 返回的结构体
|
||||
* @param vector 中断向量
|
||||
* @param deliver_mode 投递模式
|
||||
* @param dest_mode 目标模式
|
||||
* @param deliver_status 投递状态
|
||||
* @param polarity 电平触发极性
|
||||
* @param irr 远程IRR标志位(只读)
|
||||
* @param trigger 触发模式
|
||||
* @param mask 屏蔽标志位,(0为未屏蔽, 1为已屏蔽)
|
||||
* @param dest_apicID 目标apicID
|
||||
*/
|
||||
void apic_make_rte_entry(struct apic_IO_APIC_RTE_entry *entry, uint8_t vector, uint8_t deliver_mode, uint8_t dest_mode,
|
||||
uint8_t deliver_status, uint8_t polarity, uint8_t irr, uint8_t trigger, uint8_t mask, uint8_t dest_apicID);
|
Reference in New Issue
Block a user