DevFwCommon.cpp revision d138470380992d2278e931dd308f5cbdb771357e
/* $Id$ */
/** @file
* Shared firmware code.
*/
/*
* Copyright (C) 2009 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
/** @todo: what should it be? */
#define LOG_GROUP LOG_GROUP_DEV_PC_BIOS
#include <iprt/buildconfig.h>
#include "../Builtins.h"
#include "../Builtins2.h"
#include "DevFwCommon.h"
#pragma pack(1)
/** DMI header */
typedef struct DMIHDR
{
} *PDMIHDR;
/** DMI BIOS information (Type 0) */
typedef struct DMIBIOSINF
{
} *PDMIBIOSINF;
/** DMI system information (Type 1) */
typedef struct DMISYSTEMINF
{
} *PDMISYSTEMINF;
/** DMI system enclosure or chassis type (Type 3) */
typedef struct DMICHASSIS
{
/* v2.3+, currently not supported */
} *PDMICHASSIS;
/** DMI processor information (Type 4) */
typedef struct DMIPROCESSORINF
{
} *PDMIPROCESSORINF;
/** DMI OEM strings (Type 11) */
typedef struct DMIOEMSTRINGS
{
} *PDMIOEMSTRINGS;
/** MPS floating pointer structure */
typedef struct MPSFLOATPTR
{
} *PMPSFLOATPTR;
/** MPS config table header */
typedef struct MPSCFGTBLHEADER
{
} *PMPSCFGTBLHEADER;
/** MPS processor entry */
typedef struct MPSPROCENTRY
{
} *PMPSPROCENTRY;
/** MPS bus entry */
typedef struct MPSBUSENTRY
{
} *PMPSBUSENTRY;
typedef struct MPSIOAPICENTRY
{
} *PMPSIOAPICENTRY;
/** MPS I/O-Interrupt entry */
typedef struct MPSIOINTERRUPTENTRY
{
} *PMPSIOIRQENTRY;
#pragma pack()
/**
* Calculate a simple checksum for the MPS table.
*
* @param data data
* @param len size of data
*/
{
return -u8Sum;
}
/**
* Construct the DMI table.
*
* @returns VBox status code.
* @param pDevIns The device instance.
* @param pTable Where to create the DMI table.
* @param cbMax The max size of the DMI table.
* @param pUuid Pointer to the UUID to use if the DmiUuid
* configuration string isn't present.
* @param pCfgHandle The handle to our config node.
*/
int sharedfwPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PRTUUID pUuid, PCFGMNODE pCfgHandle)
{
int iStrNr;
int rc;
char *pszDmiSystemVendor, *pszDmiSystemProduct, *pszDmiSystemVersion, *pszDmiSystemSerial, *pszDmiSystemUuid, *pszDmiSystemFamily;
char *pszDmiOEMVBoxVer, *pszDmiOEMVBoxRev;
do { \
size_t _max = (size_t)(pszStr + want - (char *)pTable) + 5; /* +1 for strtab terminator +4 for end-of-table entry */ \
{ \
N_("One of the DMI strings is too long. Check all bios/Dmi* configuration entries. At least %zu bytes are needed but there is no space for more than %d bytes"), _max, cbMax); \
} \
} while (0)
do { \
if (!str[0]) \
memb = 0; /* empty string */ \
else \
{ \
} \
} while (0)
do { \
if (rc == VERR_CFGM_VALUE_NOT_FOUND) \
else if (RT_FAILURE(rc)) \
variable[0] = '\0'; \
} while (0)
do { \
if (rc == VERR_CFGM_VALUE_NOT_FOUND) \
variable = default_value; \
else if (RT_FAILURE(rc)) \
} while (0)
/*
* Don't change this information otherwise Windows guests will demand re-activation!
*/
if (rc == VERR_CFGM_VALUE_NOT_FOUND)
else if (RT_FAILURE(rc))
N_("Configuration error: Querying \"DmiUuid\" as a string failed"));
/* DMI BIOS information (Type 0) */
/* don't set these fields by default for legacy compatibility */
if (iDmiBIOSReleaseMajor != 0 || iDmiBIOSReleaseMinor != 0)
{
if (iDmiBIOSFirmwareMajor != 0 || iDmiBIOSFirmwareMinor != 0)
{
}
}
iStrNr = 1;
/* any more?? */
;
/* any more?? */
;
/* any more?? */
;
*pszStr++ = '\0';
/* DMI system information (Type 1) */
CHECKSIZE(sizeof(*pSystemInf));
iStrNr = 1;
if (pszDmiSystemUuid)
{
if (RT_FAILURE(rc))
N_("Invalid UUID for DMI tables specified"));
}
pSystemInf->u8SKUNumber = 0;
*pszStr++ = '\0';
/* DMI System Enclosure or Chassis (Type 3) */
iStrNr = 1;
#ifdef VBOX_WITH_DMI_CHASSIS
#else
#endif
# if 0
/* v2.3+, currently not supported */
pChassis->u32OEMdefined = 0;
# endif
*pszStr++ = '\0';
/* DMI OEM strings */
CHECKSIZE(sizeof(*pOEMStrings));
iStrNr = 1;
#ifdef VBOX_WITH_DMI_OEMSTRINGS
#else
#endif
char szTmp[64];
*pszStr++ = '\0';
/* End-of-table marker - includes padding to account for fixed table size. */
/* If more fields are added here, fix the size check in SETSTRING */
return VINF_SUCCESS;
}
/**
* Construct the MPS table. Only applicable if IOAPIC is active!
*
* See ``MultiProcessor Specificatiton Version 1.4 (May 1997)'':
* ``1.3 Scope
* ...
* The hardware required to implement the MP specification is kept to a
* minimum, as follows:
* * One or more processors that are Intel architecture instruction set
* compatible, such as the CPUs in the Intel486 or Pentium processor
* family.
* * One or more APICs, such as the Intel 82489DX Advanced Programmable
* Interrupt Controller or the integrated APIC, such as that on the
* Intel Pentium 735\90 and 815\100 processors, together with a discrete
* I/O APIC unit.''
* and later:
* ``4.3.3 I/O APIC Entries
* The configuration table contains one or more entries for I/O APICs.
* ...
* I/O APIC FLAGS: EN 3:0 1 If zero, this I/O APIC is unusable, and the
* operating system should not attempt to access
* this I/O APIC.
* At least one I/O APIC must be enabled.''
*
* @param pDevIns The device instance data.
* @param addr physical address in guest memory.
*/
{
/* configuration table */
pCfgTab->u32OemTablePtr = 0;
pCfgTab->u16OemTableSize = 0;
+ 1 /* ISA Bus */
+ 16 /* Interrupts */;
pCfgTab->u16ExtTableLength = 0;
pCfgTab->u8ExtTableChecksxum = 0;
pCfgTab->u8Reserved = 0;
if (u32Eax >= 1)
{
/* Local APIC will be enabled later so override it here. Since we provide
* an MP table we have an IOAPIC and therefore a Local APIC. */
}
/* Construct MPS table for each VCPU. */
for (int i = 0; i<numCpus; i++)
{
pProcEntry->u8LocalApicId = i;
pProcEntry->u8CPUFlags = (i == 0 ? 2 /* bootstrap processor */ : 0 /* application processor */) | 1 /* enabled */;
pProcEntry->u32Reserved[0] =
pProcEntry++;
}
/* ISA bus */
/* PCI bus? */
* MP spec: "The configuration table contains one or more entries for I/O APICs.
* ... At least one I/O APIC must be enabled." */
for (int i = 0; i < 16; i++, pIrqEntry++)
{
trigger mode = conforms to bus */
pIrqEntry->u8SrcBusIrq = i;
pIrqEntry->u8DstIOAPICInt = i;
}
("VBOX_MPS_TABLE_SIZE=%d, maximum allowed size is %d",
floatPtr.u8Checksum = 0;
floatPtr.au8Feature[0] = 0;
}