Compare commits

..

No commits in common. "31936bee989ad62e10cc73d069786068615b423f" and "5364e0fe6e6c7d1dc33815d259e0c25679c09ae7" have entirely different histories.

3 changed files with 41 additions and 124 deletions

View File

@ -305,6 +305,15 @@ pub enum Packet {
CoreMgmtClearLogRequest {
destination: u8,
},
CoreMgmtPullLogRequest {
destination: u8,
},
CoreMgmtPullLogReply {
destination: u8,
last: bool,
length: u16,
data: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE],
},
CoreMgmtSetLogLevelRequest {
destination: u8,
log_level: u8,
@ -644,6 +653,22 @@ impl Packet {
0xd2 => Packet::CoreMgmtClearLogRequest {
destination: reader.read_u8()?,
},
0xd3 => Packet::CoreMgmtPullLogRequest {
destination: reader.read_u8()?,
},
0xd4 => {
let destination = reader.read_u8()?;
let last = reader.read_bool()?;
let length = reader.read_u16()?;
let mut data: [u8; CORE_MGMT_PAYLOAD_MAX_SIZE] = [0; CORE_MGMT_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut data[0..length as usize])?;
Packet::CoreMgmtPullLogReply {
destination: destination,
last: last,
length: length,
data: data,
}
}
0xd5 => Packet::CoreMgmtSetLogLevelRequest {
destination: reader.read_u8()?,
log_level: reader.read_u8()?,
@ -1106,6 +1131,22 @@ impl Packet {
writer.write_u8(0xd2)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtPullLogRequest { destination } => {
writer.write_u8(0xd3)?;
writer.write_u8(destination)?;
}
Packet::CoreMgmtPullLogReply {
destination,
last,
length,
data,
} => {
writer.write_u8(0xd4)?;
writer.write_u8(destination)?;
writer.write_bool(last)?;
writer.write_u16(length)?;
writer.write_all(&data[0..length as usize])?;
}
Packet::CoreMgmtSetLogLevelRequest { destination, log_level } => {
writer.write_u8(0xd5)?;
writer.write_u8(destination)?;

View File

@ -67,9 +67,6 @@ pub enum Request {
ConfigRead = 12,
ConfigWrite = 13,
ConfigRemove = 14,
ConfigErase = 15,
DebugAllocator = 8,
}
#[repr(i8)]
@ -472,37 +469,6 @@ mod remote_coremgmt {
}
}
pub async fn config_erase(
stream: &mut TcpStream,
aux_mutex: &Rc<Mutex<bool>>,
routing_table: &drtio_routing::RoutingTable,
timer: GlobalTimer,
linkno: u8,
destination: u8,
) -> Result<()> {
let reply = drtio::aux_transact(
aux_mutex,
linkno,
routing_table,
&Packet::CoreMgmtConfigEraseRequest {
destination: destination,
},
timer,
)
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}
_ => {
write_i8(stream, Reply::Error as i8).await?;
Err(drtio::Error::UnexpectedReply.into())
}
}
}
pub async fn reboot(
stream: &mut TcpStream,
aux_mutex: &Rc<Mutex<bool>>,
@ -535,38 +501,6 @@ mod remote_coremgmt {
}
}
}
pub async fn debug_allocator(
stream: &mut TcpStream,
aux_mutex: &Rc<Mutex<bool>>,
routing_table: &drtio_routing::RoutingTable,
timer: GlobalTimer,
linkno: u8,
destination: u8,
) -> Result<()> {
let reply = drtio::aux_transact(
aux_mutex,
linkno,
routing_table,
&Packet::CoreMgmtAllocatorDebugRequest {
destination: destination,
},
timer,
)
.await?;
match reply {
Packet::CoreMgmtAck { succeeded: true } => {
write_i8(stream, Reply::Success as i8).await?;
Ok(())
}
_ => {
error!("received unknown packet");
write_i8(stream, Reply::Error as i8).await?;
Err(drtio::Error::UnexpectedReply.into())
}
}
}
}
mod local_coremgmt {
@ -673,12 +607,6 @@ mod local_coremgmt {
Ok(())
}
pub async fn config_erase(stream: &mut TcpStream) -> Result<()> {
error!("zynq device does not support config erase");
write_i8(stream, Reply::Error as i8).await?;
Ok(())
}
pub async fn reboot(stream: &mut TcpStream) -> Result<()> {
info!("rebooting");
write_i8(stream, Reply::RebootImminent as i8).await?;
@ -687,11 +615,6 @@ mod local_coremgmt {
unreachable!()
}
pub async fn debug_allocator(_stream: &mut TcpStream) -> Result<()> {
error!("zynq device does not support allocator debug print");
Ok(())
}
}
#[cfg(has_drtio)]
@ -820,19 +743,6 @@ async fn handle_connection(
Request::Reboot => {
process!(stream, _timer, _aux_mutex, _routing_table, _destination, reboot)
}
Request::ConfigErase => {
process!(stream, _timer, _aux_mutex, _routing_table, _destination, config_erase)
}
Request::DebugAllocator => {
process!(
stream,
_timer,
_aux_mutex,
_routing_table,
_destination,
debug_allocator
)
}
}?;
}
}

View File

@ -1264,23 +1264,6 @@ fn process_aux_packet(
}
}
}
drtioaux::Packet::CoreMgmtConfigEraseRequest {
destination: _destination,
} => {
forward!(
router,
_routing_table,
_destination,
*rank,
*self_destination,
_repeaters,
&packet,
timer
);
error!("config erasen not supported on zynq device");
Ok(())
}
drtioaux::Packet::CoreMgmtRebootRequest {
destination: _destination,
} => {
@ -1301,23 +1284,6 @@ fn process_aux_packet(
slcr::reboot();
Ok(())
}
drtioaux::Packet::CoreMgmtAllocatorDebugRequest {
destination: _destination,
} => {
forward!(
router,
_routing_table,
_destination,
*rank,
*self_destination,
_repeaters,
&packet,
timer
);
error!("debug allocator not supported on zynq device");
Ok(())
}
p => {
warn!("received unexpected aux packet: {:?}", p);