Skip to content

Commit

Permalink
use type InterruptLine to specify the interrupt number
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed May 14, 2023
1 parent 968752e commit 9d8f8e8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/drivers/fs/virtio_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use alloc::rc::Rc;
use alloc::string::{String, ToString};
use alloc::vec::Vec;

use pci_types::InterruptLine;

use self::constants::{FeatureSet, Features};
use crate::config::VIRTIO_MAX_QUEUE_SIZE;
#[cfg(feature = "pci")]
Expand Down Expand Up @@ -37,7 +39,7 @@ pub(crate) struct VirtioFsDriver {
pub(super) notif_cfg: NotifCfg,
pub(super) vqueues: Vec<Rc<Virtq>>,
pub(super) ready_queue: Vec<BufferToken>,
pub(super) irq: u8,
pub(super) irq: InterruptLine,
}

// Backend-independent interface for Virtio network driver
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/net/rtl8139.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloc::boxed::Box;
use alloc::vec::Vec;
use core::mem;

use pci_types::{Bar, MAX_BARS};
use pci_types::{Bar, InterruptLine, MAX_BARS};
use x86::io::*;

use crate::arch::kernel::core_local::increment_irq_counter;
Expand Down Expand Up @@ -204,7 +204,7 @@ pub enum RTL8139Error {
pub(crate) struct RTL8139Driver {
iobase: u16,
mtu: u16,
irq: u8,
irq: InterruptLine,
mac: [u8; 6],
tx_in_use: [bool; NO_TX_BUFFERS],
tx_counter: usize,
Expand Down
3 changes: 2 additions & 1 deletion src/drivers/net/virtio_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use core::cmp::Ordering;
use core::mem;
use core::result::Result;

use pci_types::InterruptLine;
use zerocopy::AsBytes;

use self::constants::{FeatureSet, Features, NetHdrGSO, Status, MAX_NUM_VQ};
Expand Down Expand Up @@ -497,7 +498,7 @@ pub(crate) struct VirtioNetDriver {
pub(super) send_vqs: TxQueues,

pub(super) num_vqs: u16,
pub(super) irq: u8,
pub(super) irq: InterruptLine,
pub(super) polling_mode_counter: u32,
}

Expand Down
5 changes: 3 additions & 2 deletions src/drivers/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use core::fmt;

use hermit_sync::{without_interrupts, InterruptTicketMutex};
use pci_types::{
Bar, ConfigRegionAccess, DeviceId, EndpointHeader, PciAddress, PciHeader, VendorId, MAX_BARS,
Bar, ConfigRegionAccess, DeviceId, EndpointHeader, InterruptLine, PciAddress, PciHeader,
VendorId, MAX_BARS,
};

use crate::arch::mm::{PhysAddr, VirtAddr};
Expand Down Expand Up @@ -212,7 +213,7 @@ impl<T: ConfigRegionAccess> PciDevice<T> {
Some((virtual_address, size))
}

pub fn irq(&self) -> Option<u8> {
pub fn irq(&self) -> Option<InterruptLine> {
let header = PciHeader::new(self.address);
if let Some(endpoint) = EndpointHeader::from_header(header, &self.access) {
let (_pin, line) = endpoint.interrupt(&self.access);
Expand Down

0 comments on commit 9d8f8e8

Please sign in to comment.