VirtualBox

Changeset 81458 in vbox


Ignore:
Timestamp:
Oct 22, 2019 4:50:13 PM (5 years ago)
Author:
vboxsync
Message:

DevEFI,VBoxDD2: More preps for baking the EFI firmware images into VBoxDD2.

Location:
trunk/src/VBox/Devices
Files:
5 edited

Legend:

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

    r81455 r81458  
    173173
    174174    /** The system EFI ROM data. */
    175     uint8_t                *pu8EfiRom;
     175    uint8_t const          *pu8EfiRom;
     176    /** The system EFI ROM data pointer to be passed to RTFileReadAllFree. */
     177    uint8_t                *pu8EfiRomFree;
    176178    /** The size of the system EFI ROM. */
    177179    uint64_t                cbEfiRom;
     
    314316/** The EfiSystemNvDataFv GUID for NVRAM storage. */
    315317static const RTUUID g_UuidNvDataFv = { { 0x8d, 0x2b, 0xf1, 0xff, 0x96, 0x76, 0x8b, 0x4c, 0xa9, 0x85, 0x27, 0x47, 0x07, 0x5b, 0x4f, 0x50} };
     318
     319#ifdef VBOX_WITH_EFI_IN_DD2
     320/** Special file name value for indicating the 32-bit built-in EFI firmware. */
     321static const char g_szEfiBuiltin32[] = "VBoxEFI32.fd";
     322/** Special file name value for indicating the 64-bit built-in EFI firmware. */
     323static const char g_szEfiBuiltin64[] = "VBoxEFI64.fd";
     324#endif
     325
    316326
    317327
     
    19421952    }
    19431953
    1944     if (pThis->pu8EfiRom)
    1945     {
    1946         RTFileReadAllFree(pThis->pu8EfiRom, (size_t)pThis->cbEfiRom + pThis->offEfiRom);
    1947         pThis->pu8EfiRom = NULL;
     1954    if (pThis->pu8EfiRomFree)
     1955    {
     1956        RTFileReadAllFree(pThis->pu8EfiRomFree, (size_t)pThis->cbEfiRom + pThis->offEfiRom);
     1957        pThis->pu8EfiRomFree = NULL;
    19481958    }
    19491959
     
    20792089     * Read the entire firmware volume into memory.
    20802090     */
    2081     void   *pvFile;
    2082     size_t  cbFile;
    2083     int rc = RTFileReadAllEx(pThis->pszEfiRomFile,
     2091    int     rc;
     2092#ifdef VBOX_WITH_EFI_IN_DD2
     2093    if (RTStrCmp(pThis->pszEfiRomFile, g_szEfiBuiltin32) == 0)
     2094    {
     2095        pThis->pu8EfiRomFree = NULL;
     2096        pThis->pu8EfiRom = g_abEfiFirmware32;
     2097        pThis->cbEfiRom  = g_cbEfiFirmware32;
     2098    }
     2099    else if (RTStrCmp(pThis->pszEfiRomFile, g_szEfiBuiltin64) == 0)
     2100    {
     2101        pThis->pu8EfiRomFree = NULL;
     2102        pThis->pu8EfiRom = g_abEfiFirmware64;
     2103        pThis->cbEfiRom  = g_cbEfiFirmware64;
     2104    }
     2105    else
     2106#endif
     2107    {
     2108        void   *pvFile;
     2109        size_t  cbFile;
     2110        rc = RTFileReadAllEx(pThis->pszEfiRomFile,
    20842111                             0 /*off*/,
    20852112                             RTFOFF_MAX /*cbMax*/,
     
    20872114                             &pvFile,
    20882115                             &cbFile);
    2089     if (RT_FAILURE(rc))
    2090         return PDMDevHlpVMSetError(pThis->pDevIns, rc, RT_SRC_POS,
    2091                                    N_("Loading the EFI firmware volume '%s' failed with rc=%Rrc"),
    2092                                    pThis->pszEfiRomFile, rc);
    2093     pThis->pu8EfiRom = (uint8_t *)pvFile;
    2094     pThis->cbEfiRom  = cbFile;
     2116        if (RT_FAILURE(rc))
     2117            return PDMDevHlpVMSetError(pThis->pDevIns, rc, RT_SRC_POS,
     2118                                       N_("Loading the EFI firmware volume '%s' failed with rc=%Rrc"),
     2119                                       pThis->pszEfiRomFile, rc);
     2120        pThis->pu8EfiRomFree = (uint8_t *)pvFile;
     2121        pThis->pu8EfiRom = (uint8_t *)pvFile;
     2122        pThis->cbEfiRom  = cbFile;
     2123    }
    20952124
    20962125    /*
     
    24032432     * Get the system EFI ROM file name.
    24042433     */
     2434#ifdef VBOX_WITH_EFI_IN_DD2
     2435    rc = CFGMR3QueryStringAllocDef(pCfg, "EfiRom", &pThis->pszEfiRomFile, g_szEfiBuiltin32);
     2436    if (RT_FAILURE(rc))
     2437#else
    24052438    rc = CFGMR3QueryStringAlloc(pCfg, "EfiRom", &pThis->pszEfiRomFile);
    24062439    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    24072440    {
    24082441        pThis->pszEfiRomFile = (char *)PDMDevHlpMMHeapAlloc(pDevIns, RTPATH_MAX);
    2409         if (!pThis->pszEfiRomFile)
    2410             return VERR_NO_MEMORY;
    2411 
     2442        AssertReturn(pThis->pszEfiRomFile, VERR_NO_MEMORY);
    24122443        rc = RTPathAppPrivateArchTop(pThis->pszEfiRomFile, RTPATH_MAX);
    24132444        AssertRCReturn(rc, rc);
     
    24162447    }
    24172448    else if (RT_FAILURE(rc))
     2449#endif
    24182450        return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    24192451                                   N_("Configuration error: Querying \"EfiRom\" as a string failed"));
    2420     else if (!*pThis->pszEfiRomFile)
    2421     {
    2422         MMR3HeapFree(pThis->pszEfiRomFile);
    2423         pThis->pszEfiRomFile = NULL;
    2424     }
    2425 
    24262452
    24272453    /*
  • trunk/src/VBox/Devices/EFI/FlashCore.cpp

    r81266 r81458  
    284284}
    285285
    286 DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void *pvBuf, size_t cbBuf)
     286DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void const *pvBuf, size_t cbBuf)
    287287{
    288288    AssertReturn(pThis->cbFlashSize >= cbBuf, VERR_BUFFER_OVERFLOW);
  • trunk/src/VBox/Devices/EFI/FlashCore.h

    r81250 r81458  
    148148 * @param   cbBuf               Size of the buffer in bytes.
    149149 */
    150 DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void *pvBuf, size_t cbBuf);
     150DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void const *pvBuf, size_t cbBuf);
    151151
    152152/**
  • trunk/src/VBox/Devices/Makefile.kmk

    r81450 r81458  
    10641064 VBoxDD2_LDFLAGS.darwin  = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDD2.dylib
    10651065 VBoxDD2_LDFLAGS.linux   = $(VBOX_GCC_NO_UNDEFINED)
    1066  if 0
     1066 if defined(VBOX_WITH_EFI) && 0 ## @todo need to update installers.
     1067  VBoxDD_DEFS           += VBOX_WITH_EFI_IN_DD2
     1068  VBoxDD2_DEFS          += VBOX_WITH_EFI
    10671069  VBoxDD2_SOURCES       += \
    10681070        EFI/DevEFI-binaries.asm
  • trunk/src/VBox/Devices/build/VBoxDD2.h

    r80531 r81458  
    4545extern DECLEXPORT(const unsigned)       g_cbNetBiosBinary;
    4646# endif
     47# ifdef VBOX_WITH_EFI_IN_DD2
     48extern DECLEXPORT(const unsigned char)  g_abEfiFirmware32[];
     49extern DECLEXPORT(const unsigned)       g_cbEfiFirmware32;
     50extern DECLEXPORT(const unsigned char)  g_abEfiFirmware64[];
     51extern DECLEXPORT(const unsigned)       g_cbEfiFirmware64;
     52# endif
    4753#else  /* !IN_VBOXDD2 */
    4854extern DECLIMPORT(const unsigned char)  g_abPcBiosBinary386[];
     
    6268extern DECLIMPORT(const unsigned)       g_cbNetBiosBinary;
    6369# endif
     70# ifdef VBOX_WITH_EFI_IN_DD2
     71extern DECLIMPORT(const unsigned char)  g_abEfiFirmware32[];
     72extern DECLIMPORT(const unsigned)       g_cbEfiFirmware32;
     73extern DECLIMPORT(const unsigned char)  g_abEfiFirmware64[];
     74extern DECLIMPORT(const unsigned)       g_cbEfiFirmware64;
     75# endif
    6476#endif /* !IN_VBOXDD2 */
    6577
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