Browse Source

fix(ahci): minus 1 from PRDTEntry.len

greatbridf 3 months ago
parent
commit
321fbcac00
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/driver/ahci/defs.rs

+ 3 - 1
src/driver/ahci/defs.rs

@@ -240,7 +240,9 @@ impl PRDTEntry {
         self.base = page.as_phys() as u64;
         self._reserved1 = 0;
 
-        self.shared = 0x80000000 | (page.len() as u32 & 0x3fffff);
+        // The last bit MUST be set to 1 according to the AHCI spec
+        let len = page.len() as u32 - 1;
+        self.shared = 0x80000000 | (len & 0x3fffff);
     }
 }