Rev 1287 | Rev 1292 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1287 | Rev 1289 | ||
|---|---|---|---|
| Line 30... | Line 30... | ||
| 30 | 30 | ||
| 31 | #include <genarch/fb/fb.h> |
31 | #include <genarch/fb/fb.h> |
| 32 | #include <arch/vesa.h> |
32 | #include <arch/vesa.h> |
| 33 | #include <putchar.h> |
33 | #include <putchar.h> |
| 34 | #include <mm/page.h> |
34 | #include <mm/page.h> |
| - | 35 | #include <mm/frame.h> |
|
| 35 | #include <mm/as.h> |
36 | #include <mm/as.h> |
| 36 | #include <arch/mm/page.h> |
37 | #include <arch/mm/page.h> |
| 37 | #include <synch/spinlock.h> |
38 | #include <synch/spinlock.h> |
| 38 | #include <arch/types.h> |
39 | #include <arch/types.h> |
| 39 | #include <arch/asm.h> |
40 | #include <arch/asm.h> |
| Line 52... | Line 53... | ||
| 52 | if(vesa_height!=0xffff) return true; |
53 | if(vesa_height!=0xffff) return true; |
| 53 | return false; |
54 | return false; |
| 54 | } |
55 | } |
| 55 | 56 | ||
| 56 | 57 | ||
| - | 58 | static __u32 log2(__u32 x) |
|
| - | 59 | { |
|
| - | 60 | __u32 l=2; |
|
| - | 61 | if(x<=PAGE_SIZE) return PAGE_WIDTH+1; |
|
| - | 62 | ||
| - | 63 | x--; |
|
| - | 64 | while(x>>=1) l++; |
|
| - | 65 | return l; |
|
| - | 66 | } |
|
| - | 67 | ||
| 57 | void vesa_init(void) |
68 | void vesa_init(void) |
| 58 | { |
69 | { |
| 59 | int a; |
70 | int a; |
| 60 | 71 | ||
| - | 72 | __address videoram_lin_addr; |
|
| - | 73 | ||
| - | 74 | videoram_lin_addr=PA2KA(PFN2ADDR(frame_alloc( log2(vesa_scanline*vesa_height) -FRAME_WIDTH,FRAME_KA))); |
|
| 61 | /* Map videoram */ |
75 | /* Map videoram */ |
| 62 | for(a=0;a<((vesa_scanline*vesa_height+PAGE_SIZE-1)>>PAGE_WIDTH);a++) |
76 | for(a=0;a<((vesa_scanline*vesa_height+PAGE_SIZE-1)>>PAGE_WIDTH);a++) |
| 63 | page_mapping_insert(AS_KERNEL, VIDEORAM_LIN_ADDR+a*4096, vesa_ph_addr+a*4096, PAGE_NOT_CACHEABLE); |
77 | page_mapping_insert(AS_KERNEL, videoram_lin_addr+a*4096, vesa_ph_addr+a*4096, PAGE_NOT_CACHEABLE); |
| 64 | 78 | ||
| 65 | fb_init( VIDEORAM_LIN_ADDR,vesa_width,vesa_height,vesa_bpp,vesa_scanline); |
79 | fb_init( videoram_lin_addr,vesa_width,vesa_height,vesa_bpp,vesa_scanline); |
| 66 | putchar('\n'); |
80 | putchar('\n'); |
| 67 | } |
81 | } |
| 68 | 82 | ||
| 69 | #endif |
83 | #endif |
| 70 | 84 | ||