mirror of https://github.com/m-labs/artiq.git
artiq_coreboot: block until hotswap image is actually received.
This commit is contained in:
parent
804e69b144
commit
795a3e24d8
|
@ -60,6 +60,8 @@ class _D2HMsgType(Enum):
|
||||||
WATCHDOG_EXPIRED = 14
|
WATCHDOG_EXPIRED = 14
|
||||||
CLOCK_FAILURE = 15
|
CLOCK_FAILURE = 15
|
||||||
|
|
||||||
|
HOTSWAP_IMMINENT = 16
|
||||||
|
|
||||||
|
|
||||||
class _LogLevel(Enum):
|
class _LogLevel(Enum):
|
||||||
OFF = 0
|
OFF = 0
|
||||||
|
@ -332,6 +334,8 @@ class CommKernel:
|
||||||
self._write_header(_H2DMsgType.HOTSWAP)
|
self._write_header(_H2DMsgType.HOTSWAP)
|
||||||
self._write_bytes(image)
|
self._write_bytes(image)
|
||||||
|
|
||||||
|
self._read_empty(_D2HMsgType.HOTSWAP_IMMINENT)
|
||||||
|
|
||||||
def load(self, kernel_library):
|
def load(self, kernel_library):
|
||||||
self._write_header(_H2DMsgType.LOAD_KERNEL)
|
self._write_header(_H2DMsgType.LOAD_KERNEL)
|
||||||
self._write_bytes(kernel_library)
|
self._write_bytes(kernel_library)
|
||||||
|
|
|
@ -140,6 +140,8 @@ pub enum Reply<'a> {
|
||||||
|
|
||||||
WatchdogExpired,
|
WatchdogExpired,
|
||||||
ClockFailure,
|
ClockFailure,
|
||||||
|
|
||||||
|
HotswapImminent,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Reply<'a> {
|
impl<'a> Reply<'a> {
|
||||||
|
@ -219,6 +221,9 @@ impl<'a> Reply<'a> {
|
||||||
Reply::ClockFailure => {
|
Reply::ClockFailure => {
|
||||||
writer.write_u8(15)?;
|
writer.write_u8(15)?;
|
||||||
},
|
},
|
||||||
|
Reply::HotswapImminent => {
|
||||||
|
writer.write_u8(16)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,7 @@ fn host_read(stream: &mut TcpStream) -> io::Result<host::Request> {
|
||||||
let request = host::Request::read_from(stream)?;
|
let request = host::Request::read_from(stream)?;
|
||||||
match &request {
|
match &request {
|
||||||
&host::Request::LoadKernel(_) => debug!("comm<-host LoadLibrary(...)"),
|
&host::Request::LoadKernel(_) => debug!("comm<-host LoadLibrary(...)"),
|
||||||
|
&host::Request::Hotswap(_) => debug!("comm<-host Hotswap(...)"),
|
||||||
_ => debug!("comm<-host {:?}", request)
|
_ => debug!("comm<-host {:?}", request)
|
||||||
}
|
}
|
||||||
Ok(request)
|
Ok(request)
|
||||||
|
@ -269,8 +270,12 @@ fn process_host_message(io: &Io,
|
||||||
}
|
}
|
||||||
|
|
||||||
// artiq_coreboot
|
// artiq_coreboot
|
||||||
host::Request::Hotswap(binary) =>
|
host::Request::Hotswap(binary) => {
|
||||||
unsafe { board::hotswap::run(&binary) },
|
host_write(stream, host::Reply::HotswapImminent)?;
|
||||||
|
stream.close()?;
|
||||||
|
warn!("hotswapping firmware");
|
||||||
|
unsafe { board::hotswap::run(&binary) }
|
||||||
|
}
|
||||||
|
|
||||||
// artiq_run/artiq_master
|
// artiq_run/artiq_master
|
||||||
host::Request::SwitchClock(clk) => {
|
host::Request::SwitchClock(clk) => {
|
||||||
|
|
Loading…
Reference in New Issue