VirtualBox

Changeset 7759 in vbox


Ignore:
Timestamp:
Apr 5, 2008 11:36:02 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
29306
Message:

The BIOS logo stuff moved to VGA device. Added 24bpp bitmaps support.

Location:
trunk/src/VBox
Files:
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Builtins.h

    r6597 r7759  
    2424
    2525/** The default BIOS logo data. */
    26 extern const unsigned char  g_abPcDefBiosLogo[];
     26extern const unsigned char  g_abVgaDefBiosLogo[];
    2727/** The size of the default BIOS logo data. */
    28 extern const unsigned       g_cbPcDefBiosLogo;
     28extern const unsigned       g_cbVgaDefBiosLogo;
    2929
    3030extern const PDMDEVREG g_DevicePCI;
  • trunk/src/VBox/Devices/Graphics/BIOS/Makefile.kmk

    r5999 r7759  
    4747        $(PATH_TARGET)/vgabios.bin \
    4848        $(PATH_TARGET)/VgaBiosBin.c \
     49        $(PATH_TARGET)/VgaDefBiosLogo.c \
    4950        \
    5051        $(PATH_TARGET)/_vgabios-cirrus_.c \
     
    9798        $(QUIET)$(TARGET_vgabiossums) $@
    9899
     100#
     101# The VGA BIOS Logo.
     102#
     103LIBRARIES += VgaDefBiosLogo
     104VgaDefBiosLogo_TEMPLATE  = VBOXR3
     105VgaDefBiosLogo_INCS      = $(VBOX_PATH_DEVICES_SRC)
     106VgaDefBiosLogo_SOURCES   = $(PATH_TARGET)/VgaDefBiosLogo.c
     107
     108#
     109# Rule for making the bios logo.
     110#
     111$(PATH_TARGET)/VgaDefBiosLogo.c: $(PATH_SUB_CURRENT)/innotek_logo.bmp $(VBOX_BIN2C)
     112        $(call MSG_TOOL,bin2c,VgaBiosBin,$<,$@)
     113        $(QUIET)$(VBOX_BIN2C) -max 64 VgaDefBiosLogo $< $@
     114
    99115
    100116include $(PATH_KBUILD)/subfooter.kmk
  • trunk/src/VBox/Devices/Graphics/BIOS/vbe.h

    r5450 r7759  
    312312  /**
    313313   * VBE Bios Extra Data structure.
    314    * @remark duplicated in vga_int.h.
     314   * @remark duplicated in DevVGA.h.
    315315   */
    316316  typedef struct VBEHeader
     
    323323
    324324  /** The value of the VBEHEADER::u16Signature field.
    325    * @remark duplicated in vga_int.h. */
     325   * @remark duplicated in DevVGA.h. */
    326326  #define VBEHEADER_MAGIC      0x77CC
    327327 
    328328  /** The extra port which is used to read the mode list.
    329    * @remark duplicated in vga_int.h. */
     329   * @remark duplicated in DevVGA.h. */
    330330  #define VBE_EXTRA_PORT       0x3b6
    331331
    332332  /** The extra port which is used for debug printf.
    333    * @remark duplicated in vga_int.h. */
     333   * @remark duplicated in DevVGA.h. */
    334334  #define VBE_PRINTF_PORT      0x3b7
    335335
    336 
    337336#endif
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r7755 r7759  
    8888#include <iprt/assert.h>
    8989#include <iprt/asm.h>
     90#include <iprt/file.h>
    9091#include <iprt/string.h>
    9192
     
    103104#include "Builtins2.h"
    104105
     106/* "Press F12 to select boot device." bitmap. */
     107uint8_t LogoF12BootText[] = {
     108  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     109  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     110  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x7C,
     111  0xF8, 0xF0, 0x01, 0xE0, 0x81, 0x9F, 0x3F, 0x00, 0x70, 0xF8, 0x00, 0xE0, 0xC3,
     112  0x07, 0x0F, 0x1F, 0x3E, 0x70, 0x00, 0xF0, 0xE1, 0xC3, 0x07, 0x0E, 0x00, 0x6E,
     113  0x7C, 0x60, 0xE0, 0xE1, 0xC3, 0x07, 0xC6, 0x80, 0x81, 0x31, 0x63, 0xC6, 0x00,
     114  0x30, 0x80, 0x61, 0x0C, 0x00, 0x36, 0x63, 0x00, 0x8C, 0x19, 0x83, 0x61, 0xCC,
     115  0x18, 0x36, 0x00, 0xCC, 0x8C, 0x19, 0xC3, 0x06, 0xC0, 0x8C, 0x31, 0x3C, 0x30,
     116  0x8C, 0x19, 0x83, 0x31, 0x60, 0x60, 0x00, 0x0C, 0x18, 0x00, 0x0C, 0x60, 0x18,
     117  0x00, 0x80, 0xC1, 0x18, 0x00, 0x30, 0x06, 0x60, 0x18, 0x30, 0x80, 0x01, 0x00,
     118  0x33, 0x63, 0xC6, 0x30, 0x00, 0x30, 0x63, 0x80, 0x19, 0x0C, 0x03, 0x06, 0x00,
     119  0x0C, 0x18, 0x18, 0xC0, 0x81, 0x03, 0x00, 0x03, 0x18, 0x0C, 0x00, 0x60, 0x30,
     120  0x06, 0x00, 0x87, 0x01, 0x18, 0x06, 0x0C, 0x60, 0x00, 0xC0, 0xCC, 0x98, 0x31,
     121  0x0C, 0x00, 0xCC, 0x18, 0x30, 0x0C, 0xC3, 0x80, 0x01, 0x00, 0x03, 0x66, 0xFE,
     122  0x18, 0x30, 0x00, 0xC0, 0x02, 0x06, 0x06, 0x00, 0x18, 0x8C, 0x01, 0x60, 0xE0,
     123  0x0F, 0x86, 0x3F, 0x03, 0x18, 0x00, 0x30, 0x33, 0x66, 0x0C, 0x03, 0x00, 0x33,
     124  0xFE, 0x0C, 0xC3, 0x30, 0xE0, 0x0F, 0xC0, 0x87, 0x9B, 0x31, 0x63, 0xC6, 0x00,
     125  0xF0, 0x80, 0x01, 0x03, 0x00, 0x06, 0x63, 0x00, 0x8C, 0x19, 0x83, 0x61, 0xCC,
     126  0x18, 0x06, 0x00, 0x6C, 0x8C, 0x19, 0xC3, 0x00, 0x80, 0x8D, 0x31, 0xC3, 0x30,
     127  0x8C, 0x19, 0x03, 0x30, 0xB3, 0xC3, 0x87, 0x0F, 0x1F, 0x00, 0x2C, 0x60, 0x80,
     128  0x01, 0xE0, 0x87, 0x0F, 0x00, 0x3E, 0x7C, 0x60, 0xF0, 0xE1, 0xE3, 0x07, 0x00,
     129  0x0F, 0x3E, 0x7C, 0xFC, 0x00, 0xC0, 0xC3, 0xC7, 0x30, 0x0E, 0x3E, 0x7C, 0x00,
     130  0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x1E, 0xC0, 0x00, 0x60, 0x00,
     131  0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x00, 0xC0, 0x00, 0x00, 0x00,
     132  0x0C, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00,
     133  0x00, 0x00, 0x00, 0xC0, 0x0C, 0x87, 0x31, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
     134  0x00, 0x06, 0x00, 0x00, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x30,
     135  0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
     136  0xF8, 0x83, 0xC1, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00,
     137  0x00, 0x04, 0x00, 0x0E, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x30,
     138  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     139  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     140  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    105141
    106142#ifndef VBOX_DEVICE_STRUCT_TESTCASE
     
    130166PDMBOTHCBDECL(int) vbeIOPortWriteVBEExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
    131167# endif
     168PDMBOTHCBDECL(int) vbeIOPortReadCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb);
     169PDMBOTHCBDECL(int) vbeIOPortWriteCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
    132170#endif /* IN_RING3 */
    133171
     
    35093547# endif /* VBE_NEW_DYN_LIST */
    35103548
     3549/**
     3550 * Port I/O Handler for BIOS Logo OUT operations.
     3551 *
     3552 * @returns VBox status code.
     3553 *
     3554 * @param   pDevIns     The device instance.
     3555 * @param   pvUser      User argument - ignored.
     3556 * @param   Port        Port number used for the IN operation.
     3557 * @param   u32         The value to output.
     3558 * @param   cb          The value size in bytes.
     3559 */
     3560PDMBOTHCBDECL(int) vbeIOPortWriteCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     3561{
     3562    PVGASTATE pData = PDMINS2DATA(pDevIns, PVGASTATE);
     3563    NOREF(pvUser);
     3564    NOREF(Port);
     3565
     3566    Log(("vbeIOPortWriteCMDLogo: cb=%d u32=%#04x(%#04d) (byte)\n", cb, u32, u32));
     3567
     3568    if (cb == 2)
     3569    {
     3570        /* Get the logo data */
     3571        if (pData->LogoCommand)
     3572        {
     3573            switch (pData->LogoCommand)
     3574            {
     3575                case LOGO_CMD_SET_OFFSET:
     3576                    pData->offLogoData = u32;
     3577                break;
     3578                case LOGO_CMD_SET_X:
     3579                    pData->LogoX = u32;
     3580                break;
     3581                case LOGO_CMD_SET_Y:
     3582                    pData->LogoY = u32;
     3583                break;
     3584                case LOGO_CMD_SET_WIDTH:
     3585                    pData->LogoWidth = u32;
     3586                break;
     3587                case LOGO_CMD_SET_HEIGHT:
     3588                    pData->LogoHeight = u32;
     3589                break;
     3590                case LOGO_CMD_SET_DEPTH:
     3591                    pData->LogoDepth = u32;
     3592                break;
     3593                case LOGO_CMD_SET_PALSIZE:
     3594                    pData->PalSize = u32;
     3595                break;
     3596                default:
     3597                    Log(("vbeIOPortWriteCMDLogo: invalid command %d\n", pData->LogoCommand));
     3598                    break;
     3599            }
     3600
     3601            pData->LogoCommand = LOGO_CMD_NOP;
     3602            return VINF_SUCCESS;
     3603        }
     3604
     3605        /* Get the logo command */
     3606        switch (u32 & 0xFF00)
     3607        {
     3608            int  i, j;
     3609            case LOGO_CMD_SET_OFFSET:
     3610            case LOGO_CMD_SET_X:
     3611            case LOGO_CMD_SET_Y:
     3612            case LOGO_CMD_SET_WIDTH:
     3613            case LOGO_CMD_SET_HEIGHT:
     3614            case LOGO_CMD_SET_DEPTH:
     3615            case LOGO_CMD_SET_PALSIZE:
     3616                pData->LogoCommand = u32 & 0xFF00;
     3617            break;
     3618            case LOGO_CMD_SET_DEFAULT:
     3619                pData->BmpImage = LOGO_IMAGE_DEFAULT;
     3620                pData->offLogoData = 0;
     3621                pData->LogoCommand = LOGO_CMD_NOP;
     3622            break;
     3623            case LOGO_CMD_SET_PAL:
     3624            {
     3625                uint8_t    *pu8Pal;
     3626
     3627                if (pData->BmpImage == LOGO_IMAGE_EXTERNAL)
     3628                    pu8Pal = (uint8_t *)&pData->pu8Logo[pData->offLogoData];
     3629                else
     3630                    pu8Pal = (uint8_t *)&g_abVgaDefBiosLogo[pData->offLogoData];
     3631
     3632                for (i = 0; i <= pData->PalSize; i++)
     3633                {
     3634                    uint8_t  b;
     3635                    uint32_t p = 0;
     3636
     3637                    for (j = 0; j < 3; j++)
     3638                    {
     3639                        p <<= 8;
     3640                        b = (uint8_t)*pu8Pal++;
     3641                        p |= b;
     3642                    }
     3643                    *pu8Pal++;
     3644
     3645                    pData->Palette[i] = p;
     3646                }
     3647            }
     3648            break;
     3649            case LOGO_CMD_CLS:
     3650            {
     3651                /* Clear vram */
     3652                uint32_t *pu32TmpPtr = (uint32_t *)pData->vram_ptrHC;
     3653                for (i = 0; i < LOGO_MAX_WIDTH; i++)
     3654                {
     3655                    for (j = 0; j < LOGO_MAX_HEIGHT; j++)
     3656                        *pu32TmpPtr++ = 0;
     3657                }
     3658            }
     3659            break;
     3660            case LOGO_CMD_SHOW_BMP:
     3661            case LOGO_CMD_SHOW_TEXT:
     3662            {
     3663                uint8_t cbStep = u32 & 0xFF;
     3664
     3665                /*
     3666                 * Determin bytes per pixel in the destination buffer.
     3667                 */
     3668                size_t      scr_cx = LOGO_MAX_WIDTH;
     3669                size_t      scr_cy = LOGO_MAX_HEIGHT;
     3670
     3671                if ((u32 & 0xFF00) == LOGO_CMD_SHOW_TEXT)
     3672                {
     3673                    pData->LogoX = LOGO_F12TEXT_X;
     3674                    pData->LogoY = LOGO_F12TEXT_Y;
     3675
     3676                    pData->LogoWidth = LOGO_F12TEXT_WIDTH;
     3677                    pData->LogoHeight = LOGO_F12TEXT_HEIGHT;
     3678                    pData->LogoDepth = 1;
     3679                }
     3680
     3681                uint32_t    cx = pData->LogoWidth;
     3682                uint32_t    cy = pData->LogoHeight;
     3683                uint8_t    *pu8Src;
     3684                uint8_t    *pu8TmpPtr;
     3685                size_t      cbPadBytes  = 0;
     3686                size_t      cbLineDst   = pData->pDrv->cbScanline;
     3687                uint8_t    *pu8Dst      = pData->vram_ptrHC;
     3688                uint32_t    cyLeft      = cy;
     3689                uint16_t    i;
     3690
     3691                pu8Dst += pData->LogoX * 4 + pData->LogoY * cbLineDst;
     3692
     3693                switch (pData->LogoDepth)
     3694                {
     3695                    case 1:
     3696                        pu8Dst += pData->LogoHeight * cbLineDst;
     3697                        cbPadBytes = 0;
     3698                    break;
     3699                    case 4:
     3700                        if (((pData->LogoWidth % 8) == 0) || ((pData->LogoWidth % 8) > 6))
     3701                            cbPadBytes = 0;
     3702                        else if ((pData->LogoWidth % 8) <= 2)
     3703                            cbPadBytes = 3;
     3704                        else if ((pData->LogoWidth % 8) <= 4)
     3705                            cbPadBytes = 2;
     3706                        else
     3707                            cbPadBytes = 1;
     3708                    break;
     3709                    case 8:
     3710                        cbPadBytes = ((pData->LogoWidth % 4) == 0) ? 0 : (4 - (pData->LogoWidth % 4));
     3711                    break;
     3712                    case 24:
     3713                        cbPadBytes = cx % 4;
     3714                    break;
     3715                }
     3716
     3717                if (pData->LogoDepth == 1)
     3718                {
     3719                    pu8Src = (uint8_t *)&LogoF12BootText;
     3720                }
     3721                else
     3722                {
     3723                    if (pData->BmpImage == LOGO_IMAGE_EXTERNAL)
     3724                        pu8Src = (uint8_t *)&pData->pu8Logo[pData->offLogoData];
     3725                    else
     3726                        pu8Src = (uint8_t *)&g_abVgaDefBiosLogo[pData->offLogoData];
     3727                }
     3728
     3729                uint8_t j = 0, c = 0;
     3730
     3731                while (cyLeft-- > 0)
     3732                {
     3733                    pu8TmpPtr = pu8Dst;
     3734
     3735                    if (pData->LogoDepth != 1)
     3736                        j = 0;
     3737
     3738                    for (i = 0; i < cx; i++)
     3739                    {
     3740                        uint8_t pix;
     3741
     3742                        switch (pData->LogoDepth)
     3743                        {
     3744                            case 1:
     3745                            {
     3746                                if (!j)
     3747                                    c = *pu8Src++;
     3748
     3749                                pix = (c & 1) ? 0xFF : 0;
     3750                                c >>= 1;
     3751
     3752                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3753                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3754                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3755                                *pu8TmpPtr++;
     3756
     3757                                if (j++ >= 7) j = 0;
     3758                            }
     3759                            break;
     3760                            case 4:
     3761                            {
     3762                                uint32_t p;
     3763
     3764                                if (!j)
     3765                                    c = *pu8Src++;
     3766
     3767                                pix = (c >> 4) & 0xF;
     3768                                c <<= 4;
     3769
     3770                                p = pData->Palette[pix];
     3771
     3772                                pix = (p >> 16) & 0xFF;
     3773                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3774                                pix = (p >> 8) & 0xFF;
     3775                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3776                                pix = p & 0xFF;
     3777                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3778                                *pu8TmpPtr++;
     3779
     3780                                if (j++ >= 1) j = 0;
     3781                            }
     3782                            break;
     3783                            case 8:
     3784                            {
     3785                                uint32_t p;
     3786
     3787                                p = pData->Palette[*pu8Src++];
     3788
     3789                                pix = (p >> 16) & 0xFF;
     3790                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3791                                pix = (p >> 8) & 0xFF;
     3792                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3793                                pix = p & 0xFF;
     3794                                *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS;
     3795                                *pu8TmpPtr++;
     3796                            }
     3797                            break;
     3798                            case 24:
     3799                                *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS;
     3800                                *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS;
     3801                                *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS;
     3802                                *pu8TmpPtr++;
     3803                            break;
     3804                        }
     3805                    }
     3806
     3807                    pu8Dst -= cbLineDst;
     3808                    pu8Src += cbPadBytes;
     3809                }
     3810
     3811                /*
     3812                 * Invalidate the area.
     3813                 */
     3814                pData->pDrv->pfnUpdateRect(pData->pDrv, 0, 0, scr_cx, scr_cy);
     3815
     3816                pData->LogoCommand = LOGO_CMD_NOP;
     3817            }
     3818            break;
     3819            default:
     3820                Log(("vbeIOPortWriteCMDLogo: invalid command %d\n", u32));
     3821                pData->LogoCommand = LOGO_CMD_NOP;
     3822                break;
     3823        }
     3824
     3825        return VINF_SUCCESS;
     3826    }
     3827
     3828    Log(("vbeIOPortWriteCMDLogo: Ignoring invalid cb=%d writes to the VBE Extra port!!!\n", cb));
     3829    return VINF_SUCCESS;
     3830}
     3831
     3832
     3833/**
     3834 * Port I/O Handler for BIOS Logo IN operations.
     3835 *
     3836 * @returns VBox status code.
     3837 *
     3838 * @param   pDevIns     The device instance.
     3839 * @param   pvUser      User argument - ignored.
     3840 * @param   Port        Port number used for the IN operation.
     3841 * @param   pu32        Where to store the result.
     3842 * @param   cb          Number of bytes read.
     3843 */
     3844PDMBOTHCBDECL(int) vbeIOPortReadCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
     3845{
     3846    PVGASTATE pData = PDMINS2DATA(pDevIns, PVGASTATE);
     3847    NOREF(pvUser);
     3848    NOREF(Port);
     3849
     3850    PRTUINT64U  p;
     3851
     3852    if (pData->BmpImage == LOGO_IMAGE_DEFAULT)
     3853    {
     3854        /*
     3855         * Default bios logo.
     3856         */
     3857        if (pData->offLogoData + cb > g_cbVgaDefBiosLogo)
     3858        {
     3859            Log(("vbeIOPortReadCMDLogo: Requested address is out of Logo data!!! offLogoData=%#x(%d) cbLogo=%#x(%d)\n",
     3860                 pData->offLogoData, pData->offLogoData, g_cbVgaDefBiosLogo, g_cbVgaDefBiosLogo));
     3861            return VINF_SUCCESS;
     3862        }
     3863        p = (PRTUINT64U)&g_abVgaDefBiosLogo[pData->offLogoData];
     3864    }
     3865    else
     3866    {
     3867        /*
     3868         * Custom logo.
     3869         */
     3870        if (pData->offLogoData + cb > pData->cbLogo)
     3871        {
     3872            Log(("vbeIOPortReadCMDLogo: Requested address is out of Logo data!!! offLogoData=%#x(%d) cbLogo=%#x(%d)\n",
     3873                 pData->offLogoData, pData->offLogoData, pData->cbLogo, pData->cbLogo));
     3874            return VINF_SUCCESS;
     3875        }
     3876        p = (PRTUINT64U)&pData->pu8Logo[pData->offLogoData];
     3877    }
     3878
     3879    switch (cb)
     3880    {
     3881        case 1: *pu32 = p->au8[0]; break;
     3882        case 2: *pu32 = p->au16[0]; break;
     3883        case 4: *pu32 = p->au32[0]; break;
     3884        //case 8: *pu32 = p->au64[0]; break;
     3885        default: AssertFailed(); break;
     3886    }
     3887    Log(("vbeIOPortReadCMDLogo: LogoOffset=%#x(%d) cb=%#x %.*Vhxs\n", pData->offLogoData, pData->offLogoData, cb, cb, pu32));
     3888
     3889    pData->LogoCommand = LOGO_CMD_NOP;
     3890    pData->offLogoData += cb;
     3891
     3892    return VINF_SUCCESS;
     3893}
     3894
    35113895
    35123896
     
    43324716    }
    43334717
     4718    /*
     4719     * Reset the logo data.
     4720     */
     4721    pData->LogoCommand = LOGO_CMD_NOP;
     4722    pData->offLogoData = 0;
     4723
    43344724    /* notify port handler */
    43354725    if (pData->pDrv)
     
    45044894                                          "GCEnabled\0"
    45054895                                          "R0Enabled\0"
     4896                                          "FadeIn\0"
     4897                                          "FadeOut\0"
     4898                                          "LogoTime\0"
     4899                                          "LogoFile\0"
     4900                                          "ShowBootMenu\0"
    45064901                                          "CustomVideoModes\0"
    45074902                                          "HeightReduction\0"
     
    49815376
    49825377    /*
     5378     * Register I/O Port for the BIOS Logo.
     5379     */
     5380    rc = PDMDevHlpIOPortRegister(pDevIns, VBE_LOGO_PORT, 1, NULL, vbeIOPortWriteCMDLogo, vbeIOPortReadCMDLogo, NULL, NULL, "BIOS Logo");
     5381    if (VBOX_FAILURE(rc))
     5382        return rc;
     5383
     5384    /*
     5385     * Construct the logo header.
     5386     */
     5387    LOGOHDR LogoHdr = { LOGO_HDR_MAGIC, 0, 0, 0, 0, 0 };
     5388
     5389    rc = CFGMR3QueryU8(pCfgHandle, "FadeIn", &LogoHdr.u8FadeIn);
     5390    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     5391        LogoHdr.u8FadeIn = 1;
     5392    else if (VBOX_FAILURE(rc))
     5393        return PDMDEV_SET_ERROR(pDevIns, rc,
     5394                                N_("Configuration error: Querying \"FadeIn\" as integer failed"));
     5395
     5396    rc = CFGMR3QueryU8(pCfgHandle, "FadeOut", &LogoHdr.u8FadeOut);
     5397    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     5398        LogoHdr.u8FadeOut = 1;
     5399    else if (VBOX_FAILURE(rc))
     5400        return PDMDEV_SET_ERROR(pDevIns, rc,
     5401                                N_("Configuration error: Querying \"FadeOut\" as integer failed"));
     5402
     5403    rc = CFGMR3QueryU16(pCfgHandle, "LogoTime", &LogoHdr.u16LogoMillies);
     5404    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     5405        LogoHdr.u16LogoMillies = 1;
     5406    else if (VBOX_FAILURE(rc))
     5407        return PDMDEV_SET_ERROR(pDevIns, rc,
     5408                                N_("Configuration error: Querying \"LogoTime\" as integer failed"));
     5409
     5410    rc = CFGMR3QueryU8(pCfgHandle, "ShowBootMenu", &LogoHdr.u8ShowBootMenu);
     5411    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     5412        LogoHdr.u8ShowBootMenu = 0;
     5413    else if (VBOX_FAILURE(rc))
     5414        return PDMDEV_SET_ERROR(pDevIns, rc,
     5415                                N_("Configuration error: Querying \"ShowBootMenu\" as integer failed"));
     5416
     5417    /*
     5418     * Get the Logo file name.
     5419     */
     5420    rc = CFGMR3QueryStringAlloc(pCfgHandle, "LogoFile", &pData->pszLogoFile);
     5421    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     5422        pData->pszLogoFile = NULL;
     5423    else if (VBOX_FAILURE(rc))
     5424        return PDMDEV_SET_ERROR(pDevIns, rc,
     5425                                N_("Configuration error: Querying \"LogoFile\" as a string failed"));
     5426    else if (!*pData->pszLogoFile)
     5427    {
     5428        MMR3HeapFree(pData->pszLogoFile);
     5429        pData->pszLogoFile = NULL;
     5430    }
     5431
     5432    /*
     5433     * Determine the logo size, open any specified logo file in the process.
     5434     */
     5435    LogoHdr.cbLogo = g_cbVgaDefBiosLogo;
     5436    RTFILE FileLogo = NIL_RTFILE;
     5437    if (pData->pszLogoFile)
     5438    {
     5439        rc = RTFileOpen(&FileLogo, pData->pszLogoFile,
     5440                        RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
     5441        if (VBOX_SUCCESS(rc))
     5442        {
     5443            uint64_t cbFile;
     5444            rc = RTFileGetSize(FileLogo, &cbFile);
     5445            if (VBOX_SUCCESS(rc))
     5446            {
     5447                if (cbFile > 0)
     5448                    LogoHdr.cbLogo = (uint32_t)cbFile;
     5449                else
     5450                    rc = VERR_TOO_MUCH_DATA;
     5451            }
     5452        }
     5453        if (VBOX_FAILURE(rc))
     5454        {
     5455            /*
     5456             * Ignore failure and fall back to the default logo.
     5457             */
     5458            LogRel(("vgaR3Construct: Failed to open logo file '%s', rc=%Vrc!\n", pData->pszLogoFile, rc));
     5459            RTFileClose(FileLogo);
     5460            FileLogo = NIL_RTFILE;
     5461            MMR3HeapFree(pData->pszLogoFile);
     5462            pData->pszLogoFile = NULL;
     5463        }
     5464    }
     5465
     5466    /*
     5467     * Allocate buffer for the logo data.
     5468     * RT_MAX() is applied to let us fall back to default logo on read failure.
     5469     */
     5470    pData->cbLogo = sizeof(LogoHdr) + LogoHdr.cbLogo;
     5471    pData->pu8Logo = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, RT_MAX(pData->cbLogo, g_cbVgaDefBiosLogo + sizeof(LogoHdr)));
     5472    if (pData->pu8Logo)
     5473    {
     5474        /*
     5475         * Write the logo header.
     5476         */
     5477        PLOGOHDR pLogoHdr = (PLOGOHDR)pData->pu8Logo;
     5478        *pLogoHdr = LogoHdr;
     5479
     5480        /*
     5481         * Write the logo bitmap.
     5482         */
     5483        if (pData->pszLogoFile)
     5484        {
     5485            rc = RTFileRead(FileLogo, pLogoHdr + 1, LogoHdr.cbLogo, NULL);
     5486            if (VBOX_FAILURE(rc))
     5487            {
     5488                AssertMsgFailed(("RTFileRead(,,%d,NULL) -> %Vrc\n", LogoHdr.cbLogo, rc));
     5489                pLogoHdr->cbLogo = LogoHdr.cbLogo = g_cbVgaDefBiosLogo;
     5490                memcpy(pLogoHdr + 1, g_abVgaDefBiosLogo, LogoHdr.cbLogo);
     5491            }
     5492        }
     5493        else
     5494            memcpy(pLogoHdr + 1, g_abVgaDefBiosLogo, LogoHdr.cbLogo);
     5495
     5496        pData->BmpImage = LOGO_IMAGE_EXTERNAL;
     5497
     5498        rc = VINF_SUCCESS;
     5499    }
     5500    else
     5501        rc = VERR_NO_MEMORY;
     5502
     5503    /* cleanup */
     5504    if (FileLogo != NIL_RTFILE)
     5505        RTFileClose(FileLogo);
     5506
     5507    /*
    49835508     * Statistics.
    49845509     */
     
    49885513    STAM_REG(pVM, &pData->StatGCIOPortWrite,    STAMTYPE_PROFILE, "/Devices/VGA/GC/IOPort/Write",        STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCIOPortWrite() body.");
    49895514
    4990     return VINF_SUCCESS;
     5515    return rc;
    49915516}
    49925517
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r7074 r7759  
    317317    uint16_t                    Padding7[2];    /**< Alignment padding. */
    318318#endif
     319    /** Current logo command. */
     320    uint16_t                    LogoCommand;
     321    /** Current logo data offset. */
     322    uint32_t                    offLogoData;
     323    /** Bitmap image to use. */
     324    uint8_t                     BmpImage;
     325    /** The size of the BIOS logo data. */
     326    uint32_t                    cbLogo;
     327    /** The BIOS logo data. */
     328    uint8_t                     *pu8Logo;
     329    /** The name of the logo file. */
     330    char                        *pszLogoFile;
     331    /** Logo X. */
     332    uint16_t                     LogoX;
     333    /** Logo Y. */
     334    uint16_t                     LogoY;
     335    /** Logo width. */
     336    uint16_t                     LogoWidth;
     337    /** Logo height. */
     338    uint16_t                     LogoHeight;
     339    /** Logo depth. */
     340    uint16_t                     LogoDepth;
     341    /** Palette data. */
     342    uint32_t                     Palette[256];
     343    /** Palette size. */
     344    uint16_t                     PalSize;
    319345
    320346#endif /* VBOX */
     
    359385#endif /* VBE_NEW_DYN_LIST */
    360386
     387/** The extra port which is used to show the BIOS logo.
     388 * @remark duplicated in logo.c. */
     389#define VBE_LOGO_PORT        0x3b8
     390
     391/** The BIOS logo fade in/fade out steps.
     392 * @remark duplicated in logo.c. */
     393#define LOGO_SHOW_STEPS      64
     394
     395/** The BIOS boot menu text position. */
     396#define LOGO_F12TEXT_X       340
     397#define LOGO_F12TEXT_Y       455
     398
     399/** Width and height of the "Press F12 to select boot device." bitmap.
     400    Anything that exceeds the limit of F12BootText below is filled with
     401    background. */
     402#define LOGO_F12TEXT_WIDTH   286
     403#define LOGO_F12TEXT_HEIGHT  12
     404
     405/** The BIOS logo commands.
     406 * @remark duplicated in logo.c. */
     407#define LOGO_IMAGE_DEFAULT   0
     408#define LOGO_IMAGE_EXTERNAL  1
     409
     410#define LOGO_MAX_WIDTH       640
     411#define LOGO_MAX_HEIGHT      480
     412
     413#define LOGO_CMD_NOP         0
     414#define LOGO_CMD_SET_OFFSET  0x100
     415#define LOGO_CMD_SET_X       0x200
     416#define LOGO_CMD_SET_Y       0x300
     417#define LOGO_CMD_SET_WIDTH   0x400
     418#define LOGO_CMD_SET_HEIGHT  0x500
     419#define LOGO_CMD_SET_DEPTH   0x600
     420#define LOGO_CMD_SET_PALSIZE 0x700
     421#define LOGO_CMD_SET_DEFAULT 0x800
     422#define LOGO_CMD_SET_PAL     0x900
     423#define LOGO_CMD_SHOW_BMP    0xA00
     424#define LOGO_CMD_SHOW_TEXT   0xB00
     425#define LOGO_CMD_CLS         0xC00
     426
     427/**
     428 * PC Bios logo data structure.
     429 */
     430#pragma pack(2) /* pack(2) is important! (seems that bios compiled with pack(2)...) */
     431typedef struct LOGOHDR
     432{
     433    /** Signature (LOGO_HDR_MAGIC/0x66BB). */
     434    uint16_t        u16Signature;
     435    /** Fade in - boolean. */
     436    uint8_t         u8FadeIn;
     437    /** Fade out - boolean. */
     438    uint8_t         u8FadeOut;
     439    /** Logo time (msec). */
     440    uint16_t        u16LogoMillies;
     441    /** Show setup - boolean. */
     442    uint8_t         u8ShowBootMenu;
     443    /** Logo file size. */
     444    uint32_t        cbLogo;
     445} LOGOHDR, *PLOGOHDR;
     446#pragma pack()
     447
     448/** The value of the LOGOHDR::u16Signature field. */
     449#define LOGO_HDR_MAGIC      0x66BB
     450
     451/** The value which will switch you the default logo. */
     452#define LOGO_DEFAULT_LOGO   0xFFFF
     453
    361454#if !defined(VBOX) || defined(IN_RING3)
    362455static inline int c6_to_8(int v)
  • trunk/src/VBox/Devices/Makefile.kmk

    r7654 r7759  
    143143        $(PATH_LIB)/DevicesR3$(VBOX_SUFF_LIB) \
    144144        $(PATH_LIB)/Drivers$(VBOX_SUFF_LIB) \
    145         $(PATH_LIB)/PcDefBiosLogo$(VBOX_SUFF_LIB) \
     145        $(PATH_LIB)/VgaDefBiosLogo$(VBOX_SUFF_LIB) \
    146146        $(LIB_VMM) \
    147147        $(LIB_RUNTIME)
  • trunk/src/VBox/Devices/PC/BIOS/Makefile.kmk

    r6871 r7759  
    4747        $(PATH_TARGET)/pcbios.bin \
    4848        $(PATH_TARGET)/PcBiosBin.c \
    49         $(PATH_TARGET)/PcDefBiosLogo.c \
    5049        $(PATH_TARGET)/pcbios-syms.h
    5150
     
    9897
    9998
    100 #
    101 # The PC BIOS Logo.
    102 #
    103 LIBRARIES += PcDefBiosLogo
    104 PcDefBiosLogo_TEMPLATE  = VBOXR3
    105 PcDefBiosLogo_INCS      = $(VBOX_PATH_DEVICES_SRC)
    106 PcDefBiosLogo_SOURCES   = $(PATH_TARGET)/PcDefBiosLogo.c
    107 
    108 #
    109 # Rule for making the bios logo.
    110 #
    111 $(PATH_TARGET)/PcDefBiosLogo.c: $(PATH_SUB_CURRENT)/innotek_logo.bmp $(VBOX_BIN2C)
    112         $(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
    113         $(QUIET)$(VBOX_BIN2C) -max 64 PcDefBiosLogo $< $@
    114 
    115 
    11699include $(PATH_KBUILD)/subfooter.kmk
    117100
  • trunk/src/VBox/Devices/PC/BIOS/logo.c

    r7099 r7759  
    1 #define COMPRESS_NONE  0
    2 #define COMPRESS_RLE8  1
    3 #define COMPRESS_RLE4  2
    4 
    5 #define BMP_HEADER_OS21  12
    6 #define BMP_HEADER_OS22  64
    7 #define BMP_HEADER_WIN3  40
    8 
    9 #define WAIT_HZ         64
    10 #define WAIT_MS         16
    11 
    12 #define F12_SCAN_CODE   0x86
    13 #define F12_WAIT_TIME   (3 * WAIT_HZ)   /* 3 seconds. Used only if logo disabled. */
    14 
    15 #define LOGO_IO_PORT    0x506
     1#define COMPRESS_NONE        0
     2#define COMPRESS_RLE8        1
     3#define COMPRESS_RLE4        2
     4
     5#define BMP_HEADER_OS21      12
     6#define BMP_HEADER_OS22      64
     7#define BMP_HEADER_WIN3      40
     8
     9#define WAIT_HZ              64
     10#define WAIT_MS              16
     11
     12#define F12_SCAN_CODE        0x86
     13#define F12_WAIT_TIME        (3 * WAIT_HZ)   /* 3 seconds. Used only if logo disabled. */
     14
     15#define LOGO_SHOW_STEPS      64
     16
     17#define LOGO_IMAGE_DEFAULT   0
     18#define LOGO_IMAGE_EXTERNAL  1
     19
     20#define LOGO_CMD_NOP         0
     21#define LOGO_CMD_SET_OFFSET  0x100
     22#define LOGO_CMD_SET_X       0x200
     23#define LOGO_CMD_SET_Y       0x300
     24#define LOGO_CMD_SET_WIDTH   0x400
     25#define LOGO_CMD_SET_HEIGHT  0x500
     26#define LOGO_CMD_SET_DEPTH   0x600
     27#define LOGO_CMD_SET_PALSIZE 0x700
     28#define LOGO_CMD_SET_DEFAULT 0x800
     29#define LOGO_CMD_SET_PAL     0x900
     30#define LOGO_CMD_SHOW_BMP    0xA00
     31#define LOGO_CMD_SHOW_TEXT   0xB00
     32#define LOGO_CMD_CLS         0xC00
     33
     34#define LOGO_IO_PORT         0x3b8
    1635
    1736typedef struct
     
    94113} LOGOHDR;
    95114
    96 // Width and height of the "Press F12 to select boot device." bitmap. Anything
    97 // that exceeds the limit of F12BootText below is filled with background.
    98 #define F12BOOTTEXTWIDTH 284
    99 #define F12BOOTTEXTHEIGHT 13
    100 // "Press F12 to select boot device." bitmap.
    101 Bit8u F12BootText[] = {
    102   0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x1F, 0x0C, 0x3E, 0x00, 0x20, 0x00,
    103   0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x20, 0x00, 0x70, 0x00, 0x00, 0x00,
    104   0x04, 0x00, 0x70, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00,
    105   0x00, 0x00, 0x00, 0x98, 0xE1, 0x30, 0x06, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
    106   0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x60, 0x00, 0x00, 0x06,
    107   0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
    108   0x11, 0x0F, 0x60, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00,
    109   0x30, 0x00, 0x60, 0x00, 0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
    110   0x00, 0x00, 0x60, 0x66, 0x87, 0x0F, 0x1F, 0x3E, 0x00, 0x58, 0xC0, 0x00, 0x03,
    111   0xC0, 0x0F, 0x1F, 0x00, 0x7C, 0xF8, 0xC0, 0xE0, 0xC3, 0xC7, 0x0F, 0x00, 0x1E,
    112   0x7C, 0xF8, 0xF8, 0x01, 0x80, 0x87, 0x8F, 0x61, 0x1C, 0x7C, 0xF8, 0x00, 0x3E,
    113   0xDC, 0x8C, 0x19, 0x33, 0x06, 0x80, 0x07, 0x0C, 0x18, 0x00, 0x30, 0x18, 0x03,
    114   0x60, 0xCC, 0x18, 0x0C, 0x63, 0xC6, 0x30, 0x00, 0x60, 0x63, 0xCC, 0x18, 0x06,
    115   0x00, 0x6C, 0x8C, 0x19, 0x86, 0x61, 0xCC, 0x18, 0x60, 0xC0, 0xCC, 0x1F, 0x03,
    116   0x06, 0x00, 0x58, 0xC0, 0xC0, 0x00, 0x00, 0x83, 0x31, 0x00, 0x0C, 0xFC, 0xC1,
    117   0xF0, 0x67, 0x00, 0x03, 0x00, 0x66, 0xC6, 0x8C, 0x61, 0x00, 0x60, 0xC6, 0x9F,
    118   0x61, 0x18, 0x06, 0xFC, 0x01, 0x06, 0x0C, 0x0C, 0xE0, 0xC0, 0x01, 0x80, 0x01,
    119   0x0C, 0x06, 0x00, 0x30, 0x18, 0x03, 0x80, 0xC3, 0x00, 0x0C, 0x03, 0x06, 0x30,
    120   0x00, 0x60, 0x66, 0xCC, 0x18, 0x06, 0x00, 0x66, 0x0C, 0x18, 0x86, 0x61, 0xC0,
    121   0x00, 0x60, 0xC0, 0xC0, 0x00, 0x18, 0x30, 0x00, 0x18, 0xC0, 0x30, 0x00, 0x00,
    122   0x83, 0x31, 0x00, 0x60, 0x0C, 0xC0, 0x30, 0x60, 0x00, 0x03, 0x00, 0x66, 0xC6,
    123   0x8C, 0x61, 0x00, 0x60, 0xC6, 0x00, 0x33, 0x18, 0x06, 0x0C, 0x00, 0x06, 0x0C,
    124   0x8C, 0x19, 0x33, 0x06, 0x80, 0x01, 0x0C, 0x63, 0x00, 0xB0, 0x19, 0x03, 0x60,
    125   0xCC, 0x18, 0x0C, 0x63, 0xC6, 0xB0, 0x01, 0x60, 0x66, 0xCC, 0x18, 0x36, 0x00,
    126   0x66, 0x8C, 0xE1, 0x81, 0x61, 0xCC, 0x18, 0xFC, 0xE0, 0x81, 0x0F, 0x1F, 0x3E,
    127   0x00, 0x3C, 0xF0, 0xF3, 0x07, 0x00, 0x0E, 0x1F, 0x00, 0x7C, 0xF8, 0xE0, 0xE1,
    128   0xC3, 0x07, 0x0E, 0x00, 0x3E, 0x7C, 0xF8, 0xC0, 0x01, 0xC0, 0x8D, 0x0F, 0x0C,
    129   0x3C, 0x7C, 0xF8, 0xC0
    130 };
    131115
    132116static unsigned char get_mode();
     
    335319}
    336320
    337 void read_palette(pal_seg, bmp_off, size, type)
    338   Bit16u pal_seg;
    339   Bit16u bmp_off;
    340   Bit16u size;
    341   Bit16u type;
    342   {
    343     Bit16u i;
    344     RGBPAL *palette;
    345 
    346     palette = 0;
    347 
    348     for (i = 0; i < size; i++)
    349     {
    350         Bit8u pal;
    351 
    352         pal = read_logo_byte(bmp_off);
    353         write_byte(pal_seg, &palette->Blue, pal);
    354         bmp_off++;
    355 
    356         pal = read_logo_byte(bmp_off);
    357         write_byte(pal_seg, &palette->Green, pal);
    358         bmp_off++;
    359 
    360         pal = read_logo_byte(bmp_off);
    361         write_byte(pal_seg, &palette->Red, pal);
    362         bmp_off++;
    363 
    364         if (type != BMP_HEADER_OS21)
    365         {
    366             // Skip 4th byte
    367             bmp_off++;
    368         }
    369 
    370         *palette++;
    371     }
    372 }
    373 
    374 void set_dark_palette(palette_size)
    375   Bit16u palette_size;
    376   {
    377     Bit16u i;
    378 
    379     // Set bitmap palette (dark)
    380     outb(0x03c8, palette_size);
    381 
    382     for (i = 0; i < palette_size; i++)
    383     {
    384         outb(0x03c8, i);
    385         outb(0x03c9, 0);
    386         outb(0x03c9, 0);
    387         outb(0x03c9, 0);
    388     }
    389 }
    390 
    391 void set_bitmap_palette(palette_seg, palette_size)
    392   Bit16u palette_seg;
    393   Bit16u palette_size;
    394   {
    395     RGBPAL *palette;
    396     Bit16u i;
    397 
    398     palette = 0;
    399 
    400     outb(0x03c6, palette_size);
    401 
    402     for (i = 0; i < palette_size; i++)
    403     {
    404         Bit8u b;
    405 
    406         outb(0x03c8, i);
    407 
    408         b = read_byte(palette_seg, &palette->Red);
    409         outb(0x03c9, b >> 2);
    410         b = read_byte(palette_seg, &palette->Green);
    411         outb(0x03c9, b >> 2);
    412         b = read_byte(palette_seg, &palette->Blue);
    413         outb(0x03c9, b >> 2);
    414 
    415         *palette++;
    416     }
    417 }
    418 
    419 /**
    420  * Fade in and check for keystroke.
    421  * @returns   1 if F12 was pressed, 0 if not.
    422  */
    423 Bit8u fade_in(palette_seg, palette_size)
    424   Bit16u palette_seg;
    425   Bit16u palette_size;
    426   {
    427     RGBPAL *palette;
    428     Bit16u i, j;
    429     Bit8u  scode;
    430 
    431     // Fade in
    432     for (i = 0; i < 0x3F; i++)
    433     {
    434         outb(0x03c6, palette_size);
    435         palette = 0;
    436 
    437         for (j = 0; j < palette_size; j++)
    438         {
    439             Bit8u r, g, b;
    440 
    441             r = read_byte(palette_seg, &palette->Red) >> 2;
    442             g = read_byte(palette_seg, &palette->Green) >> 2;
    443             b = read_byte(palette_seg, &palette->Blue) >> 2;
    444 
    445             if (r > 0 && r >= i) r = i;
    446             if (g > 0 && g >= i) g = i;
    447             if (b > 0 && b >= i) b = i;
    448 
    449             outb(0x03c8, j);
    450             outb(0x03c9, r);
    451             outb(0x03c9, g);
    452             outb(0x03c9, b);
    453 
    454             *palette++;
    455         }
    456         scode = wait(16 / WAIT_MS, 0);
    457         if (scode == F12_SCAN_CODE)
    458             return 1;
    459     }
    460 
    461     return 0; // F12 not pressed
    462 }
    463 
    464 /**
    465  * Fade out and check for keystroke.
    466  * @returns    1 if F12 was pressed, 0 if not.
    467  */
    468 Bit8u fade_out(palette_seg, palette_size)
    469   Bit16u palette_seg;
    470   Bit16u palette_size;
    471   {
    472     RGBPAL *palette;
    473     Bit16u i, j;
    474     Bit8u  scode;
    475 
    476     // Fade out
    477     for (i = 0x3F; i > 0; i--)
    478     {
    479         outb(0x03c6, palette_size);
    480         palette = 0;
    481 
    482         for (j = 0; j < palette_size; j++)
    483         {
    484             Bit8u r, g, b;
    485 
    486             r = read_byte(palette_seg, &palette->Red) >> 2;
    487             g = read_byte(palette_seg, &palette->Green) >> 2;
    488             b = read_byte(palette_seg, &palette->Blue) >> 2;
    489 
    490             if (r > 0 && r >= i) r = i;
    491             if (g > 0 && g >= i) g = i;
    492             if (b > 0 && b >= i) b = i;
    493 
    494             outb(0x03c8, j);
    495             outb(0x03c9, r);
    496             outb(0x03c9, g);
    497             outb(0x03c9, b);
    498 
    499             *palette++;
    500         }
    501         scode = wait(16 / WAIT_MS, 0);
    502         if (scode == F12_SCAN_CODE)
    503             return 1;
    504     }
    505 
    506     return 0; // F12 not pressed
    507 }
    508 
    509321void vesa_set_bank(bank)
    510322  Bit16u bank;
     
    534346    if (offset)
    535347    {
     348        outw(LOGO_IO_PORT, LOGO_CMD_SET_OFFSET);
    536349        outw(LOGO_IO_PORT, offset);
    537350    }
     351    else
     352        outw(LOGO_IO_PORT, LOGO_CMD_SET_OFFSET);
    538353
    539354    return inb(LOGO_IO_PORT);
     
    545360    if (offset)
    546361    {
     362        outw(LOGO_IO_PORT, LOGO_CMD_SET_OFFSET);
    547363        outw(LOGO_IO_PORT, offset);
    548364    }
     365    else
     366        outw(LOGO_IO_PORT, LOGO_CMD_SET_OFFSET);
    549367
    550368    return inw(LOGO_IO_PORT);
    551369}
    552370
    553 #define VID_SEG         0xA000
    554 #define TMP_SEG         0x1000
     371Bit16u set_logo_x(x)
     372  Bit16u x;
     373{
     374    outw(LOGO_IO_PORT, LOGO_CMD_SET_X);
     375    outw(LOGO_IO_PORT, x);
     376}
     377
     378Bit16u set_logo_y(y)
     379  Bit16u y;
     380{
     381    outw(LOGO_IO_PORT, LOGO_CMD_SET_Y);
     382    outw(LOGO_IO_PORT, y);
     383}
     384
     385Bit16u set_logo_width(w)
     386  Bit16u w;
     387{
     388    outw(LOGO_IO_PORT, LOGO_CMD_SET_WIDTH);
     389    outw(LOGO_IO_PORT, w);
     390}
     391
     392Bit16u set_logo_height(h)
     393  Bit16u h;
     394{
     395    outw(LOGO_IO_PORT, LOGO_CMD_SET_HEIGHT);
     396    outw(LOGO_IO_PORT, h);
     397}
     398
     399Bit16u set_logo_depth(d)
     400  Bit16u d;
     401{
     402    outw(LOGO_IO_PORT, LOGO_CMD_SET_DEPTH);
     403    outw(LOGO_IO_PORT, d);
     404}
     405
     406Bit16u set_pal_size(s)
     407  Bit16u s;
     408{
     409    outw(LOGO_IO_PORT, LOGO_CMD_SET_PALSIZE);
     410    outw(LOGO_IO_PORT, s);
     411}
     412
     413Bit16u set_pal_data(offset)
     414  Bit16u offset;
     415{
     416    outw(LOGO_IO_PORT, LOGO_CMD_SET_OFFSET);
     417    outw(LOGO_IO_PORT, offset);
     418    outw(LOGO_IO_PORT, LOGO_CMD_SET_PAL);
     419}
    555420
    556421void clear_screen()
     
    660525}
    661526
     527show_boot_text(step)
     528   Bit16u step;
     529{
     530    outw(LOGO_IO_PORT, LOGO_CMD_SHOW_TEXT | step);
     531}
     532
     533
    662534void show_logo()
    663535{
     
    669541    OS22HDR     *os22_head;
    670542    WINHDR      *win_head;
    671     Bit16u       rom_seg, pal_seg, logo_hdr_size, tmp, i;
    672     Bit32u       hdr_size;
    673     Bit8u        vid_mode;
     543    Bit16u      logo_hdr_size, tmp, i;
     544    Bit32u      hdr_size;
    674545
    675546    Bit8u       is_fade_in, is_fade_out, is_logo_failed, uBootMenu;
     
    677548
    678549    Bit32u      offset;
    679     Bit16u      bank = 0;
    680     Bit8u       logo_bank = 0;
    681     Bit16u      address;
    682550
    683551    Bit8u       scode, f12_pressed = 0;
    684     Bit8u c;
     552    Bit8u       c;
    685553
    686554    // Set PIT to 1ms ticks
     
    721589    else
    722590    {
    723         Bit16u scr_width, scr_height, start_x, start_y, bmp_data, j;
     591        Bit16u scr_width, scr_height, start_x, start_y;
    724592        Bit16u width, height, compr, clr_used;
    725593        Bit16u pad_bytes, depth, planes, palette_size, palette_data;
    726         Bit16u bidx, didx;
    727         int x, y;
    728594
    729595        // Check the size of the information header that indicates
     
    771637            goto error;
    772638
    773         if (depth < 4 || depth > 8)
     639        if (depth != 4 && depth != 8 && depth != 24)
    774640            goto error;
    775641
     
    803669        }
    804670
    805         pal_seg = TMP_SEG;
     671        set_pal_size(palette_size);
     672
    806673        palette_data = logo_hdr_size + sizeof(BMPINFO) + hdr_size;
    807 
    808         read_palette(pal_seg, palette_data, palette_size, hdr_size);
    809 
    810         //  Get current video mode
    811         vid_mode = get_mode();
    812 
    813         // Set video mode #0x101 640x480x8bpp
    814         vesa_set_mode(0x101);
    815 
    816         // Set dark/bitmap palette
    817         if (is_fade_in)
    818             set_dark_palette(palette_size);
    819         else
    820             set_bitmap_palette(pal_seg, palette_size);
     674        set_pal_data(palette_data);
     675
     676        // Set video mode #0x142 640x480x32bpp
     677        vesa_set_mode(0x142);
    821678
    822679        // 0 bank
     
    825682        // Show bitmap
    826683        tmp = read_logo_word(&bmp_info->Offset);
     684        outw(LOGO_IO_PORT, LOGO_CMD_SET_OFFSET);
    827685        outw(LOGO_IO_PORT, logo_hdr_size + tmp);
    828686
    829         switch(depth)
    830         {
    831             case 4:
    832                 // Compute padding bytes
    833                 if (((width % 8) == 0) || ((width % 8) > 6))
    834                     pad_bytes = 0;
    835                 else if ((width % 8) <= 2)
    836                     pad_bytes = 3;
    837                 else if ((width % 8) <= 4)
    838                     pad_bytes = 2;
    839                 else
    840                     pad_bytes = 1;
    841 
    842                  // For 4 bits per pixel, each byte is two pixels.
    843                  // The upper half go to the first pixel,
    844                  // and the lower half to the second.
    845                 for (y = height; y > 0; y--)
    846                 {
    847                     Bit8u z;
    848 
    849                     for (x = 0; x < width; x += 2)
    850                     {
    851                         Bit8u c;
    852 
    853                         c = read_logo_byte(0);
    854 
    855                         for (z = 0; z < 2; z++)
    856                         {
    857                             Bit8u color;
    858                             Bit16u new_bank;
    859 
    860                             offset = (((Bit32u)start_y + (Bit32u)y) * (Bit32u)scr_width) + ((Bit32u)start_x + (Bit32u)x + (Bit32u)z);
    861                             new_bank = (offset >> 16);
    862                             address = (Bit16u)(offset & 0xffffL);
    863 
    864                             if (bank != new_bank)
    865                             {
    866                                 bank = new_bank;
    867                                 vesa_set_bank(bank);
    868                             }
    869 
    870                             if (z & 1)
    871                                 color = c & 0xF;
    872                             else
    873                                 color = (c >> 4) & 0xF;
    874 
    875                             write_byte(VID_SEG, address, color);
    876                         }
    877                     }
    878 
    879                     for (z = 0; z < pad_bytes; z++)
    880                     {
    881                         c = read_logo_byte(0);
    882                     }
    883                 }
    884             break;
    885 
    886             case 8:
    887                 // Compute padding bytes
    888                 pad_bytes = ((width % 4) == 0) ? 0 : (4 - (width % 4));
    889 
    890                  // For 8 bits per pixel, each byte is one pixel.
    891                 for (y = height; y > 0; y--)
    892                 {
    893                     Bit8u z;
    894 
    895                     for (x = 0; x < width; x++)
    896                     {
    897                         Bit8u c, z;
    898                         Bit16u new_bank;
    899 
    900                         c = read_logo_byte(0);
    901 
    902                         offset = (((Bit32u)start_y + (Bit32u)y) * (Bit32u)scr_width) + ((Bit32u)start_x + (Bit32u)x);
    903                         new_bank = (offset >> 16);
    904                         address = (Bit16u)(offset & 0xffffL);
    905 
    906                         if (bank != new_bank)
    907                         {
    908                             bank = new_bank;
    909                             vesa_set_bank(bank);
    910                         }
    911 
    912                         write_byte(VID_SEG, address, c);
    913                     }
    914 
    915                     for (z = 0; z < pad_bytes; z++)
    916                     {
    917                         c = read_logo_byte(0);
    918                     }
    919                 }
    920             break;
    921 
    922 #if 0 // 24bpp bitmaps are unsupported
    923             case 24:
    924                 // Compute padding bytes
    925                 pad_bytes = width % 4;
    926 
    927                 // For 24 bits per pixel it's RGB structure.
    928                 for (y = height; y > 0; y--)
    929                 {
    930                     Bit8u z;
    931                     for (x = 0; x < width; x++)
    932                     {
    933                         for (z = 0; z < 3; z++)
    934                         {
    935                             Bit8u color;
    936                             Bit16u new_bank;
    937 
    938                             color = read_logo_byte(0);
    939 
    940                             offset = (((Bit32u)start_y + (Bit32u)y) * (Bit32u)scr_width*3) + (((Bit32u)start_x + (Bit32u)x) * (Bit32u)3 + z);
    941                             new_bank = (offset >> 16);
    942                             address = (Bit16u)(offset & 0xffffL);
    943 
    944                             if (bank != new_bank)
    945                             {
    946                                 bank = new_bank;
    947                                 vesa_set_bank(bank);
    948                             }
    949 
    950                             write_byte(VID_SEG, address, color);
    951                         }
    952                     }
    953 
    954                     for (z = 0; z < pad_bytes; z++)
    955                     {
    956                         c = read_logo_byte(0);
    957                     }
    958                 }
    959             break;
    960 #endif
    961         }
    962 
    963         // If Setup menu enabled
    964         if (uBootMenu == 2 && (is_fade_in || is_fade_out || logo_time))
    965         {
    966             RGBPAL *palette = 0;
    967             Bit16u blum, dlum;
    968 
    969             // Get the brightest and the darkest palette indexes
    970             bidx = didx = blum = 0;
    971             dlum = 3 * 0xff;
    972 
    973             for (i = 0; i < palette_size; i++)
     687        // Clear screen
     688        outw(LOGO_IO_PORT, LOGO_CMD_CLS);
     689
     690        if (is_fade_in)
     691        {
     692            for (i = 0; i <= LOGO_SHOW_STEPS; i++)
    974693            {
    975                 Bit8u r, g, b;
    976                 Bit16u lum;
    977 
    978                 r = read_byte(pal_seg, &palette->Red) >> 2;
    979                 g = read_byte(pal_seg, &palette->Green) >> 2;
    980                 b = read_byte(pal_seg, &palette->Blue) >> 2;
    981                 lum = (Bit16u)r + (Bit16u)g + (Bit16u)b;
    982 
    983                 if (lum > blum) { blum = lum; bidx = i; }
    984 
    985                 if (lum < dlum) { dlum = lum; didx = i; }
    986 
    987                 *palette++;
     694                set_logo_x(start_x);
     695                set_logo_y(scr_height - start_y);
     696                set_logo_width(width);
     697                set_logo_height(height);
     698                set_logo_depth(depth);
     699
     700                outw(LOGO_IO_PORT, LOGO_CMD_SHOW_BMP | i);
     701
     702                if (uBootMenu == 2)
     703                    show_boot_text(i);
     704   
     705                wait(16 / WAIT_MS, 0);
    988706            }
    989 
    990             // 0 bank
    991             vesa_set_bank(0);
    992 
    993             // Top-left corner of screen
    994             start_x = 340;
    995             start_y = 450;
    996 
    997             // Image size
    998             width = (start_x + F12BOOTTEXTWIDTH <= scr_width) ? F12BOOTTEXTWIDTH : scr_width - start_x;
    999             height = (start_y + F12BOOTTEXTHEIGHT <= scr_height) ? F12BOOTTEXTHEIGHT : scr_height - start_y;
    1000             bmp_data = j = 0;
    1001 
    1002             for (y = 0; y < height; y++)
    1003             {
    1004                 for (x = 0; x < width; x++)
    1005                 {
    1006                     Bit16u new_bank;
    1007                     Bit8u pix_idx;
    1008 
    1009                     if (!j)
    1010                     {
    1011                         if (bmp_data < sizeof(F12BootText))
    1012                             c = read_byte(0xf000, F12BootText + bmp_data++);
    1013                         else
    1014                             c = 0;
    1015                     }
    1016 
    1017                     offset = (((Bit32u)start_y + (Bit32u)y) * (Bit32u)scr_width) + ((Bit32u)start_x + (Bit32u)x);
    1018                     new_bank = (offset >> 16);
    1019                     address = (Bit16u)(offset & 0xffffL);
    1020 
    1021                     if (bank != new_bank)
    1022                     {
    1023                         bank = new_bank;
    1024                         vesa_set_bank(bank);
    1025                     }
    1026 
    1027                     pix_idx = c & 1;
    1028                     c >>= 1;
    1029 
    1030                     if (pix_idx)
    1031                         pix_idx = bidx;
    1032                     else
    1033                         pix_idx = didx;
    1034 
    1035                     write_byte(VID_SEG, address, pix_idx);
    1036 
    1037                     if (j++ >= 7) j = 0;
    1038                 }
    1039             }
    1040         }
    1041 
    1042         // Fade in
    1043         if (is_fade_in)
    1044         {
    1045             if (fade_in(pal_seg, palette_size))
    1046                 f12_pressed = 1;
     707        }
     708        else
     709        {
     710            set_logo_x(start_x);
     711            set_logo_y(scr_height - start_y);
     712            set_logo_width(width);
     713            set_logo_height(height);
     714            set_logo_depth(depth);
     715
     716            outw(LOGO_IO_PORT, LOGO_CMD_SHOW_BMP | LOGO_SHOW_STEPS);
     717
     718            if (uBootMenu == 2)
     719                show_boot_text(LOGO_SHOW_STEPS);
    1047720        }
    1048721
     
    1058731        if (is_fade_out && !f12_pressed)
    1059732        {
    1060             if (fade_out(pal_seg, palette_size))
    1061                 f12_pressed = 1;
     733            for (i = LOGO_SHOW_STEPS; i > 0 ; i--)
     734            {
     735                set_logo_x(start_x);
     736                set_logo_y(scr_height - start_y);
     737                set_logo_width(width);
     738                set_logo_height(height);
     739                set_logo_depth(depth);
     740                outw(LOGO_IO_PORT, LOGO_CMD_SHOW_BMP | i);
     741
     742                if (uBootMenu == 2)
     743                    show_boot_text(i);
     744
     745                scode = wait(16 / WAIT_MS, 0);
     746                if (scode == F12_SCAN_CODE)
     747                    f12_pressed = 1;
     748            }
    1062749        }
    1063750    }
     
    1073760
    1074761        // Switch to defaul logo
    1075         outw(LOGO_IO_PORT, 0xFFFF);
     762        outw(LOGO_IO_PORT, LOGO_CMD_SET_DEFAULT);
    1076763
    1077764        goto show_bmp;
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r7099 r7759  
    126126    /** Bios message buffer index. */
    127127    uint32_t        iMsg;
    128     /** Current logo data offset. */
    129     uint32_t        offLogoData;
    130     /** Use built-in or loaded logo. */
    131     bool            fDefaultLogo;
    132     /** The size of the BIOS logo data. */
    133     uint32_t        cbLogo;
    134     /** The BIOS logo data. */
    135     uint8_t        *pu8Logo;
    136     /** The name of the logo file. */
    137     char           *pszLogoFile;
    138128    /** The system BIOS ROM data. */
    139129    uint8_t        *pu8PcBios;
     
    156146} DEVPCBIOS, *PDEVPCBIOS;
    157147
    158 
    159 /** @todo The logo stuff shared with the BIOS goes into a header of course. */
    160 
    161 /**
    162  * PC Bios logo data structure.
    163  */
    164 #pragma pack(2) /* pack(2) is important! (seems that bios compiled with pack(2)...) */
    165 typedef struct LOGOHDR
    166 {
    167     /** Signature (LOGO_HDR_MAGIC/0x66BB). */
    168     uint16_t        u16Signature;
    169     /** Fade in - boolean. */
    170     uint8_t         u8FadeIn;
    171     /** Fade out - boolean. */
    172     uint8_t         u8FadeOut;
    173     /** Logo time (msec). */
    174     uint16_t        u16LogoMillies;
    175     /** Show setup - boolean. */
    176     uint8_t         u8ShowBootMenu;
    177     /** Logo file size. */
    178     uint32_t        cbLogo;
    179 } LOGOHDR, *PLOGOHDR;
    180 #pragma pack()
    181 
    182 /** PC port for Logo I/O */
    183 #define LOGO_IO_PORT        0x506
    184 
    185 /** The value of the LOGOHDR::u16Signature field. */
    186 #define LOGO_HDR_MAGIC      0x66BB
    187 
    188 /** The value which will switch you the default logo. */
    189 #define LOGO_DEFAULT_LOGO   0xFFFF
    190 
    191 /** The maximal logo size in bytes. (640x480x8bpp + header/palette) */
    192 #define LOGO_MAX_SIZE       640 * 480 + 0x442
    193 
    194148#pragma pack(1)
    195149
     
    311265
    312266#pragma pack()
    313 
    314 
    315 /*******************************************************************************
    316 *   Internal Functions                                                         *
    317 *******************************************************************************/
    318 __BEGIN_DECLS
    319 
    320 static DECLCALLBACK(int) logoIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb);
    321 static DECLCALLBACK(int) logoIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
    322 
    323 __END_DECLS
    324267
    325268/* Attempt to guess the LCHS disk geometry from the MS-DOS master boot
     
    851794
    852795    /* not in use. */
    853     return VINF_SUCCESS;
    854 }
    855 
    856 
    857 /**
    858  * LOGO port I/O Handler for IN operations.
    859  *
    860  * @returns VBox status code.
    861  *
    862  * @param   pDevIns     The device instance.
    863  * @param   pvUser      User argument - ignored.
    864  * @param   uPort       Port number used for the IN operation.
    865  * @param   pu32        Where to store the result.
    866  * @param   cb          Number of bytes read.
    867  */
    868 static DECLCALLBACK(int) logoIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
    869 {
    870     PDEVPCBIOS  pData = PDMINS2DATA(pDevIns, PDEVPCBIOS);
    871     Log(("logoIOPortRead call Port:%x pu32:%x cb:%d (%d)\n", Port, pu32, cb, pData->offLogoData));
    872 
    873     PRTUINT64U  p;
    874     if (pData->fDefaultLogo)
    875     {
    876         /*
    877          * Default bios logo.
    878          */
    879         if (pData->offLogoData + cb > g_cbPcDefBiosLogo)
    880         {
    881             Log(("logoIOPortRead: Requested address is out of Logo data!!! offLogoData=%#x(%d) cbLogo=%#x(%d)\n",
    882                  pData->offLogoData, pData->offLogoData, g_cbPcDefBiosLogo, g_cbPcDefBiosLogo));
    883             return VINF_SUCCESS;
    884         }
    885         p = (PRTUINT64U)&g_abPcDefBiosLogo[pData->offLogoData];
    886     }
    887     else
    888     {
    889         /*
    890          * Custom logo.
    891          */
    892         if (pData->offLogoData + cb > pData->cbLogo)
    893         {
    894             Log(("logoIOPortRead: Requested address is out of Logo data!!! offLogoData=%#x(%d) cbLogo=%#x(%d)\n",
    895                  pData->offLogoData, pData->offLogoData, pData->cbLogo, pData->cbLogo));
    896             return VINF_SUCCESS;
    897         }
    898         p = (PRTUINT64U)&pData->pu8Logo[pData->offLogoData];
    899     }
    900 
    901     switch (cb)
    902     {
    903         case 1: *pu32 = p->au8[0]; break;
    904         case 2: *pu32 = p->au16[0]; break;
    905         case 4: *pu32 = p->au32[0]; break;
    906         //case 8: *pu32 = p->au64[0]; break;
    907         default: AssertFailed(); break;
    908     }
    909     Log(("logoIOPortRead: LogoOffset=%#x(%d) cb=%#x %.*Vhxs\n", pData->offLogoData, pData->offLogoData, cb, cb, pu32));
    910     pData->offLogoData += cb;
    911 
    912     return VINF_SUCCESS;
    913 }
    914 
    915 
    916 /**
    917  * LOGO port I/O Handler for OUT operations.
    918  *
    919  * @returns VBox status code.
    920  *
    921  * @param   pDevIns     The device instance.
    922  * @param   pvUser      User argument - ignored.
    923  * @param   uPort       Port number used for the IN operation.
    924  * @param   u32         The value to output.
    925  * @param   cb          The value size in bytes.
    926  */
    927 static DECLCALLBACK(int) logoIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
    928 {
    929     PDEVPCBIOS  pData = PDMINS2DATA(pDevIns, PDEVPCBIOS);
    930     Log(("logoIOPortWrite: Port=%x cb=%d u32=%#04x (byte)\n", Port, cb, u32));
    931 
    932     /* Switch to default BIOS logo or change logo data offset. */
    933     if (    cb == 2
    934         &&  u32 == LOGO_DEFAULT_LOGO)
    935     {
    936         pData->fDefaultLogo = true;
    937         pData->offLogoData = 0;
    938     }
    939     else
    940         pData->offLogoData = u32;
    941 
    942796    return VINF_SUCCESS;
    943797}
     
    12131067    LogFlow(("pcbiosReset:\n"));
    12141068
    1215     pData->fDefaultLogo = false;
    1216     pData->offLogoData = 0;
    1217     /** @todo Should we perhaps do pcbiosInitComplete() on reset? */
    1218 
    1219 #if 1
    1220     /*
    1221      * Paranoia: Check that the BIOS ROM hasn't changed.
    1222      */
    1223     uint8_t abBuf[PAGE_SIZE];
    1224     const uint8_t *pu8PcBiosBinary;
    1225     uint64_t cbPcBiosBinary;
    1226 
    1227     /* Work with either built-in ROM image or one loaded from file.
    1228      */
    1229     if (pData->pu8PcBios == NULL)
    1230     {
    1231         pu8PcBiosBinary = g_abPcBiosBinary;
    1232         cbPcBiosBinary  = g_cbPcBiosBinary;
    1233     }
    1234     else
    1235     {
    1236         pu8PcBiosBinary = pData->pu8PcBios;
    1237         cbPcBiosBinary  = pData->cbPcBios;
    1238     }
    1239     Assert(pu8PcBiosBinary);
    1240     Assert(cbPcBiosBinary);
    1241 
    1242     /* the low ROM mapping. */
    1243     unsigned cb = RT_MIN(cbPcBiosBinary, 128 * _1K);
    1244     RTGCPHYS32 GCPhys = 0x00100000 - cb;
    1245     const uint8_t *pbVirgin = &pu8PcBiosBinary[cbPcBiosBinary - cb];
    1246     while (GCPhys < 0x00100000)
    1247     {
    1248         PDMDevHlpPhysRead(pDevIns, GCPhys, abBuf, PAGE_SIZE);
    1249         if (memcmp(abBuf, pbVirgin, PAGE_SIZE))
    1250         {
    1251             LogRel(("low ROM mismatch! GCPhys=%VGp - Ignore if you've loaded an old saved state with an different VirtualBox version.\n", GCPhys));
    1252             for (unsigned off = 0; off < PAGE_SIZE; off++)
    1253                 if (abBuf[off] != pbVirgin[off])
    1254                     LogRel(("%VGp: %02x expected %02x\n", GCPhys + off, abBuf[off], pbVirgin[off]));
    1255             AssertFailed();
    1256         }
    1257 
    1258         /* next page */
    1259         GCPhys += PAGE_SIZE;
    1260         pbVirgin += PAGE_SIZE;
    1261     }
    1262 
    1263     /* the high ROM mapping. */
    1264     GCPhys = UINT32_C(0xffffffff) - (cbPcBiosBinary - 1);
    1265     pbVirgin = &pu8PcBiosBinary[0];
    1266     while (pbVirgin < &pu8PcBiosBinary[cbPcBiosBinary])
    1267     {
    1268         PDMDevHlpPhysRead(pDevIns, GCPhys, abBuf, PAGE_SIZE);
    1269         if (memcmp(abBuf, pbVirgin, PAGE_SIZE))
    1270         {
    1271             LogRel(("high ROM mismatch! GCPhys=%VGp - Ignore if you've loaded an old saved state with an different VirtualBox version.\n", GCPhys));
    1272             for (unsigned off = 0; off < PAGE_SIZE; off++)
    1273                 if (abBuf[off] != pbVirgin[off])
    1274                     LogRel(("%VGp: %02x expected %02x\n", GCPhys + off, abBuf[off], pbVirgin[off]));
    1275             AssertFailed();
    1276         }
    1277 
    1278         /* next page */
    1279         GCPhys += PAGE_SIZE;
    1280         pbVirgin += PAGE_SIZE;
    1281     }
    1282 #endif
    1283 
    12841069    if (pData->u8IOAPIC)
    12851070        pcbiosPlantMPStable(pDevIns, pData->au8DMIPage + 0x100);
     
    13251110        MMR3HeapFree(pData->pszLanBootFile);
    13261111        pData->pszLanBootFile = NULL;
    1327     }
    1328 
    1329     if (pData->pu8Logo)
    1330     {
    1331         MMR3HeapFree(pData->pu8Logo);
    1332         pData->pu8Logo = NULL;
    1333     }
    1334 
    1335     if (pData->pszLogoFile)
    1336     {
    1337         MMR3HeapFree(pData->pszLogoFile);
    1338         pData->pszLogoFile = NULL;
    13391112    }
    13401113
     
    14181191                              "SataSecondarySlaveLUN\0"
    14191192                              "FloppyDevice\0"
    1420                               "FadeIn\0"
    1421                               "FadeOut\0"
    1422                               "LogoTime\0"
    1423                               "LogoFile\0"
    1424                               "ShowBootMenu\0"
    14251193                              "DelayBoot\0"
    14261194                              "BiosRom\0"
     
    16581426
    16591427    /*
    1660      * Register the BIOS Logo port
    1661      */
    1662     rc = PDMDevHlpIOPortRegister(pDevIns, LOGO_IO_PORT, 1, NULL, logoIOPortWrite, logoIOPortRead, NULL, NULL, "PC BIOS - Logo port");
    1663     if (VBOX_FAILURE(rc))
    1664         return rc;
    1665 
    1666     /*
    1667      * Construct the logo header.
    1668      */
    1669     LOGOHDR LogoHdr = { LOGO_HDR_MAGIC, 0, 0, 0, 0, 0 };
    1670 
    1671     rc = CFGMR3QueryU8(pCfgHandle, "FadeIn", &LogoHdr.u8FadeIn);
    1672     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1673         LogoHdr.u8FadeIn = 1;
    1674     else if (VBOX_FAILURE(rc))
    1675         return PDMDEV_SET_ERROR(pDevIns, rc,
    1676                                 N_("Configuration error: Querying \"FadeIn\" as integer failed"));
    1677 
    1678     rc = CFGMR3QueryU8(pCfgHandle, "FadeOut", &LogoHdr.u8FadeOut);
    1679     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1680         LogoHdr.u8FadeOut = 1;
    1681     else if (VBOX_FAILURE(rc))
    1682         return PDMDEV_SET_ERROR(pDevIns, rc,
    1683                                 N_("Configuration error: Querying \"FadeOut\" as integer failed"));
    1684 
    1685     rc = CFGMR3QueryU16(pCfgHandle, "LogoTime", &LogoHdr.u16LogoMillies);
    1686     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1687         LogoHdr.u16LogoMillies = 1;
    1688     else if (VBOX_FAILURE(rc))
    1689         return PDMDEV_SET_ERROR(pDevIns, rc,
    1690                                 N_("Configuration error: Querying \"LogoTime\" as integer failed"));
    1691 
    1692     rc = CFGMR3QueryU8(pCfgHandle, "ShowBootMenu", &LogoHdr.u8ShowBootMenu);
    1693     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1694         LogoHdr.u8ShowBootMenu = 0;
    1695     else if (VBOX_FAILURE(rc))
    1696         return PDMDEV_SET_ERROR(pDevIns, rc,
    1697                                 N_("Configuration error: Querying \"ShowBootMenu\" as integer failed"));
    1698 
    1699     /*
    1700      * Get the Logo file name.
    1701      */
    1702     rc = CFGMR3QueryStringAlloc(pCfgHandle, "LogoFile", &pData->pszLogoFile);
    1703     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1704         pData->pszLogoFile = NULL;
    1705     else if (VBOX_FAILURE(rc))
    1706         return PDMDEV_SET_ERROR(pDevIns, rc,
    1707                                 N_("Configuration error: Querying \"LogoFile\" as a string failed"));
    1708     else if (!*pData->pszLogoFile)
    1709     {
    1710         MMR3HeapFree(pData->pszLogoFile);
    1711         pData->pszLogoFile = NULL;
    1712     }
    1713 
    1714     /*
    1715      * Determine the logo size, open any specified logo file in the process.
    1716      */
    1717     LogoHdr.cbLogo = g_cbPcDefBiosLogo;
    1718     RTFILE FileLogo = NIL_RTFILE;
    1719     if (pData->pszLogoFile)
    1720     {
    1721         rc = RTFileOpen(&FileLogo, pData->pszLogoFile,
    1722                         RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
    1723         if (VBOX_SUCCESS(rc))
    1724         {
    1725             uint64_t cbFile;
    1726             rc = RTFileGetSize(FileLogo, &cbFile);
    1727             if (VBOX_SUCCESS(rc))
    1728             {
    1729                 if (    cbFile > 0
    1730                     &&  cbFile < LOGO_MAX_SIZE)
    1731                     LogoHdr.cbLogo = (uint32_t)cbFile;
    1732                 else
    1733                     rc = VERR_TOO_MUCH_DATA;
    1734             }
    1735         }
    1736         if (VBOX_FAILURE(rc))
    1737         {
    1738             /*
    1739              * Ignore failure and fall back to the default logo.
    1740              */
    1741             LogRel(("pcbiosConstruct: Failed to open logo file '%s', rc=%Vrc!\n", pData->pszLogoFile, rc));
    1742             RTFileClose(FileLogo);
    1743             FileLogo = NIL_RTFILE;
    1744             MMR3HeapFree(pData->pszLogoFile);
    1745             pData->pszLogoFile = NULL;
    1746         }
    1747     }
    1748 
    1749     /*
    1750      * Allocate buffer for the logo data.
    1751      * RT_MAX() is applied to let us fall back to default logo on read failure.
    1752      */
    1753     pData->cbLogo = sizeof(LogoHdr) + LogoHdr.cbLogo;
    1754     pData->pu8Logo = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, RT_MAX(pData->cbLogo, g_cbPcDefBiosLogo + sizeof(LogoHdr)));
    1755     if (pData->pu8Logo)
    1756     {
    1757         /*
    1758          * Write the logo header.
    1759          */
    1760         PLOGOHDR pLogoHdr = (PLOGOHDR)pData->pu8Logo;
    1761         *pLogoHdr = LogoHdr;
    1762 
    1763         /*
    1764          * Write the logo bitmap.
    1765          */
    1766         if (pData->pszLogoFile)
    1767         {
    1768             rc = RTFileRead(FileLogo, pLogoHdr + 1, LogoHdr.cbLogo, NULL);
    1769             if (VBOX_FAILURE(rc))
    1770             {
    1771                 AssertMsgFailed(("RTFileRead(,,%d,NULL) -> %Vrc\n", LogoHdr.cbLogo, rc));
    1772                 pLogoHdr->cbLogo = LogoHdr.cbLogo = g_cbPcDefBiosLogo;
    1773                 memcpy(pLogoHdr + 1, g_abPcDefBiosLogo, LogoHdr.cbLogo);
    1774             }
    1775         }
    1776         else
    1777             memcpy(pLogoHdr + 1, g_abPcDefBiosLogo, LogoHdr.cbLogo);
    1778 
    1779         /*
    1780          * Call reset to set values and stuff.
    1781          */
    1782         pcbiosReset(pDevIns);
    1783         rc = VINF_SUCCESS;
    1784     }
    1785     else
    1786         rc = VERR_NO_MEMORY;
    1787 
    1788     /* cleanup */
    1789     if (FileLogo != NIL_RTFILE)
    1790         RTFileClose(FileLogo);
     1428     * Call reset to set values and stuff.
     1429     */
     1430    pcbiosReset(pDevIns);
    17911431
    17921432    /*
  • trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp

    r7418 r7759  
    14331433    rc = CFGMR3InsertBytes(pCfg,    "UUID", &Uuid, sizeof(Uuid));                   UPDATE_RC();
    14341434
    1435     /* Default: no bios logo. */
    1436     rc = CFGMR3InsertInteger(pCfg,  "FadeIn",         1);                           UPDATE_RC();
    1437     rc = CFGMR3InsertInteger(pCfg,  "FadeOut",        0);                           UPDATE_RC();
    1438     rc = CFGMR3InsertInteger(pCfg,  "LogoTime",       0);                           UPDATE_RC();
    1439     rc = CFGMR3InsertString(pCfg,   "LogoFile",       "");                          UPDATE_RC();
    1440 
    1441     /* Boot menu */
    1442     rc = CFGMR3InsertInteger(pCfg,  "ShowBootMenu",   g_iBootMenu);                 UPDATE_RC();
    1443 
    14441435    /*
    14451436     * ACPI
     
    16171608    rc = CFGMR3InsertNode(pInst,    "Config",         &pCfg);                       UPDATE_RC();
    16181609    rc = CFGMR3InsertInteger(pCfg,  "VRamSize",       g_u32VRamSize);               UPDATE_RC();
     1610
     1611    /* Default: no bios logo. */
     1612    rc = CFGMR3InsertInteger(pCfg,  "FadeIn",         1);                           UPDATE_RC();
     1613    rc = CFGMR3InsertInteger(pCfg,  "FadeOut",        0);                           UPDATE_RC();
     1614    rc = CFGMR3InsertInteger(pCfg,  "LogoTime",       0);                           UPDATE_RC();
     1615    rc = CFGMR3InsertString(pCfg,   "LogoFile",       "");                          UPDATE_RC();
     1616
     1617    /* Boot menu */
     1618    rc = CFGMR3InsertInteger(pCfg,  "ShowBootMenu",   g_iBootMenu);                 UPDATE_RC();
    16191619
    16201620#ifdef RT_OS_L4
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r7556 r7759  
    292292
    293293    /*
    294      * BIOS logo
    295      */
    296     BOOL fFadeIn;
    297     hrc = biosSettings->COMGETTER(LogoFadeIn)(&fFadeIn);                            H();
    298     rc = CFGMR3InsertInteger(pBiosCfg,  "FadeIn",  fFadeIn ? 1 : 0);                RC_CHECK();
    299     BOOL fFadeOut;
    300     hrc = biosSettings->COMGETTER(LogoFadeOut)(&fFadeOut);                          H();
    301     rc = CFGMR3InsertInteger(pBiosCfg,  "FadeOut", fFadeOut ? 1: 0);                RC_CHECK();
    302     ULONG logoDisplayTime;
    303     hrc = biosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime);               H();
    304     rc = CFGMR3InsertInteger(pBiosCfg,  "LogoTime", logoDisplayTime);               RC_CHECK();
    305     Bstr logoImagePath;
    306     hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam());       H();
    307     rc = CFGMR3InsertString(pBiosCfg,   "LogoFile", logoImagePath ? Utf8Str(logoImagePath) : ""); RC_CHECK();
    308 
    309     /*
    310      * Boot menu
    311      */
    312     BIOSBootMenuMode_T bootMenuMode;
    313     int value;
    314     biosSettings->COMGETTER(BootMenuMode)(&bootMenuMode);
    315     switch (bootMenuMode)
    316     {
    317         case BIOSBootMenuMode_Disabled:
    318             value = 0;
    319             break;
    320         case BIOSBootMenuMode_MenuOnly:
    321             value = 1;
    322             break;
    323         default:
    324             value = 2;
    325     }
    326     rc = CFGMR3InsertInteger(pBiosCfg, "ShowBootMenu", value);                      RC_CHECK();
    327 
    328     /*
    329294     * The time offset
    330295     */
     
    533498    hrc = pMachine->COMGETTER(VRAMSize)(&cRamMBs);                                  H();
    534499    rc = CFGMR3InsertInteger(pCfg,  "VRamSize",             cRamMBs * _1M);         RC_CHECK();
     500
     501    /*
     502     * BIOS logo
     503     */
     504    BOOL fFadeIn;
     505    hrc = biosSettings->COMGETTER(LogoFadeIn)(&fFadeIn);                            H();
     506    rc = CFGMR3InsertInteger(pCfg,  "FadeIn",  fFadeIn ? 1 : 0);                RC_CHECK();
     507    BOOL fFadeOut;
     508    hrc = biosSettings->COMGETTER(LogoFadeOut)(&fFadeOut);                          H();
     509    rc = CFGMR3InsertInteger(pCfg,  "FadeOut", fFadeOut ? 1: 0);                RC_CHECK();
     510    ULONG logoDisplayTime;
     511    hrc = biosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime);               H();
     512    rc = CFGMR3InsertInteger(pCfg,  "LogoTime", logoDisplayTime);               RC_CHECK();
     513    Bstr logoImagePath;
     514    hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam());       H();
     515    rc = CFGMR3InsertString(pCfg,   "LogoFile", logoImagePath ? Utf8Str(logoImagePath) : ""); RC_CHECK();
     516
     517    /*
     518     * Boot menu
     519     */
     520    BIOSBootMenuMode_T bootMenuMode;
     521    int value;
     522    biosSettings->COMGETTER(BootMenuMode)(&bootMenuMode);
     523    switch (bootMenuMode)
     524    {
     525        case BIOSBootMenuMode_Disabled:
     526            value = 0;
     527            break;
     528        case BIOSBootMenuMode_MenuOnly:
     529            value = 1;
     530            break;
     531        default:
     532            value = 2;
     533    }
     534    rc = CFGMR3InsertInteger(pCfg, "ShowBootMenu", value);                      RC_CHECK();
    535535
    536536    /* Custom VESA mode list */
  • trunk/src/VBox/VMM/CFGM.cpp

    r7720 r7759  
    773773    rc = CFGMR3InsertBytes(pCfg,    "UUID", &Uuid, sizeof(Uuid));
    774774    UPDATERC();
    775     /* Bios logo. */
    776     rc = CFGMR3InsertInteger(pCfg,  "FadeIn",               1);
    777     UPDATERC();
    778     rc = CFGMR3InsertInteger(pCfg,  "FadeOut",              1);
    779     UPDATERC();
    780     rc = CFGMR3InsertInteger(pCfg,  "LogoTime",             0);
    781     UPDATERC();
    782     rc = CFGMR3InsertString(pCfg,   "LogoFile",             "");
    783     UPDATERC();
    784775
    785776    /*
     
    886877    rc = CFGMR3InsertInteger(pCfg,  "VRamSize",             4 * _1M);
    887878    UPDATERC();
     879
     880    /* Bios logo. */
     881    rc = CFGMR3InsertInteger(pCfg,  "FadeIn",               1);
     882    UPDATERC();
     883    rc = CFGMR3InsertInteger(pCfg,  "FadeOut",              1);
     884    UPDATERC();
     885    rc = CFGMR3InsertInteger(pCfg,  "LogoTime",             0);
     886    UPDATERC();
     887    rc = CFGMR3InsertString(pCfg,   "LogoFile",             "");
     888    UPDATERC();
     889
    888890#if 0
    889891    rc = CFGMR3InsertNode(pInst,    "LUN#0", &pLunL0);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette