VirtualBox

Changeset 26464 in vbox for trunk/src/VBox/Devices/EFI


Ignore:
Timestamp:
Feb 12, 2010 2:21:27 PM (15 years ago)
Author:
vboxsync
Message:

EFI,Main: managing graphic modes via VBoxInternal2 extradata variables.

Location:
trunk/src/VBox/Devices/EFI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/DevEFI.cpp

    r26289 r26464  
    125125    /* Virtual machine CPU frequency */
    126126    uint64_t        u64CpuFrequency;
     127    /* GOP mode */
     128    uint32_t        u32GopMode;
     129    /* Uga mode resolutions */
     130    uint32_t        u32UgaHorisontal;
     131    uint32_t        u32UgaVertical;
    127132} DEVEFI;
    128133typedef DEVEFI *PDEVEFI;
     
    152157        case EFI_INFO_INDEX_STACK_BASE:
    153158        case EFI_INFO_INDEX_STACK_SIZE:
     159        case EFI_INFO_INDEX_GOP_MODE:
     160        case EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION:
     161        case EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION:
    154162            return 4;
    155163        case EFI_INFO_INDEX_BOOT_ARGS:
     
    209217        case EFI_INFO_INDEX_DEVICE_PROPS:
    210218            return pThis->pu8DeviceProps[pThis->iInfoPosition];
     219        case EFI_INFO_INDEX_GOP_MODE:
     220            value.u32 = pThis->u32GopMode;
     221            break;
     222        case EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION:
     223            value.u32 = pThis->u32UgaHorisontal;
     224            break;
     225        case EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION:
     226            value.u32 = pThis->u32UgaVertical;
     227            break;
    211228        default:
    212229            Assert(false);
     
    10021019                              "BootArgs\0"
    10031020                              "DeviceProps\0"
     1021                              "GopMode\0"
     1022                              "UgaHorizontalResolution\0"
     1023                              "UgaVerticalResolution\0"
    10041024                              ))
    10051025        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
     
    11151135    pThis->u64TscFrequency = pThis->u64FsbFrequency * 3;
    11161136    pThis->u64CpuFrequency = pThis->u64TscFrequency;
    1117 
     1137    /*
     1138     * GOP graphics
     1139     */
     1140    rc = CFGMR3QueryU32(pCfg, "GopMode", &pThis->u32GopMode);
     1141    AssertRC(rc);
     1142    if (pThis->u32GopMode == UINT32_MAX)
     1143    {
     1144        pThis->u32GopMode = 2; /* 1024x768 */
     1145    }
     1146    /*
     1147     * Uga graphics
     1148     */
     1149    rc = CFGMR3QueryU32(pCfg, "UgaHorizontalResolution", &pThis->u32UgaHorisontal);
     1150    AssertRC(rc);
     1151    if (pThis->u32UgaHorisontal == 0)
     1152    {
     1153        pThis->u32UgaHorisontal = 1024; /* 1024x768 */
     1154    }
     1155    rc = CFGMR3QueryU32(pCfg, "UgaVerticalResolution", &pThis->u32UgaVertical);
     1156    AssertRC(rc);
     1157    if (pThis->u32UgaVertical == 0)
     1158    {
     1159        pThis->u32UgaVertical = 768; /* 1024x768 */
     1160    }
    11181161
    11191162#ifdef DEVEFI_WITH_VBOXDBG_SCRIPT
  • trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Include/DevEFI.h

    r26203 r26464  
    5959    EFI_INFO_INDEX_CPU_FREQUENCY,
    6060    EFI_INFO_INDEX_TSC_FREQUENCY,
     61    EFI_INFO_INDEX_GOP_MODE,
     62    EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION,
     63    EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION,
    6164    EFI_INFO_INDEX_END
    6265} EfiInfoIndex;
  • trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c

    r26441 r26464  
    2121
    2222#include "VBoxConsole.h"
     23#include "VBoxPkg.h"
     24#include "DevEFI.h"
     25#include "iprt/asm.h"
    2326
    2427/* @todo understand the reasons why TextOutputProtocol.SetMode isn't enough to switch mode. */
     
    3033static EFI_GRAPHICS_OUTPUT_PROTOCOL    *Gop;
    3134static EFI_UGA_DRAW_PROTOCOL           *Uga;
     35
     36/*
     37 *   @todo move this function to the library.
     38 */
     39static UINT32
     40GetVmVariable(UINT32 Variable, CHAR8* Buffer, UINT32 Size )
     41{
     42    UINT32 VarLen, i;
     43
     44
     45    ASMOutU32(EFI_INFO_PORT, Variable);
     46    VarLen = ASMInU32(EFI_INFO_PORT);
     47
     48    for (i=0; i < VarLen && i < Size; i++)
     49    {
     50        Buffer[i] = ASMInU8(EFI_INFO_PORT);
     51    }
     52
     53    return VarLen;
     54}
    3255
    3356static VOID
     
    4366    DEBUG((DEBUG_INFO, "%a:%d - SwitchMode\n", __FILE__,  __LINE__));
    4467    if (Gop)
    45         r = Gop->SetMode(Gop, 2);
    46     if (Uga)
    47         r = Uga->SetMode(Uga, 1024, 768, 32, 60);
     68    {
     69        UINT32 mode = 2;
     70        GetVmVariable(EFI_INFO_INDEX_GOP_MODE, (CHAR8 *)&mode, sizeof(UINT32));
     71        r = Gop->SetMode(Gop, mode);
     72    }
     73    else if (Uga)
     74    {
     75        UINT32 H = 1027;
     76        UINT32 V = 768;
     77        GetVmVariable(EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION, (CHAR8 *)&H, sizeof(UINT32));
     78        GetVmVariable(EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION, (CHAR8 *)&V, sizeof(UINT32));
     79        r = Uga->SetMode(Uga, H, V, 32, 60);
     80    }
    4881    if(EFI_ERROR(r))
    4982    {
Note: See TracChangeset for help on using the changeset viewer.

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