mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-25 04:14:06 +00:00
device: block: Update status of the flush command
ARM cares about the status so we need to parse the request correctly and fill in the status. Change-Id: I1ffabf556424184017eb64d3b9c68c72b75d0a26 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1139584 Reviewed-by: Stephen Barber <smbarber@chromium.org>
This commit is contained in:
parent
2dcb632405
commit
898921fe78
1 changed files with 37 additions and 7 deletions
|
@ -134,15 +134,45 @@ impl Request {
|
|||
|
||||
let req_type = request_type(&mem, avail_desc.addr)?;
|
||||
if req_type == RequestType::Flush {
|
||||
return Ok(Request {
|
||||
request_type: req_type,
|
||||
sector: 0,
|
||||
data_addr: GuestAddress(0),
|
||||
data_len: 0,
|
||||
status_addr: GuestAddress(0),
|
||||
})
|
||||
Request::parse_flush(avail_desc, mem)
|
||||
} else {
|
||||
Request::parse_read_write(avail_desc, mem, req_type)
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_flush(avail_desc: &DescriptorChain,
|
||||
mem: &GuestMemory)
|
||||
-> result::Result<Request, ParseError>
|
||||
{
|
||||
let sector = sector(&mem, avail_desc.addr)?;
|
||||
let status_desc = avail_desc
|
||||
.next_descriptor()
|
||||
.ok_or(ParseError::DescriptorChainTooShort)?;
|
||||
|
||||
// The status MUST always be writable
|
||||
if !status_desc.is_write_only() {
|
||||
return Err(ParseError::UnexpectedReadOnlyDescriptor);
|
||||
}
|
||||
|
||||
if status_desc.len < 1 {
|
||||
return Err(ParseError::DescriptorLengthTooSmall);
|
||||
}
|
||||
|
||||
Ok(Request {
|
||||
request_type: RequestType::Flush,
|
||||
sector: sector,
|
||||
data_addr: GuestAddress(0),
|
||||
data_len: 0,
|
||||
status_addr: status_desc.addr,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fn parse_read_write(avail_desc: &DescriptorChain,
|
||||
mem: &GuestMemory,
|
||||
req_type: RequestType)
|
||||
-> result::Result<Request, ParseError>
|
||||
{
|
||||
let sector = sector(&mem, avail_desc.addr)?;
|
||||
let data_desc = avail_desc
|
||||
.next_descriptor()
|
||||
|
|
Loading…
Reference in a new issue