File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed
Documentation/gpu/nova/core Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,6 @@ Numerical operations [NUMM]
147147Nova uses integer operations that are not part of the standard library (or not
148148implemented in an optimized way for the kernel). These include:
149149
150- - Aligning up and down to a power of two,
151150- The "Find Last Set Bit" (`fls ` function of the C part of the kernel)
152151 operation.
153152
Original file line number Diff line number Diff line change 33use core:: ops:: Range ;
44
55use kernel:: prelude:: * ;
6+ use kernel:: ptr:: { Alignable , Alignment } ;
67use kernel:: sizes:: * ;
78use kernel:: types:: ARef ;
89use kernel:: { dev_warn, device} ;
@@ -130,10 +131,9 @@ impl FbLayout {
130131 } ;
131132
132133 let frts = {
133- const FRTS_DOWN_ALIGN : u64 = SZ_128K as u64 ;
134+ const FRTS_DOWN_ALIGN : Alignment = Alignment :: new :: < SZ_128K > ( ) ;
134135 const FRTS_SIZE : u64 = SZ_1M as u64 ;
135- // TODO[NUMM]: replace with `align_down` once it lands.
136- let frts_base = ( vga_workspace. start & !( FRTS_DOWN_ALIGN - 1 ) ) - FRTS_SIZE ;
136+ let frts_base = vga_workspace. start . align_down ( FRTS_DOWN_ALIGN ) - FRTS_SIZE ;
137137
138138 frts_base..frts_base + FRTS_SIZE
139139 } ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use kernel::device;
1010use kernel:: error:: Result ;
1111use kernel:: pci;
1212use kernel:: prelude:: * ;
13+ use kernel:: ptr:: { Alignable , Alignment } ;
1314
1415/// The offset of the VBIOS ROM in the BAR0 space.
1516const ROM_OFFSET : usize = 0x300000 ;
@@ -177,8 +178,7 @@ impl<'a> Iterator for VbiosIterator<'a> {
177178
178179 // Advance to next image (aligned to 512 bytes).
179180 self . current_offset += image_size;
180- // TODO[NUMM]: replace with `align_up` once it lands.
181- self . current_offset = self . current_offset . next_multiple_of ( 512 ) ;
181+ self . current_offset = self . current_offset . align_up ( Alignment :: new :: < 512 > ( ) ) ?;
182182
183183 Some ( Ok ( full_image) )
184184 }
You can’t perform that action at this time.
0 commit comments