diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-01 15:08:29 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-01 15:08:29 +0200 |
| commit | c04fc970e5d9b0c82ae2923af88ad870a74608af (patch) | |
| tree | 2404ba05751397f5dcdc67e8275783147e22e469 /rsnix/src/ahci.rs | |
| parent | CONTEXT.md: runtime device detection milestone + QEMU hotplug testability notes (diff) | |
| download | rs-dos-c04fc970e5d9b0c82ae2923af88ad870a74608af.tar.gz rs-dos-c04fc970e5d9b0c82ae2923af88ad870a74608af.zip | |
rsnix: formatting
Diffstat (limited to '')
| -rw-r--r-- | rsnix/src/ahci.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/rsnix/src/ahci.rs b/rsnix/src/ahci.rs index 9ed803d..72da07d 100644 --- a/rsnix/src/ahci.rs +++ b/rsnix/src/ahci.rs | |||
| @@ -262,10 +262,14 @@ pub fn init() -> bool { | |||
| 262 | continue; | 262 | continue; |
| 263 | } | 263 | } |
| 264 | let det = reg(abar as usize + PORT_BASE + port_idx as usize * PORT_STRIDE + P_SSTS) & 0xF; | 264 | let det = reg(abar as usize + PORT_BASE + port_idx as usize * PORT_STRIDE + P_SSTS) & 0xF; |
| 265 | unsafe { PORT_UP[port_idx as usize] = det == 3; } | 265 | unsafe { |
| 266 | PORT_UP[port_idx as usize] = det == 3; | ||
| 267 | } | ||
| 266 | if let Some(d) = start_port(abar as usize, port_idx) { | 268 | if let Some(d) = start_port(abar as usize, port_idx) { |
| 267 | // The device answered IDENTIFY — it's definitely present. | 269 | // The device answered IDENTIFY — it's definitely present. |
| 268 | unsafe { PORT_UP[port_idx as usize] = true; } | 270 | unsafe { |
| 271 | PORT_UP[port_idx as usize] = true; | ||
| 272 | } | ||
| 269 | if !place_disk(d) { | 273 | if !place_disk(d) { |
| 270 | crate::serial_println!("ahci: port {} up but disk table full", port_idx); | 274 | crate::serial_println!("ahci: port {} up but disk table full", port_idx); |
| 271 | } | 275 | } |
| @@ -341,7 +345,9 @@ pub fn rescan() -> (usize, usize) { | |||
| 341 | .iter() | 345 | .iter() |
| 342 | .position(|d| d.is_some_and(|d| d.port_idx == port_idx)); | 346 | .position(|d| d.is_some_and(|d| d.port_idx == port_idx)); |
| 343 | let up_prev = unsafe { PORT_UP[port_idx as usize] }; | 347 | let up_prev = unsafe { PORT_UP[port_idx as usize] }; |
| 344 | unsafe { PORT_UP[port_idx as usize] = up; } | 348 | unsafe { |
| 349 | PORT_UP[port_idx as usize] = up; | ||
| 350 | } | ||
| 345 | if up == up_prev { | 351 | if up == up_prev { |
| 346 | continue; | 352 | continue; |
| 347 | } | 353 | } |
| @@ -356,7 +362,9 @@ pub fn rescan() -> (usize, usize) { | |||
| 356 | } | 362 | } |
| 357 | } else if let Some(i) = slot { | 363 | } else if let Some(i) = slot { |
| 358 | // Removal: tombstone the slot; indices stay stable. | 364 | // Removal: tombstone the slot; indices stay stable. |
| 359 | unsafe { DISKS[i] = None; } | 365 | unsafe { |
| 366 | DISKS[i] = None; | ||
| 367 | } | ||
| 360 | crate::serial_println!("ahci: port {} down — device removed", port_idx); | 368 | crate::serial_println!("ahci: port {} down — device removed", port_idx); |
| 361 | removed += 1; | 369 | removed += 1; |
| 362 | } | 370 | } |
