mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-29 16:13:27 +00:00
Rename IrqAllocateHandle and move alloc functions
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7d5e67e368
commit
dbf5a423b1
@ -1,5 +1,5 @@
|
||||
use alloc::vec::Vec;
|
||||
use jinux_frame::{bus::pci::capability::msix::CapabilityMsixData, trap::IrqAllocateHandle};
|
||||
use jinux_frame::{bus::pci::capability::msix::CapabilityMsixData, trap::IrqLine};
|
||||
|
||||
pub struct VirtioMsixManager {
|
||||
config_msix_vector: u16,
|
||||
@ -17,8 +17,8 @@ impl VirtioMsixManager {
|
||||
pub fn new(mut msix: CapabilityMsixData) -> Self {
|
||||
let mut msix_vector_list: Vec<u16> = (0..msix.table_size()).collect();
|
||||
for i in msix_vector_list.iter() {
|
||||
let allocate_handle = jinux_frame::trap::allocate_irq().unwrap();
|
||||
msix.set_interrupt_vector(allocate_handle, *i);
|
||||
let irq = jinux_frame::trap::IrqLine::alloc().unwrap();
|
||||
msix.set_interrupt_vector(irq, *i);
|
||||
}
|
||||
let config_msix_vector = msix_vector_list.pop().unwrap();
|
||||
let shared_interrupt_vector = msix_vector_list.pop().unwrap();
|
||||
@ -32,7 +32,7 @@ impl VirtioMsixManager {
|
||||
}
|
||||
|
||||
/// Get config space change MSI-X IRQ, this function will return the MSI-X vector and corresponding IRQ.
|
||||
pub fn config_msix_irq(&mut self) -> (u16, &mut IrqAllocateHandle) {
|
||||
pub fn config_msix_irq(&mut self) -> (u16, &mut IrqLine) {
|
||||
(
|
||||
self.config_msix_vector,
|
||||
self.msix.irq_mut(self.config_msix_vector as usize).unwrap(),
|
||||
@ -42,7 +42,7 @@ impl VirtioMsixManager {
|
||||
/// Get shared interrupt IRQ used by virtqueue. If a virtqueue will not send interrupt frequently.
|
||||
/// Then this virtqueue should use shared interrupt IRQ.
|
||||
/// This function will return the MSI-X vector and corresponding IRQ.
|
||||
pub fn shared_interrupt_irq(&mut self) -> (u16, &mut IrqAllocateHandle) {
|
||||
pub fn shared_interrupt_irq(&mut self) -> (u16, &mut IrqLine) {
|
||||
(
|
||||
self.shared_interrupt_vector,
|
||||
self.msix
|
||||
@ -54,7 +54,7 @@ impl VirtioMsixManager {
|
||||
/// Pop unused vector. If a virtqueue will send interrupt frequently.
|
||||
/// Then this virtqueue should use the single IRQ that this function provides.
|
||||
/// this function will return the MSI-X vector and corresponding IRQ.
|
||||
pub fn pop_unused_irq(&mut self) -> Option<(u16, &mut IrqAllocateHandle)> {
|
||||
pub fn pop_unused_irq(&mut self) -> Option<(u16, &mut IrqLine)> {
|
||||
let vector = self.unused_msix_vectors.pop()?;
|
||||
self.used_msix_vectors.push(vector);
|
||||
Some((vector, self.msix.irq_mut(vector as usize).unwrap()))
|
||||
|
Reference in New Issue
Block a user