Rev 1793 | Rev 1888 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1793 | Rev 1841 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | void page_arch_init(void) |
44 | void page_arch_init(void) |
| 45 | { |
45 | { |
| 46 | page_mapping_operations = &ht_mapping_operations; |
46 | page_mapping_operations = &ht_mapping_operations; |
| 47 | } |
47 | } |
| 48 | 48 | ||
| - | 49 | /** Map memory-mapped device into virtual memory. |
|
| - | 50 | * |
|
| - | 51 | * So far, only DTLB is used to map devices into memory. |
|
| - | 52 | * Chances are that there will be only a limited amount of |
|
| - | 53 | * devices that the kernel itself needs to lock in DTLB. |
|
| - | 54 | * |
|
| - | 55 | * @param physaddr Physical address of the page where the |
|
| - | 56 | * device is located. Must be at least |
|
| - | 57 | * page-aligned. |
|
| - | 58 | * @param size Size of the device's registers. Must not |
|
| - | 59 | * exceed 4M and must include extra space |
|
| - | 60 | * caused by the alignment. |
|
| - | 61 | * |
|
| - | 62 | * @return Virtual address of the page where the device is |
|
| - | 63 | * mapped. |
|
| - | 64 | */ |
|
| 49 | uintptr_t hw_map(uintptr_t physaddr, size_t size) |
65 | uintptr_t hw_map(uintptr_t physaddr, size_t size) |
| 50 | { |
66 | { |
| 51 | unsigned int order; |
67 | unsigned int order; |
| 52 | int i; |
68 | int i; |
| 53 | 69 | ||
| Line 66... | Line 82... | ||
| 66 | { PAGESIZE_512K, 64*PAGE_SIZE, 2 }, /* 1M */ |
82 | { PAGESIZE_512K, 64*PAGE_SIZE, 2 }, /* 1M */ |
| 67 | { PAGESIZE_512K, 64*PAGE_SIZE, 4 }, /* 2M */ |
83 | { PAGESIZE_512K, 64*PAGE_SIZE, 4 }, /* 2M */ |
| 68 | { PAGESIZE_4M, 0, 1 } /* 4M */ |
84 | { PAGESIZE_4M, 0, 1 } /* 4M */ |
| 69 | }; |
85 | }; |
| 70 | 86 | ||
| - | 87 | ASSERT(ALIGN_UP(physaddr, PAGE_SIZE) == physaddr); |
|
| 71 | ASSERT(size <= 4*1024*1024); |
88 | ASSERT(size <= 4*1024*1024); |
| 72 | 89 | ||
| 73 | if (size <= FRAME_SIZE) |
90 | if (size <= FRAME_SIZE) |
| 74 | order = 0; |
91 | order = 0; |
| 75 | else |
92 | else |