feat(log): 将内核日志统一为新的logger (#814)

This commit is contained in:
曾俊
2024-05-16 17:25:23 +08:00
committed by GitHub
parent 92deae638b
commit 2eab6dd743
181 changed files with 1321 additions and 1261 deletions

View File

@ -9,6 +9,7 @@ use core::mem::size_of;
use core::ptr::NonNull;
use core::slice::{from_raw_parts, from_raw_parts_mut};
use core::sync::atomic::{compiler_fence, Ordering};
use log::{debug, info};
use super::e1000e_driver::e1000e_driver_init;
use crate::driver::base::device::DeviceId;
@ -23,8 +24,6 @@ use crate::exception::IrqNumber;
use crate::libs::volatile::{ReadOnly, Volatile, WriteOnly};
use crate::{kdebug, kinfo};
const PAGE_SIZE: usize = 4096;
const NETWORK_CLASS: u8 = 0x2;
const ETHERNET_SUBCLASS: u8 = 0x0;
@ -284,7 +283,7 @@ impl E1000EDevice {
volwrite!(general_regs, ctrl, ctrl | E1000E_CTRL_SLU);
}
let status = unsafe { volread!(general_regs, status) };
kdebug!("Status: {status:#X}");
debug!("Status: {status:#X}");
// 读取设备的mac地址
// Read mac address
@ -442,7 +441,7 @@ impl E1000EDevice {
buffer.set_length(desc.len as usize);
rdt = index;
unsafe { volwrite!(self.receive_regs, rdt0, rdt as u32) };
// kdebug!("e1000e: receive packet");
// debug!("e1000e: receive packet");
return Some(buffer);
}
@ -559,7 +558,7 @@ impl Drop for E1000EDevice {
fn drop(&mut self) {
// 释放已分配的所有dma页
// free all dma pages we have allocated
kdebug!("droping...");
debug!("droping...");
let recv_ring_length = PAGE_SIZE / size_of::<E1000ERecvDesc>();
let trans_ring_length = PAGE_SIZE / size_of::<E1000ETransDesc>();
unsafe {
@ -590,10 +589,10 @@ impl Drop for E1000EDevice {
pub fn e1000e_init() {
match e1000e_probe() {
Ok(_code) => {
kinfo!("Successfully init e1000e device!");
info!("Successfully init e1000e device!");
}
Err(_error) => {
kinfo!("Error occurred!");
info!("Error occurred!");
}
}
}
@ -610,7 +609,7 @@ pub fn e1000e_probe() -> Result<u64, E1000EPciError> {
if header.vendor_id == 0x8086 {
// intel
if E1000E_DEVICE_ID.contains(&header.device_id) {
kdebug!(
debug!(
"Detected e1000e PCI device with device id {:#x}",
header.device_id
);