Migrate ixgbed to pcid_interface (untested)

This commit is contained in:
bjorn3
2024-01-20 19:13:27 +01:00
parent 075e28339f
commit 878a02f29f
5 changed files with 20 additions and 10 deletions
Generated
+1
View File
@@ -665,6 +665,7 @@ dependencies = [
"bitflags 1.3.2",
"common",
"netutils",
"pcid",
"redox-daemon",
"redox_event 0.1.0",
"redox_syscall 0.4.1",
+2
View File
@@ -1,6 +1,7 @@
[package]
name = "ixgbed"
version = "1.0.0"
edition = "2021"
[dependencies]
bitflags = "1.0"
@@ -10,3 +11,4 @@ redox_syscall = "0.4"
redox-daemon = "0.1"
common = { path = "../common" }
pcid = { path = "../pcid" }
+2 -2
View File
@@ -2,5 +2,5 @@
name = "Intel 10G NIC"
class = 0x02
ids = { 0x8086 = [0x10F7, 0x1514, 0x1517, 0x151C, 0x10F9, 0x10FB, 0x152a, 0x1529, 0x1507, 0x154D, 0x1557, 0x10FC, 0x10F8, 0x154F, 0x1528, 0x154A, 0x1558, 0x1560, 0x1563, 0x15D1, 0x15AA, 0x15AB, 0x15AC, 0x15AD, 0x15AE, 0x15B0, 0x15C2, 0x15C3, 0x15C4, 0x15C6, 0x15C7, 0x15C8, 0x15CE, 0x15E4, 0x15E5, 0x10ED, 0x1515, 0x1565, 0x15A8, 0x15C5] }
command = ["ixgbed", "$NAME", "$BAR0", "$IRQ"]
command = ["ixgbed"]
use_channel = true
+1 -1
View File
@@ -10,7 +10,7 @@ use syscall::scheme::SchemeBlockMut;
use common::dma::Dma;
use netutils::setcfg;
use ixgbe::*;
use crate::ixgbe::*;
pub struct Intel8259x {
base: usize,
+14 -7
View File
@@ -10,9 +10,10 @@ use std::fs::File;
use std::io::{ErrorKind, Read, Result, Write};
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use std::sync::Arc;
use std::{env, thread};
use std::thread;
use event::EventQueue;
use pcid_interface::{PciBar, PcidServerHandle};
use std::time::Duration;
use syscall::{EventFlags, Packet, SchemeBlockMut};
@@ -66,16 +67,22 @@ fn handle_update(
}
fn main() {
let mut args = env::args().skip(1);
let mut pcid_handle =
PcidServerHandle::connect_default().expect("ixgbed: failed to setup channel to pcid");
let pci_config = pcid_handle
.fetch_config()
.expect("ixgbed: failed to fetch config");
let mut name = args.next().expect("ixgbed: no name provided");
let mut name = pci_config.func.name();
name.push_str("_ixgbe");
let bar_str = args.next().expect("ixgbed: no address provided");
let bar = usize::from_str_radix(&bar_str, 16).expect("ixgbed: failed to parse address");
let bar = match pci_config.func.bars[0] {
PciBar::Memory32(addr) => addr as usize,
PciBar::Memory64(addr) => addr as usize,
PciBar::None | PciBar::Port(_) => unreachable!(),
};
let irq_str = args.next().expect("ixgbed: no irq provided");
let irq = irq_str.parse::<u8>().expect("ixgbed: failed to parse irq");
let irq = pci_config.func.legacy_interrupt_line;
println!(" + IXGBE {} on: {:X} IRQ: {}", name, bar, irq);