Skip to content

Commit 9d6b65d

Browse files
committed
uefi: Return AtaResponse from failed AtaDevice::execute_command()
The AtaResponse contains status register values that help identifying what went wrong.
1 parent c096351 commit 9d6b65d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

uefi/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
## Changed
1010
- Changed ordering of `proto::pci::PciIoAddress` to (bus -> dev -> fun -> reg -> ext_reg).
11+
- Return request with status as error data object for `proto::ata::pass_thru::AtaDevice`.
1112

1213
# uefi - v0.36.1 (2025-11-05)
1314

uefi/src/proto/ata/pass_thru.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,21 @@ impl AtaDevice<'_> {
185185
pub fn execute_command<'req>(
186186
&mut self,
187187
mut req: AtaRequest<'req>,
188-
) -> crate::Result<AtaResponse<'req>> {
188+
) -> crate::Result<AtaResponse<'req>, AtaResponse<'req>> {
189189
req.packet.acb = &req.acb;
190-
unsafe {
190+
let result = unsafe {
191191
((*self.proto.get()).pass_thru)(
192192
self.proto.get(),
193193
self.port,
194194
self.pmp,
195195
&mut req.packet,
196196
ptr::null_mut(),
197197
)
198-
.to_result_with_val(|| AtaResponse { req })
198+
.to_result()
199+
};
200+
match result {
201+
Ok(_) => Ok(AtaResponse { req }),
202+
Err(s) => Err(crate::Error::new(s.status(), AtaResponse { req })),
199203
}
200204
}
201205
}

0 commit comments

Comments
 (0)