VirtualBox

Changeset 72631 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 20, 2018 2:18:56 PM (7 years ago)
Author:
vboxsync
Message:

EFI: Added option to not put ROM range into the NVRAM firmware volume and leave it alone for flash use.

File:
1 edited

Legend:

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

    r72500 r72631  
    174174    /** The size of the system EFI ROM. */
    175175    uint64_t                cbEfiRom;
     176    /** Offset into the actual ROM within EFI FW volume. */
     177    uint64_t                uEfiRomOfs;
    176178    /** The name of the EFI ROM file. */
    177179    char                   *pszEfiRomFile;
     
    198200    /** The DMI tables. */
    199201    uint8_t                 au8DMIPage[0x1000];
     202
     203    /** Should NVRAM range be reserved for flash? */
     204    bool                    fSkipNvramRange;
    200205
    201206    /** I/O-APIC enabled? */
     
    18941899    if (pThis->pu8EfiRom)
    18951900    {
    1896         RTFileReadAllFree(pThis->pu8EfiRom, (size_t)pThis->cbEfiRom);
     1901        RTFileReadAllFree(pThis->pu8EfiRom, (size_t)pThis->cbEfiRom + pThis->uEfiRomOfs);
    18971902        pThis->pu8EfiRom = NULL;
    18981903    }
     
    19851990    AssertLogRelMsgReturn(!(pThis->cbEfiRom & PAGE_OFFSET_MASK), ("%RX64\n", pThis->cbEfiRom), VERR_INVALID_PARAMETER);
    19861991
     1992    LogRel(("Found EFI FW Volume, %u bytes (%u %u-byte blocks)\n", pFwVolHdr->FvLength, pFwVolHdr->BlockMap[0].NumBlocks, pFwVolHdr->BlockMap[0].Length));
     1993
     1994    /* Adjust the FW variables to skip the NVRAM volume. */
     1995    if (pThis->fSkipNvramRange)
     1996    {
     1997        pThis->cbEfiRom  -= pFwVolHdr->FvLength;
     1998        pThis->uEfiRomOfs = pFwVolHdr->FvLength;
     1999    }
     2000
    19872001    pThis->GCLoadAddress = UINT32_C(0xfffff000) - pThis->cbEfiRom + PAGE_SIZE;
    19882002
     
    20362050                              pThis->GCLoadAddress,
    20372051                              cbQuart,
    2038                               pThis->pu8EfiRom,
     2052                              pThis->pu8EfiRom + pThis->uEfiRomOfs,
    20392053                              cbQuart,
    20402054                              PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY,
     
    20462060                              pThis->GCLoadAddress + cbQuart,
    20472061                              cbQuart,
    2048                               pThis->pu8EfiRom + cbQuart,
     2062                              pThis->pu8EfiRom + pThis->uEfiRomOfs + cbQuart,
    20492063                              cbQuart,
    20502064                              PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY,
     
    20552069                              pThis->GCLoadAddress + cbQuart * 2,
    20562070                              cbQuart,
    2057                               pThis->pu8EfiRom + cbQuart * 2,
     2071                              pThis->pu8EfiRom + pThis->uEfiRomOfs + cbQuart * 2,
    20582072                              cbQuart,
    20592073                              PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY,
     
    20642078                              pThis->GCLoadAddress + cbQuart * 3,
    20652079                              pThis->cbEfiRom - cbQuart * 3,
    2066                               pThis->pu8EfiRom + cbQuart * 3,
     2080                              pThis->pu8EfiRom + pThis->uEfiRomOfs + cbQuart * 3,
    20672081                              pThis->cbEfiRom - cbQuart * 3,
    20682082                              PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY,
     
    21982212                              "BootArgs\0"
    21992213                              "DeviceProps\0"
     2214                              "SkipNvramRange\0"            // legacy
    22002215                              "GopMode\0"                   // legacy
    22012216                              "GraphicsMode\0"
     
    22702285        pThis->pszEfiRomFile = NULL;
    22712286    }
     2287
     2288    rc = CFGMR3QueryBoolDef(pCfg, "SkipNvramRange", &pThis->fSkipNvramRange, false);
     2289    if (RT_FAILURE(rc))
     2290        return PDMDEV_SET_ERROR(pDevIns, rc,
     2291                                N_("Configuration error: Querying \"SkipNvramRange\" as integer failed"));
     2292
    22722293
    22732294    /*
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