VirtualBox

Changeset 6871 in vbox for trunk


Ignore:
Timestamp:
Feb 8, 2008 4:51:00 PM (17 years ago)
Author:
vboxsync
Message:

allow to overwrite the DMI info

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/Makefile.kmk

    r5999 r6871  
    6262
    6363# 1. precompile rombios.c
    64 $(PATH_TARGET)/_rombios_.c: $(PATH_SUB_CURRENT)/rombios.c $(PATH_SUB_CURRENT)/logo.c $(PATH_SUB_CURRENT)/apmbios.S | $(call DIRDEP,$(TARGET_PATH))
     64$(PATH_TARGET)/_rombios_.c: $(PATH_SUB_CURRENT)/rombios.c $(PATH_SUB_CURRENT)/logo.c $(PATH_SUB_CURRENT)/apmbios.S $(PATH_SUB_CURRENT)/../DevPcBios.h | $(call DIRDEP,$(TARGET_PATH))
    6565        $(call MSG_TOOL,cpp,PcBiosBin,$<,$@)
    6666        $(QUIET)$(TOOL_$(VBOX_GCC_TOOL)_CC) -E -I$(PATH_TARGET) -I$(VBOX_PATH_DEVICES_SRC)/PC -I$(PATH_ROOT)/include -I$(PATH_OUT) -DBX_SMP_PROCESSORS=1 -DVBOX $(addprefix -D,$(DEFS) $(DEFS.$(BUILD_TYPE))) -P -o $@ $<
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r6374 r6871  
    2828#include <iprt/file.h>
    2929#include <iprt/string.h>
     30#include <iprt/uuid.h>
    3031#include <VBox/err.h>
    3132#include <VBox/param.h>
     
    827828 * @param   table           pointer to DMI table.
    828829 */
    829 #define STRCPY(p, s) do { memcpy (p, s, sizeof(s)); p += sizeof(s); } while (0)
    830 static void pcbiosPlantDMITable(uint8_t *pTable, PRTUUID puuid)
     830#define STRCPY(p, s) do { memcpy (p, s, strlen(s)+1); p += strlen(s)+1; } while (0)
     831#define READCFG(name, variable, default_value) \
     832    do { \
     833        rc = CFGMR3QueryStringAlloc(pCfgHandle, name, & variable); \
     834        if (rc == VERR_CFGM_VALUE_NOT_FOUND) \
     835            variable = MMR3HeapStrDup(PDMDevHlpGetVM(pDevIns), MM_TAG_CFGM, default_value); \
     836        else if (VBOX_FAILURE(rc)) \
     837            return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, \
     838                    N_("Configuration error: Querying \"" name "\" as a string failed")); \
     839    } while (0)
     840
     841static int pcbiosPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, PRTUUID puuid, PCFGMNODE pCfgHandle)
    831842{
    832843    char *pszStr = (char*)pTable;
    833844    int iStrNr;
     845    int rc;
     846    char *pszDmiVendor, *pszDmiProduct, *pszDmiVersion, *pszDmiRelease, *pszDmiSerial, *pszDmiUuid = NULL, *pszDmiFamily;
     847
     848    READCFG("DmiVendor",  pszDmiVendor,  "innotek GmbH");
     849    READCFG("DmiProduct", pszDmiProduct, "VirtualBox");
     850    READCFG("DmiVersion", pszDmiVersion, "1.2");
     851    READCFG("DmiRelease", pszDmiRelease, "12/01/2006");
     852    READCFG("DmiSerial",  pszDmiSerial,  "0");
     853    rc = CFGMR3QueryStringAlloc(pCfgHandle, "DmiUuid", &pszDmiUuid);
     854    if (VBOX_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND)
     855        return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     856                                   N_("Configuration error: Querying \"DmiUuid\" as a string failed"));
     857    READCFG("DmiFamily",  pszDmiFamily,   "Virtual Machine");
    834858
    835859    PDMIBIOSINF pBIOSInf         = (PDMIBIOSINF)pszStr;
     
    840864    pBIOSInf->header.u16Handle   = 0x0000;
    841865    pBIOSInf->u8Vendor           = iStrNr++;
    842     STRCPY(pszStr, "innotek GmbH");
     866    STRCPY(pszStr, pszDmiVendor);
    843867    pBIOSInf->u8Version          = iStrNr++;
    844     STRCPY(pszStr, "VirtualBox");
     868    STRCPY(pszStr, pszDmiProduct);
    845869    pBIOSInf->u16Start           = 0xE000;
    846870    pBIOSInf->u8Release          = iStrNr++;
    847     STRCPY(pszStr, "12/01/2006");
     871    STRCPY(pszStr, pszDmiRelease);
    848872    pBIOSInf->u8ROMSize          = 1; /* 128K */
    849873    pBIOSInf->u64Characteristics = RT_BIT(4)   /* ISA is supported */
     
    871895    pSystemInf->header.u16Handle = 0x0001;
    872896    pSystemInf->u8Manufacturer   = iStrNr++;
    873     STRCPY(pszStr, "innotek GmbH");
     897    STRCPY(pszStr, pszDmiVendor);
    874898    pSystemInf->u8ProductName    = iStrNr++;
    875     STRCPY(pszStr, "VirtualBox");
     899    STRCPY(pszStr, pszDmiProduct);
    876900    pSystemInf->u8Version        = iStrNr++;
    877     STRCPY(pszStr, "1.2");
     901    STRCPY(pszStr, pszDmiVersion);
    878902    pSystemInf->u8SerialNumber   = iStrNr++;
    879     STRCPY(pszStr, "0");
     903    STRCPY(pszStr, pszDmiSerial);
     904
     905    RTUUID uuid;
     906    if (pszDmiUuid)
     907    {
     908        int rc = RTUuidFromStr(&uuid, pszDmiUuid);
     909        if (VBOX_FAILURE(rc))
     910            return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     911                                       N_("Invalid UUID for DMI tables specified"));
     912        uuid.Gen.u32TimeLow = RT_H2BE_U32(uuid.Gen.u32TimeLow);
     913        uuid.Gen.u16TimeMid = RT_H2BE_U16(uuid.Gen.u16TimeMid);
     914        uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion);
     915        puuid = &uuid;
     916    }
    880917    memcpy(pSystemInf->au8Uuid, puuid, sizeof(RTUUID));
     918
    881919    pSystemInf->u8WakeupType     = 6; /* Power Switch */
    882920    pSystemInf->u8SKUNumber      = 0;
    883921    pSystemInf->u8Family         = iStrNr++;
    884     STRCPY(pszStr, "Virtual Machine");
     922    STRCPY(pszStr, pszDmiFamily);
    885923    *pszStr++                    = '\0';
    886924
    887     AssertMsg(pszStr - (char*)pTable == VBOX_DMI_TABLE_SIZE,
    888               ("VBOX_DMI_TABLE_SIZE=%d, actual DMI table size is %d",
    889               VBOX_DMI_TABLE_SIZE, pszStr - (char*)pTable));
     925    MMR3HeapFree(pszDmiVendor);
     926    MMR3HeapFree(pszDmiProduct);
     927    MMR3HeapFree(pszDmiVersion);
     928    MMR3HeapFree(pszDmiRelease);
     929    MMR3HeapFree(pszDmiSerial);
     930    MMR3HeapFree(pszDmiUuid);
     931    MMR3HeapFree(pszDmiFamily);
     932
     933    if (pszStr - (char*)pTable > VBOX_DMI_TABLE_SIZE)
     934        return PDMDevHlpVMSetError(pDevIns, VERR_NO_MEMORY, RT_SRC_POS,
     935                                   N_("DMI table too long (have=%d, max=%d)"), pszStr - (char*)pTable, VBOX_DMI_TABLE_SIZE);
     936
     937    return VINF_SUCCESS;
    890938}
     939#undef STRCPY
    891940AssertCompile(VBOX_DMI_TABLE_ENTR == 2);
    892941
     
    12171266     */
    12181267    if (!CFGMR3AreValuesValid(pCfgHandle,
    1219                               "BootDevice0\0"
    1220                               "BootDevice1\0"
    1221                               "BootDevice2\0"
    1222                               "BootDevice3\0"
    1223                               "RamSize\0"
    1224                               "HardDiskDevice\0"
    1225                               "FloppyDevice\0"
    1226                               "FadeIn\0"
    1227                               "FadeOut\0"
    1228                               "LogoTime\0"
    1229                               "LogoFile\0"
    1230                               "ShowBootMenu\0"
    1231                               "DelayBoot\0"
    1232                               "BiosRom\0"
    1233                               "LanBootRom\0"
    1234                               "PXEDebug\0"
    1235                               "UUID\0"
    1236                               "IOAPIC\0"))
     1268                              "BootDevice0\0BootDevice1\0BootDevice2\0BootDevice3\0"
     1269                              "RamSize\0HardDiskDevice\0FloppyDevice\0FadeIn\0FadeOut\0LogoTime\0LogoFile\0"
     1270                              "ShowBootMenu\0DelayBoot\0BiosRom\0LanBootRom\0PXEDebug\0UUID\0IOAPIC\0"
     1271                              "DmiVendor\0DmiProduct\0DmiVersion\0DmiSerial\0DmiUuid\0DmiFamily\0"))
    12371272        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    12381273                                N_("Invalid configuraton for  device pcbios device"));
     
    12981333    uuid.Gen.u16TimeMid = RT_H2BE_U16(uuid.Gen.u16TimeMid);
    12991334    uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion);
    1300     pcbiosPlantDMITable(pData->au8DMIPage, &uuid);
     1335    rc = pcbiosPlantDMITable(pDevIns, pData->au8DMIPage, &uuid, pCfgHandle);
     1336    if (VBOX_FAILURE(rc))
     1337        return rc;
    13011338    if (pData->u8IOAPIC)
    13021339        pcbiosPlantMPStable(pDevIns, pData->au8DMIPage + 0x100);
  • trunk/src/VBox/Devices/PC/DevPcBios.h

    r5999 r6871  
    2020
    2121#define VBOX_DMI_TABLE_ENTR          2
    22 #define VBOX_DMI_TABLE_SIZE          130
     22#define VBOX_DMI_TABLE_SIZE          180 /* XXX make this variable */
    2323#define VBOX_DMI_TABLE_BASE          0xe1000
    2424#define VBOX_DMI_TABLE_VER           0x23
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