Add ixgbe driver and split filesystem.toml into separate driver config files
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "ixgbed"]
|
||||
path = ixgbed
|
||||
url = https://github.com/ackxolotl/ixgbed.git
|
||||
@@ -0,0 +1,6 @@
|
||||
[[drivers]]
|
||||
name = "E1000 NIC"
|
||||
class = 2
|
||||
ids = { 0x8086 = [0x1004, 0x100e, 0x100f, 0x1503] }
|
||||
command = ["e1000d", "$NAME", "$BAR0", "$IRQ"]
|
||||
|
||||
@@ -1,49 +1,5 @@
|
||||
## Drivers for FS ##
|
||||
|
||||
# e1000d
|
||||
[[drivers]]
|
||||
name = "82543GC NIC"
|
||||
class = 2
|
||||
vendor = 32902
|
||||
device = 4100
|
||||
command = ["e1000d", "$NAME", "$BAR0", "$IRQ"]
|
||||
|
||||
[[drivers]]
|
||||
name = "82540EM NIC"
|
||||
class = 2
|
||||
vendor = 32902
|
||||
device = 4110
|
||||
command = ["e1000d", "$NAME", "$BAR0", "$IRQ"]
|
||||
|
||||
[[drivers]]
|
||||
name = "82545EM NIC"
|
||||
class = 2
|
||||
vendor = 32902
|
||||
device = 4111
|
||||
command = ["e1000d", "$NAME", "$BAR0", "$IRQ"]
|
||||
|
||||
[[drivers]]
|
||||
name = "82579V NIC"
|
||||
class = 2
|
||||
vendor = 32902
|
||||
device = 5379
|
||||
command = ["e1000d", "$NAME", "$BAR0", "$IRQ"]
|
||||
|
||||
# ihdad
|
||||
[[drivers]]
|
||||
name = "Intel HD Audio"
|
||||
class = 4
|
||||
subclass = 3
|
||||
command = ["ihdad", "$NAME", "$BAR0", "$IRQ", "$VENID", "$DEVID"]
|
||||
|
||||
# rtl8168d
|
||||
[[drivers]]
|
||||
name = "RTL8168 NIC"
|
||||
class = 2
|
||||
vendor = 4332
|
||||
device = 33128
|
||||
command = ["rtl8168d", "$NAME", "$BAR2", "$IRQ"]
|
||||
|
||||
# xhcid
|
||||
# [[drivers]]
|
||||
# name = "XHCI"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[[drivers]]
|
||||
name = "Intel HD Audio"
|
||||
class = 4
|
||||
subclass = 3
|
||||
command = ["ihdad", "$NAME", "$BAR0", "$IRQ", "$VENID", "$DEVID"]
|
||||
|
||||
Submodule
+1
Submodule ixgbed added at 26c0142179
@@ -11,6 +11,7 @@ pub struct DriverConfig {
|
||||
pub class: Option<u8>,
|
||||
pub subclass: Option<u8>,
|
||||
pub interface: Option<u8>,
|
||||
pub ids: Option<BTreeMap<String, Vec<u16>>>,
|
||||
pub vendor: Option<u16>,
|
||||
pub device: Option<u16>,
|
||||
pub device_id_range: Option<Range<u16>>,
|
||||
|
||||
+46
-11
@@ -7,8 +7,8 @@ extern crate byteorder;
|
||||
extern crate syscall;
|
||||
extern crate toml;
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::{env, i64};
|
||||
use std::fs::{File, metadata, read_dir};
|
||||
use std::io::Read;
|
||||
use std::process::Command;
|
||||
use syscall::iopl;
|
||||
@@ -80,12 +80,30 @@ fn handle_parsed_header(config: &Config, pci: &Pci, bus_num: u8,
|
||||
if interface != header.interface() { continue; }
|
||||
}
|
||||
|
||||
if let Some(vendor) = driver.vendor {
|
||||
if vendor != header.vendor_id() { continue; }
|
||||
}
|
||||
if let Some(ref ids) = driver.ids {
|
||||
let mut device_found = false;
|
||||
for (vendor, devices) in ids {
|
||||
let vendor_without_prefix = vendor.trim_left_matches("0x");
|
||||
let vendor = i64::from_str_radix(vendor_without_prefix, 16).unwrap() as u16;
|
||||
|
||||
if let Some(device) = driver.device {
|
||||
if device != header.device_id() { continue; }
|
||||
if vendor != header.vendor_id() { continue; }
|
||||
|
||||
for device in devices {
|
||||
if *device == header.device_id() {
|
||||
device_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if !device_found { continue; }
|
||||
} else {
|
||||
if let Some(vendor) = driver.vendor {
|
||||
if vendor != header.vendor_id() { continue; }
|
||||
}
|
||||
|
||||
if let Some(device) = driver.device {
|
||||
if device != header.device_id() { continue; }
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(ref device_id_range) = driver.device_id_range {
|
||||
@@ -161,11 +179,28 @@ fn main() {
|
||||
|
||||
let mut args = env::args().skip(1);
|
||||
if let Some(config_path) = args.next() {
|
||||
if let Ok(mut config_file) = File::open(&config_path) {
|
||||
let mut config_data = String::new();
|
||||
if let Ok(_) = config_file.read_to_string(&mut config_data) {
|
||||
config = toml::from_str(&config_data).unwrap_or(Config::default());
|
||||
if metadata(&config_path).unwrap().is_file() {
|
||||
if let Ok(mut config_file) = File::open(&config_path) {
|
||||
let mut config_data = String::new();
|
||||
if let Ok(_) = config_file.read_to_string(&mut config_data) {
|
||||
config = toml::from_str(&config_data).unwrap_or(Config::default());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let paths = read_dir(&config_path).unwrap();
|
||||
|
||||
let mut config_data = String::new();
|
||||
|
||||
for path in paths {
|
||||
if let Ok(mut config_file) = File::open(&path.unwrap().path()) {
|
||||
let mut tmp = String::new();
|
||||
if let Ok(_) = config_file.read_to_string(&mut tmp) {
|
||||
config_data.push_str(&tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config = toml::from_str(&config_data).unwrap_or(Config::default());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[[drivers]]
|
||||
name = "RTL8168 NIC"
|
||||
class = 2
|
||||
ids = { 0x10ec = [0x8168] }
|
||||
command = ["rtl8168d", "$NAME", "$BAR2", "$IRQ"]
|
||||
|
||||
Reference in New Issue
Block a user