Nvram.cpp revision 695473895b95e1e759e9973c1b8da00c5788a074
/* $Id$ */
/** @file
* VBox NVRAM COM Class implementation
*/
/*
* Copyright (C) 2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "Nvram.h"
#include "ConsoleImpl.h"
#include <iprt/critsect.h>
#include <iprt/semaphore.h>
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
struct NVRAM
{
int cLoadedVariables;
};
/**
*/
{
}
{
if (mpDrv)
{
}
}
/**
* @interface_method_impl(PDMINVRAM,pfnStoreNvramValue)
*/
int idxVariable,
const char *pcszVariableName,
{
int rc = VINF_SUCCESS;
char szExtraDataKey[256];
char szExtraDataValue[1024];
LogFlowFunc(("ENTER: pVendorUuid:%RTuuid, pcszVariableName:%s, cbVariableName:%d, pu8Value:%.*Rhxs, cbValue:%d\n",
cbValue));
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableName", idxVariable);
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VendorGuid", idxVariable);
if (pVendorUuid)
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableValueLength", idxVariable);
if (!cbValue)
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableValue", idxVariable);
if (pu8Value)
pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraDataKey).raw(), Bstr(szExtraDataValue).raw());
return rc;
}
/**
* @interface_method_impl(PDMINVRAM,pfnFlushNvramStorage)
*/
{
int rc = VINF_SUCCESS;
int idxVariable = 0;
{
}
return rc;
}
/**
* @interface_method_impl(PDMINVRAM,pfnStoreNvramValue)
*/
int idxVariable,
char *pcszVariableName,
{
int rc = VINF_SUCCESS;
char szExtraDataKey[256];
LogFlowFunc(("ENTER: idxVariable:%d, *pcbVariableName:%d, *pcbValue:%d\n",
*pcbValue));
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableName", idxVariable);
hrc = pThis->pNvram->getParent()->machine()->GetExtraData(Bstr(szExtraDataKey).raw(), bstrValue.asOutParam());
return VERR_NOT_FOUND;
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VendorGuid", idxVariable);
hrc = pThis->pNvram->getParent()->machine()->GetExtraData(Bstr(szExtraDataKey).raw(), bstrValue.asOutParam());
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableValueLength", idxVariable);
hrc = pThis->pNvram->getParent()->machine()->GetExtraData(Bstr(szExtraDataKey).raw(), bstrValue.asOutParam());
RTStrPrintf(szExtraDataKey, 256, "VBoxInternal/Devices/efi/0/LUN#0/Config/NVRAM/%d/VariableValue", idxVariable);
hrc = pThis->pNvram->getParent()->machine()->GetExtraData(Bstr(szExtraDataKey).raw(), bstrValue.asOutParam());
return rc;
}
/**
* @interface_method_impl(PDMIBASE,pfnQueryInterface)
*/
{
return NULL;
}
/**
* @interface_method_impl(PDMDRVREG,pfnConstruct)
*/
{
("Configuration error: Not possible to attach anything to this driver!\n"),
void *pv;
return VINF_SUCCESS;
}
/**
* @interface_method_impl(PDMDRVREG,pfnDestruct)
*/
{
}
{
/* u32Version */
/* szName[32] */
"NvramStorage",
/* szRCMod[32] */
"",
/* szR0Mod[32] */
"",
/* pszDescription */
"NVRAM Main Driver",
/* fFlags */
/* fClass */
/* cMaxInstances */
1,
/* cbInstance */
sizeof(NVRAM),
/* pfnConstruct */
/* pfnDestruct */
/* pfnRelocate */
NULL,
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnPowerOff */
NULL,
/* pfnSoftReset */
NULL,
/* u32VersionEnd */
};
/* vi: set tabstop=4 shiftwidth=4 expandtab: */