2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>
Fix console palette on OpenFirmware. * term/ieee1275/ofconsole.c (MAX): Removed. (colors): Redone based on VGA palette. (grub_ofconsole_setcolor): Discard brightness bit since only 8 colors are supported. (grub_ofconsole_init_output): Use ARRAY_SIZE instead of hardcoded size.
This commit is contained in:
commit
5a1ad2b9fd
2 changed files with 26 additions and 15 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix console palette on OpenFirmware.
|
||||
|
||||
* term/ieee1275/ofconsole.c (MAX): Removed.
|
||||
(colors): Redone based on VGA palette.
|
||||
(grub_ofconsole_setcolor): Discard brightness bit since only 8
|
||||
colors are supported.
|
||||
(grub_ofconsole_init_output): Use ARRAY_SIZE instead of hardcoded size.
|
||||
|
||||
2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix potential EfiEmu double prepare.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* ofconsole.c -- Open Firmware console for GRUB. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -43,17 +43,17 @@ struct color
|
|||
int blue;
|
||||
};
|
||||
|
||||
#define MAX 0xff
|
||||
static struct color colors[8] =
|
||||
static struct color colors[] =
|
||||
{
|
||||
{ 0, 0, 0},
|
||||
{ MAX, 0, 0},
|
||||
{ 0, MAX, 0},
|
||||
{ MAX, MAX, 0},
|
||||
{ 0, 0, MAX},
|
||||
{ MAX, 0, MAX},
|
||||
{ 0, MAX, MAX},
|
||||
{ MAX, MAX, MAX}
|
||||
// {R, G, B}
|
||||
{0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xA8}, // 1 = blue
|
||||
{0x00, 0xA8, 0x00}, // 2 = green
|
||||
{0x00, 0xA8, 0xA8}, // 3 = cyan
|
||||
{0xA8, 0x00, 0x00}, // 4 = red
|
||||
{0xA8, 0x00, 0xA8}, // 5 = magenta
|
||||
{0xFE, 0xFE, 0x54}, // 6 = yellow
|
||||
{0xFE, 0xFE, 0xFE} // 7 = white
|
||||
};
|
||||
|
||||
static grub_uint8_t grub_ofconsole_normal_color = 0x7;
|
||||
|
@ -131,8 +131,9 @@ static void
|
|||
grub_ofconsole_setcolor (grub_uint8_t normal_color,
|
||||
grub_uint8_t highlight_color)
|
||||
{
|
||||
grub_ofconsole_normal_color = normal_color;
|
||||
grub_ofconsole_highlight_color = highlight_color;
|
||||
/* Discard bright bit. */
|
||||
grub_ofconsole_normal_color = normal_color & 0x77;
|
||||
grub_ofconsole_highlight_color = highlight_color & 0x77;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -354,7 +355,6 @@ static grub_err_t
|
|||
grub_ofconsole_init_output (void)
|
||||
{
|
||||
grub_ssize_t actual;
|
||||
int col;
|
||||
|
||||
/* The latest PowerMacs don't actually initialize the screen for us, so we
|
||||
* use this trick to re-open the output device (but we avoid doing this on
|
||||
|
@ -370,7 +370,8 @@ grub_ofconsole_init_output (void)
|
|||
/* Initialize colors. */
|
||||
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
|
||||
{
|
||||
for (col = 0; col < 7; col++)
|
||||
unsigned col;
|
||||
for (col = 0; col < ARRAY_SIZE (colors); col++)
|
||||
grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
|
||||
colors[col].green, colors[col].blue);
|
||||
|
||||
|
|
Loading…
Reference in a new issue