File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -12,23 +12,20 @@ void pci_enumerate() {
1212 uaddr lo , hi ;
1313 struct vma * vma ;
1414
15- /* lol */
16- uaddr base = 0 ;
17- for (u64 i = 0 ; i < 32 ; ++ i ) {
18- vma = vma_alloc (& kernel_virtual_allocator , 1 );
19- assert (vma );
15+ vma = vma_alloc (& kernel_virtual_allocator , 32 );
16+ assert (vma );
2017
21- vma_bounds (vma , & lo , & hi );
22- mm_paging_map (lo , paddr_of_bits (pci_config + i * 0x1000 ), PGPERM_KRW );
18+ vma_bounds (vma , & lo , & hi );
2319
24- if (base == 0 ) base = lo ;
20+ for (u64 i = 0 ; i < 32 ; ++ i ) {
21+ mm_paging_map (lo + i * 0x1000 , paddr_of_bits (pci_config + i * 0x1000 ), PGPERM_KRW );
2522 }
2623 for (u64 dev = 0 ; dev < 32 ; ++ dev ) {
2724 u64 bus = 0 ;
2825 u64 func = 0 ;
2926 u64 offset = 0 ;
3027 offset = (bus << 16 ) | (dev << 11 ) | (func << 8 ) | (offset );
31- struct pci_device * device = (struct pci_device * )(base + offset );
28+ struct pci_device * device = (struct pci_device * )(lo + offset );
3229
3330 u16 did = device -> did ;
3431 u16 vid = device -> vid ;
You can’t perform that action at this time.
0 commit comments