Changeset 2b1f860 in mainline


Ignore:
Timestamp:
2008-12-06T23:35:32Z (15 years ago)
Author:
Pavel Rimsky <rimskyp@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20eb5e4d
Parents:
49093a4
Message:

Initialize the color palette for the 8-bit color depth on sparc64 framebuffers.

Location:
boot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc64/loader/main.c

    r49093a4 r2b1f860  
    268268#endif
    269269
     270        setup_palette();
     271
    270272        printf("\nBooting the kernel...\n");
    271273        jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
  • boot/genarch/ofw.c

    r49093a4 r2b1f860  
    374374}
    375375
     376/**
     377 * Sets up the palette for the 8-bit color depth configuration so that the
     378 * 3:2:3 color scheme can be used. Checks that setting the palette makes sense
     379 * (appropriate nodes exist in the OBP tree and the color depth is not greater
     380 * than 8).
     381 *
     382 * @return      true if the palette has been set, false otherwise
     383 */
     384int setup_palette(void)
     385{
     386        char device_name[BUF_SIZE];
     387       
     388        /* resolve alias */
     389        if (ofw_get_property(ofw_aliases, "screen", device_name,
     390                sizeof(device_name)) <= 0)
     391                return false;
     392
     393        /* for depth greater than 8 it makes no sense to set up the palette */
     394        uint32_t depth;
     395        phandle device = ofw_find_device(device_name);
     396        if (device == -1)
     397                return false;
     398        if (ofw_get_property(device, "depth", &depth, sizeof(uint32_t)) <= 0)
     399                return false;
     400        if (depth != 8)
     401                return false;
     402       
     403        /* required in order to be able to make a method call */
     404        ihandle screen = ofw_open(device_name);
     405        if (screen == -1)
     406                return false;
     407
     408        /* setup the palette so that the 3:2:3 scheme is usable */
     409        unsigned int i;
     410        for (i = 0; i < 256; i++)
     411                if (ofw_call("call-method", 6, 1, NULL, "color!", screen,
     412                        i,
     413                        i << 5,
     414                        (i >> 3) << 6,
     415                        (i >> 5) << 5) != 0);
     416        return true;
     417}
    376418
    377419void ofw_quiesce(void)
  • boot/genarch/ofw.h

    r49093a4 r2b1f860  
    124124extern int ofw_screen(screen_t *screen);
    125125extern int ofw_keyboard(keyboard_t *keyboard);
     126extern int setup_palette(void);
    126127extern void ofw_quiesce(void);
    127128
Note: See TracChangeset for help on using the changeset viewer.