Skip to content

Commit 654a36d

Browse files
committed
AtaPassThru: Add read_pio method for AtaRequestBuilder
1 parent 14e4882 commit 654a36d

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

uefi/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# uefi - [Unreleased]
22

33
## Added
4+
- Added `proto::ata::AtaRequestBuilder::read_pio()`.
45

56
## Changed
67

uefi/src/proto/ata/mod.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,36 @@ impl<'a> AtaRequestBuilder<'a> {
8787
})
8888
}
8989

90+
// # PIO
91+
// ########################################################################
92+
93+
/// Creates a builder for a PIO write operation.
94+
///
95+
/// Since the ATA specification mandates the support for PIO mode for all
96+
/// compliant drives and controllers, this is the protocol variant with the
97+
/// highest compatibility in the field.
98+
/// So probing, (sending ATA IDENTIFY commands to device ports to find out
99+
/// whether there is actually a device connected to it) should probably be
100+
/// done using this method most of the time.
101+
/// This applies for both PATA and SATA.
102+
/// If this errors with Status "UNSUPPORTED", try UDMA next.
103+
///
104+
/// # Arguments
105+
/// - `io_align`: The I/O buffer alignment required for the ATA controller.
106+
/// - `command`: The ATA command byte specifying the write operation.
107+
///
108+
/// # Returns
109+
/// `Result<Self, LayoutError>` indicating success or memory allocation failure.
110+
///
111+
/// # Errors
112+
/// This method can fail due to alignment or memory allocation issues.
113+
pub fn read_pio(io_align: u32, command: u8) -> Result<Self, LayoutError> {
114+
Self::new(io_align, command, AtaPassThruCommandProtocol::PIO_DATA_IN)
115+
}
116+
117+
// # UDMA
118+
// ########################################################################
119+
90120
/// Creates a builder for a UDMA read operation.
91121
///
92122
/// # Arguments

0 commit comments

Comments
 (0)