Skip to content

Commit f75e9c7

Browse files
committed
uefi: Add valuable commentary to map Ata command fields to LBA addressing
1 parent 43222e3 commit f75e9c7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

uefi/src/proto/ata/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,20 +161,24 @@ impl<'a> AtaRequestBuilder<'a> {
161161
}
162162

163163
/// Configure the `features` field.
164+
/// FEATURES (7:0)
164165
#[must_use]
165166
pub const fn with_features(mut self, features: u8) -> Self {
166167
self.req.acb.features = features;
167168
self
168169
}
169170

170171
/// Configure the `sector_number` field.
172+
/// LBA (7:0)
171173
#[must_use]
172174
pub const fn with_sector_number(mut self, sector_number: u8) -> Self {
173175
self.req.acb.sector_number = sector_number;
174176
self
175177
}
176178

177179
/// Configure the `cylinder` fields (low and high combined).
180+
/// low: LBA (15:8)
181+
/// high: LBA (23:16)
178182
#[must_use]
179183
pub const fn with_cylinder(mut self, low: u8, high: u8) -> Self {
180184
self.req.acb.cylinder_low = low;
@@ -183,20 +187,24 @@ impl<'a> AtaRequestBuilder<'a> {
183187
}
184188

185189
/// Configure the `device_head` field.
190+
/// DEVICE
186191
#[must_use]
187192
pub const fn with_device_head(mut self, device_head: u8) -> Self {
188193
self.req.acb.device_head = device_head;
189194
self
190195
}
191196

192197
/// Configure the `sector_number_exp` field.
198+
/// LBA (31:24)
193199
#[must_use]
194200
pub const fn with_sector_number_exp(mut self, sector_number_exp: u8) -> Self {
195201
self.req.acb.sector_number_exp = sector_number_exp;
196202
self
197203
}
198204

199205
/// Configure the `cylinder_exp` fields (low and high combined).
206+
/// low_exp: LBA (39:32)
207+
/// high_exp: LBA (47:40)
200208
#[must_use]
201209
pub const fn with_cylinder_exp(mut self, low_exp: u8, high_exp: u8) -> Self {
202210
self.req.acb.cylinder_low_exp = low_exp;
@@ -205,20 +213,23 @@ impl<'a> AtaRequestBuilder<'a> {
205213
}
206214

207215
/// Configure the `features_exp` field.
216+
/// FEATURES (15:8)
208217
#[must_use]
209218
pub const fn with_features_exp(mut self, features_exp: u8) -> Self {
210219
self.req.acb.features_exp = features_exp;
211220
self
212221
}
213222

214223
/// Configure the `sector_count` field.
224+
/// COUNT (7:0)
215225
#[must_use]
216226
pub const fn with_sector_count(mut self, sector_count: u8) -> Self {
217227
self.req.acb.sector_count = sector_count;
218228
self
219229
}
220230

221231
/// Configure the `sector_count_exp` field.
232+
/// COUNT (15:8)
222233
#[must_use]
223234
pub const fn with_sector_count_exp(mut self, sector_count_exp: u8) -> Self {
224235
self.req.acb.sector_count_exp = sector_count_exp;

0 commit comments

Comments
 (0)