Changeset 8424198 in mainline


Ignore:
Timestamp:
2006-05-18T21:45:16Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
35f3b8c
Parents:
59477e3
Message:

unify the framebuffer API
use physical address as the base address for the framebuffer

Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/drivers/vesa.c

    r59477e3 r8424198  
    5959}
    6060
    61 static count_t vesa_frame_order(void)
    62 {
    63         __u32 x = vesa_scanline*vesa_height;
    64         if (x <= FRAME_SIZE)
    65                 return 0;
    66 
    67         return (fnzb32(x - 1) + 1) - FRAME_WIDTH;
    68 }
    69 
    7061void vesa_init(void)
    7162{
    72         int a;
    73         __address vram_lin_addr;
    74 
    75         vram_lin_addr = PA2KA(PFN2ADDR(frame_alloc(vesa_frame_order(), FRAME_KA)));
    76         /* Map videoram */
    77         for (a = 0; a < ((vesa_scanline * vesa_height + PAGE_SIZE - 1) >> PAGE_WIDTH); a++)
    78                 page_mapping_insert(AS_KERNEL, vram_lin_addr + a*PAGE_SIZE, vesa_ph_addr + a*FRAME_SIZE,
    79                         PAGE_NOT_CACHEABLE);
    80 
    81         fb_init(vram_lin_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline);
    82        
    83         fb_register();
    84         sysinfo_set_item_val("fb.address.physical", NULL, vesa_ph_addr);
     63        fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline);
    8564}
    8665
  • arch/ppc32/Makefile.inc

    r59477e3 r8424198  
    6262
    6363ARCH_SOURCES = \
    64         arch/$(ARCH)/src/console.c \
    6564        arch/$(ARCH)/src/context.S \
    6665        arch/$(ARCH)/src/debug/panic.s \
  • arch/ppc32/include/exception.h

    r59477e3 r8424198  
    7979static inline void istate_set_retaddr(istate_t *istate, __address retaddr)
    8080{
    81         /* TODO */
     81        istate->pc = retaddr;
    8282}
    8383
  • arch/ppc32/src/ppc32.c

    r59477e3 r8424198  
    5858        /* Start decrementer */
    5959        start_decrementer();
    60 
    61         ppc32_console_init();
    6260        cuda_init();
    6361}
     
    6664{
    6765        if (config.cpu_active == 1) {
     66                fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);   
     67       
    6868                /* Merge all zones to 1 big zone */
    6969                zone_merge_all();
  • genarch/include/fb/fb.h

    r59477e3 r8424198  
    3535extern spinlock_t fb_lock;
    3636void fb_init(__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan);
    37 void fb_register(void);
    3837
    3938#endif
  • genarch/src/fb/fb.c

    r59477e3 r8424198  
    3333#include <sysinfo/sysinfo.h>
    3434#include <mm/slab.h>
     35#include <mm/as.h>
     36#include <bitops.h>
     37#include <align.h>
    3538#include <panic.h>
    3639#include <memstr.h>
     
    313316/** Initialize framebuffer as a chardev output device
    314317 *
    315  * @param addr Address of theframebuffer
     318 * @param addr Physical address of the framebuffer
    316319 * @param x    Screen width in pixels
    317320 * @param y    Screen height in pixels
     
    346349                        panic("Unsupported bpp");
    347350        }
    348                
    349         fbaddress = (unsigned char *) addr;
     351       
     352        unsigned int fbsize = scan * y;
     353        unsigned int fborder;
     354       
     355        if (fbsize <= FRAME_SIZE)
     356                fborder = 0;
     357        else
     358                fborder = (fnzb32(fbsize - 1) + 1) - FRAME_WIDTH;
     359       
     360        /* Map the framebuffer */
     361        fbaddress = (__u8 *) PA2KA(PFN2ADDR(frame_alloc(fborder, FRAME_KA)));
     362       
     363        pfn_t i;
     364        for (i = 0; i < ADDR2PFN(ALIGN_UP(fbsize, PAGE_SIZE)); i++)
     365                page_mapping_insert(AS_KERNEL, (__address) fbaddress + PFN2ADDR(i), addr + PFN2ADDR(i), PAGE_NOT_CACHEABLE);
     366       
    350367        xres = x;
    351368        yres = y;
     
    362379        chardev_initialize("fb", &framebuffer, &fb_ops);
    363380        stdout = &framebuffer;
    364 }
    365 
    366 
    367 /** Register framebuffer in sysinfo
    368  *
    369  */
    370 void fb_register(void)
    371 {
     381       
    372382        sysinfo_set_item_val("fb", NULL, true);
    373         sysinfo_set_item_val("fb.width", NULL, xres);
    374         sysinfo_set_item_val("fb.height", NULL, yres);
    375         sysinfo_set_item_val("fb.scanline", NULL, scanline);
    376         sysinfo_set_item_val("fb.bpp", NULL, bitspp);
    377         sysinfo_set_item_val("fb.address.virtual", NULL, (__address) fbaddress);
    378 }
     383        sysinfo_set_item_val("fb.width", NULL, x);
     384        sysinfo_set_item_val("fb.height", NULL, y);
     385        sysinfo_set_item_val("fb.bpp", NULL, bpp);
     386        sysinfo_set_item_val("fb.scanline", NULL, scan);
     387        sysinfo_set_item_val("fb.address.physical", NULL, addr);
     388}
Note: See TracChangeset for help on using the changeset viewer.