Skip to content

Commit a4d3b79

Browse files
bors[bot]mkroening
andauthored
Merge #641
641: Remove some dependencies r=stlankes a=mkroening Co-authored-by: Martin Kröning <mkroening@posteo.net>
2 parents edfd270 + 73397e8 commit a4d3b79

File tree

4 files changed

+14
-129
lines changed

4 files changed

+14
-129
lines changed

Cargo.lock

Lines changed: 0 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ harness = false
5151
default = ["pci", "pci-ids", "acpi", "fsgsbase", "smp", "tcp", "dhcpv4"]
5252
vga = []
5353
newlib = []
54-
pci = ["num-derive"]
54+
pci = []
5555
acpi = []
5656
smp = ["include-transformed"]
5757
fsgsbase = []
@@ -79,11 +79,7 @@ hermit-sync = "0.1.2"
7979
include-transformed = { version = "0.2", optional = true }
8080
linked_list_allocator = { version = "0.10", default-features = false }
8181
log = { version = "0.4", default-features = false }
82-
num = { version = "0.4", default-features = false }
83-
num-derive = { version = "0.3", optional = true }
84-
num-traits = { version = "0.2", default-features = false }
8582
pci-ids = { version = "0.2", optional = true }
86-
scopeguard = { version = "1.1", default-features = false }
8783
shell-words = { version = "1.1", default-features = false }
8884
qemu-exit = "3.0"
8985
rand_chacha = { version = "0.3", default-features = false }

src/arch/x86_64/kernel/pci.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use alloc::vec::Vec;
22
use core::{fmt, u32, u8};
33

44
use hermit_sync::{without_interrupts, InterruptTicketMutex};
5-
use num_derive::{FromPrimitive, ToPrimitive};
65
use x86::io::*;
76

87
use crate::arch::x86_64::mm::{PhysAddr, VirtAddr};
@@ -47,44 +46,6 @@ pub const PCI_CAP_ID_VNDR: u32 = 0x09;
4746
static mut PCI_ADAPTERS: Vec<PciAdapter> = Vec::new();
4847
static mut PCI_DRIVERS: Vec<PciDriver<'_>> = Vec::new();
4948

50-
/// Classes of PCI nodes.
51-
#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive, PartialEq, Eq)]
52-
pub enum PciClassCode {
53-
TooOld = 0x00,
54-
MassStorage = 0x01,
55-
NetworkController = 0x02,
56-
DisplayController = 0x03,
57-
MultimediaController = 0x04,
58-
MemoryController = 0x05,
59-
BridgeDevice = 0x06,
60-
SimpleCommunicationController = 0x07,
61-
BaseSystemPeripheral = 0x08,
62-
InputDevice = 0x09,
63-
DockingStation = 0x0A,
64-
Processor = 0x0B,
65-
SerialBusController = 0x0C,
66-
WirelessController = 0x0D,
67-
IntelligentIoController = 0x0E,
68-
EncryptionController = 0x0F,
69-
DataAcquisitionSignalProcessing = 0x11,
70-
Other = 0xFF,
71-
}
72-
73-
/// Network Controller Sub Classes
74-
#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive, PartialEq, Eq)]
75-
pub enum PciNetworkControllerSubclass {
76-
Ethernet = 0x00,
77-
TokenRing = 0x01,
78-
Fddi = 0x02,
79-
Atm = 0x03,
80-
Isdn = 0x04,
81-
WorldFip = 0x05,
82-
Picmg = 0x06,
83-
Infiniband = 0x07,
84-
Fabric = 0x08,
85-
Network = 0x80,
86-
}
87-
8849
#[derive(Clone, Debug)]
8950
pub struct PciAdapter {
9051
pub bus: u8,

src/scheduler/task.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -620,40 +620,36 @@ impl BlockedTaskQueue {
620620

621621
// Shall the task automatically be woken up after a certain time?
622622
if let Some(wt) = wakeup_time {
623-
let first_task = true;
624623
let mut cursor = self.list.cursor_front_mut();
625-
let mut _guard = scopeguard::guard(first_task, |first_task| {
626-
// If the task is the new first task in the list, update the one-shot timer
627-
// to fire when this task shall be woken up.
624+
let set_oneshot_timer = || {
628625
#[cfg(not(feature = "tcp"))]
629-
if first_task {
630-
arch::set_oneshot_timer(wakeup_time);
631-
}
626+
arch::set_oneshot_timer(wakeup_time);
632627
#[cfg(feature = "tcp")]
633-
if first_task {
634-
match self.network_wakeup_time {
635-
Some(time) => {
636-
if time > wt {
637-
arch::set_oneshot_timer(wakeup_time);
638-
} else {
639-
arch::set_oneshot_timer(self.network_wakeup_time);
640-
}
628+
match self.network_wakeup_time {
629+
Some(time) => {
630+
if time > wt {
631+
arch::set_oneshot_timer(wakeup_time);
632+
} else {
633+
arch::set_oneshot_timer(self.network_wakeup_time);
641634
}
642-
_ => arch::set_oneshot_timer(wakeup_time),
643635
}
636+
_ => arch::set_oneshot_timer(wakeup_time),
644637
}
645-
});
638+
};
646639

647640
while let Some(node) = cursor.current() {
648641
let node_wakeup_time = node.wakeup_time;
649642
if node_wakeup_time.is_none() || wt < node_wakeup_time.unwrap() {
650643
cursor.insert_before(new_node);
651644

645+
set_oneshot_timer();
652646
return;
653647
}
654648

655649
cursor.move_next();
656650
}
651+
652+
set_oneshot_timer();
657653
}
658654

659655
self.list.push_back(new_node);

0 commit comments

Comments
 (0)