Set mac address on boot

This commit is contained in:
Jeremy Soller
2016-10-22 19:13:57 -06:00
parent cb5f38dfdc
commit 5724bacd2b
6 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -7,5 +7,5 @@ bitflags = "*"
dma = { path = "../../crates/dma/" }
event = { path = "../../crates/event/" }
io = { path = "../../crates/io/" }
spin = "*"
netutils = { path = "../../programs/netutils/" }
syscall = { path = "../../syscall/" }
+2
View File
@@ -1,6 +1,7 @@
use std::{cmp, mem, ptr, slice};
use dma::Dma;
use netutils::setcfg;
use syscall::error::{Error, EACCES, EWOULDBLOCK, Result};
use syscall::scheme::Scheme;
@@ -272,6 +273,7 @@ impl Intel8254x {
mac_high as u8,
(mac_high >> 8) as u8];
println!(" - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
let _ = setcfg("mac", &format!("{:>02X}.{:>02X}.{:>02X}.{:>02X}.{:>02X}.{:>02X}", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
//
// MTA => 0;
+1
View File
@@ -2,6 +2,7 @@
extern crate dma;
extern crate event;
extern crate netutils;
extern crate syscall;
use std::cell::RefCell;
+1 -1
View File
@@ -7,5 +7,5 @@ bitflags = "*"
dma = { path = "../../crates/dma/" }
event = { path = "../../crates/event/" }
io = { path = "../../crates/io/" }
spin = "*"
netutils = { path = "../../programs/netutils/" }
syscall = { path = "../../syscall/" }
+2
View File
@@ -2,6 +2,7 @@ use std::mem;
use dma::Dma;
use io::{Mmio, Io, ReadOnly};
use netutils::setcfg;
use syscall::error::{Error, EACCES, EWOULDBLOCK, Result};
use syscall::scheme::SchemeMut;
@@ -221,6 +222,7 @@ impl Rtl8168 {
mac_high as u8,
(mac_high >> 8) as u8];
println!(" - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
let _ = setcfg("mac", &format!("{:>02X}.{:>02X}.{:>02X}.{:>02X}.{:>02X}.{:>02X}", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
// Reset - this will disable tx and rx, reinitialize FIFOs, and set the system buffer pointer to the initial value
self.regs.cmd.writef(1 << 4, true);
+1
View File
@@ -3,6 +3,7 @@
extern crate dma;
extern crate event;
extern crate io;
extern crate netutils;
extern crate syscall;
use std::cell::RefCell;