Changeset 25162 in vbox
- Timestamp:
- Dec 3, 2009 12:54:05 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r25107 r25162 433 433 VBOX_WITH_SCSI = 1 434 434 # Enable changing network attachments dynamically. 435 VBOX_DYNAMIC_NET_ATTACH=1 435 VBOX_DYNAMIC_NET_ATTACH = 1 436 # Enable this setting to force a fallback to default DMI data on configuration errors 437 VBOX_BIOS_DMI_FALLBACK = 436 438 # Enable host network interface API. 437 439 if1of ($(KBUILD_TARGET), darwin solaris linux win freebsd) -
trunk/src/VBox/Devices/Makefile.kmk
r24980 r25162 305 305 ifdef VBOX_DYNAMIC_NET_ATTACH 306 306 DevicesR3_DEFS += VBOX_DYNAMIC_NET_ATTACH 307 endif 308 ifdef VBOX_BIOS_DMI_FALLBACK 309 DevicesR3_DEFS += VBOX_BIOS_DMI_FALLBACK 307 310 endif 308 311 -
trunk/src/VBox/Devices/PC/DevFwCommon.cpp
r25058 r25162 40 40 #include "../Builtins2.h" 41 41 #include "DevFwCommon.h" 42 43 44 /******************************************************************************* 45 * Defined Constants And Macros * 46 *******************************************************************************/ 47 48 /* 49 * Default DMI data (legacy). 50 * Don't change this information otherwise Windows guests will demand re-activation! 51 */ 52 static const int32_t s_iDefDmiBIOSReleaseMajor = 0; 53 static const int32_t s_iDefDmiBIOSReleaseMinor = 0; 54 static const int32_t s_iDefDmiBIOSFirmwareMajor = 0; 55 static const int32_t s_iDefDmiBIOSFirmwareMinor = 0; 56 static const char *s_szDefDmiBIOSVendor = "innotek GmbH"; 57 static const char *s_szDefDmiBIOSVersion = "VirtualBox"; 58 static const char *s_szDefDmiBIOSReleaseDate = "12/01/2006"; 59 static const char *s_szDefDmiSystemVendor = "innotek GmbH"; 60 static const char *s_szDefDmiSystemProduct = "VirtualBox"; 61 static const char *s_szDefDmiSystemVersion = "1.2"; 62 static const char *s_szDefDmiSystemSerial = "0"; 63 static const char *s_szDefDmiSystemFamily = "Virtual Machine"; 64 static const char *s_szDefDmiChassisVendor = "Sun Microsystems, Inc."; 65 static const char *s_szDefDmiChassisVersion = ""; 66 static const char *s_szDefDmiChassisSerial = ""; 67 static const char *s_szDefDmiChassisAssetTag = ""; 42 68 43 69 … … 289 315 * configuration string isn't present. 290 316 * @param pCfgHandle The handle to our config node. 317 * @param fForceDefault Don't read DMI information from the environment, use default values. 291 318 * @param fPutSmbiosHeaders Plant SMBIOS headers if true. 292 319 */ 293 320 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfgHandle, bool fPutSmbiosHeaders) 294 321 { 295 char *pszStr = (char *)pTable; 296 int iStrNr; 297 int rc; 298 char *pszDmiBIOSVendor, *pszDmiBIOSVersion, *pszDmiBIOSReleaseDate; 299 int iDmiBIOSReleaseMajor, iDmiBIOSReleaseMinor, iDmiBIOSFirmwareMajor, iDmiBIOSFirmwareMinor; 300 char *pszDmiSystemVendor, *pszDmiSystemProduct, *pszDmiSystemVersion, *pszDmiSystemSerial, *pszDmiSystemUuid, *pszDmiSystemFamily; 301 char *pszDmiChassisVendor, *pszDmiChassisVersion, *pszDmiChassisSerial, *pszDmiChassisAssetTag; 302 char *pszDmiOEMVBoxVer, *pszDmiOEMVBoxRev; 303 304 #define CHECKSIZE(want) \ 305 do { \ 306 size_t _max = (size_t)(pszStr + want - (char *)pTable) + 5; /* +1 for strtab terminator +4 for end-of-table entry */ \ 307 if (_max > cbMax) \ 322 #define CHECKSIZE(cbWant) \ 323 { \ 324 size_t cbNeed = (size_t)(pszStr + cbWant - (char *)pTable) + 5; /* +1 for strtab terminator +4 for end-of-table entry */ \ 325 if (cbNeed > cbMax) \ 308 326 { \ 327 if (fHideErrors) \ 328 { \ 329 LogRel(("One of the DMI strings is too long -- using default DMI data!\n")); \ 330 continue; \ 331 } \ 309 332 return PDMDevHlpVMSetError(pDevIns, VERR_TOO_MUCH_DATA, RT_SRC_POS, \ 310 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); \333 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"), cbNeed, cbMax); \ 311 334 } \ 312 } while (0) 313 #define SETSTRING(memb, str) \ 314 do { \ 315 if (!str[0]) \ 316 memb = 0; /* empty string */ \ 335 } 336 337 #define READCFGSTRDEF(variable, name, default_value) \ 338 { \ 339 if (fForceDefault) \ 340 pszTmp = default_value; \ 317 341 else \ 318 342 { \ 319 memb = iStrNr++; \ 320 size_t _len = strlen(str) + 1; \ 321 CHECKSIZE(_len); \ 322 memcpy(pszStr, str, _len); \ 323 pszStr += _len; \ 343 rc = CFGMR3QueryStringDef(pCfgHandle, name, szBuf, sizeof(szBuf), default_value); \ 344 if (RT_FAILURE(rc)) \ 345 { \ 346 if (fHideErrors) \ 347 { \ 348 LogRel(("Configuration error: Querying \"" name "\" as a string failed -- using default DMI data!\n")); \ 349 continue; \ 350 } \ 351 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, \ 352 N_("Configuration error: Querying \"" name "\" as a string failed")); \ 353 } \ 354 else if (!strcmp(szBuf, "<EMPTY>")) \ 355 pszTmp = ""; \ 356 else \ 357 pszTmp = szBuf; \ 324 358 } \ 325 } while (0) 326 #define READCFGSTR(name, variable, default_value) \ 327 do { \ 328 rc = CFGMR3QueryStringAlloc(pCfgHandle, name, & variable); \ 329 if (rc == VERR_CFGM_VALUE_NOT_FOUND) \ 330 variable = MMR3HeapStrDup(PDMDevHlpGetVM(pDevIns), MM_TAG_CFGM, default_value); \ 331 else if (RT_FAILURE(rc)) \ 332 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, \ 333 N_("Configuration error: Querying \"" name "\" as a string failed")); \ 334 else if (!strcmp(variable, "<EMPTY>")) \ 335 variable[0] = '\0'; \ 336 } while (0) 337 #define READCFGINT(name, variable, default_value) \ 338 do { \ 339 rc = CFGMR3QueryS32(pCfgHandle, name, & variable); \ 340 if (rc == VERR_CFGM_VALUE_NOT_FOUND) \ 341 variable = default_value; \ 342 else if (RT_FAILURE(rc)) \ 343 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, \ 344 N_("Configuration error: Querying \"" name "\" as a Int failed")); \ 345 } while (0) 346 347 359 if (!pszTmp[0]) \ 360 variable = 0; /* empty string */ \ 361 else \ 362 { \ 363 variable = iStrNr++; \ 364 size_t cStr = strlen(pszTmp) + 1; \ 365 CHECKSIZE(cStr); \ 366 memcpy(pszStr, pszTmp, cStr); \ 367 pszStr += cStr ; \ 368 } \ 369 } 370 371 #define READCFGSTR(variable, name) \ 372 READCFGSTRDEF(variable, # name, s_szDef ## name) 373 374 #define READCFGINT(variable, name) \ 375 { \ 376 if (fForceDefault) \ 377 variable = s_iDef ## name; \ 378 else \ 379 { \ 380 rc = CFGMR3QueryS32Def(pCfgHandle, # name, & variable, s_iDef ## name); \ 381 if (RT_FAILURE(rc)) \ 382 { \ 383 if (fHideErrors) \ 384 { \ 385 LogRel(("Configuration error: Querying \"" # name "\" as an int failed -- using default DMI data!\n")); \ 386 continue; \ 387 } \ 388 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, \ 389 N_("Configuration error: Querying \"" # name "\" as an int failed")); \ 390 } \ 391 } \ 392 } 393 394 bool fForceDefault = false; 395 #ifdef VBOX_BIOS_DMI_FALLBACK 348 396 /* 349 * Don't change this information otherwise Windows guests will demand re-activation! 397 * There will be two passes. If an error occurs during the first pass, a 398 * message will be written to the release log and we fall back to default 399 * DMI data and start a second pass. 350 400 */ 351 READCFGSTR("DmiBIOSVendor", pszDmiBIOSVendor, "innotek GmbH"); 352 READCFGSTR("DmiBIOSVersion", pszDmiBIOSVersion, "VirtualBox"); 353 READCFGSTR("DmiBIOSReleaseDate", pszDmiBIOSReleaseDate, "12/01/2006"); 354 READCFGINT("DmiBIOSReleaseMajor", iDmiBIOSReleaseMajor, 0); 355 READCFGINT("DmiBIOSReleaseMinor", iDmiBIOSReleaseMinor, 0); 356 READCFGINT("DmiBIOSFirmwareMajor", iDmiBIOSFirmwareMajor, 0); 357 READCFGINT("DmiBIOSFirmwareMinor", iDmiBIOSFirmwareMinor, 0); 358 READCFGSTR("DmiSystemVendor", pszDmiSystemVendor, "innotek GmbH"); 359 READCFGSTR("DmiSystemProduct", pszDmiSystemProduct, "VirtualBox"); 360 READCFGSTR("DmiSystemVersion", pszDmiSystemVersion, "1.2"); 361 READCFGSTR("DmiSystemSerial", pszDmiSystemSerial, "0"); 362 rc = CFGMR3QueryStringAlloc(pCfgHandle, "DmiSystemUuid", &pszDmiSystemUuid); 363 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 364 pszDmiSystemUuid = NULL; 365 else if (RT_FAILURE(rc)) 366 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 367 N_("Configuration error: Querying \"DmiUuid\" as a string failed")); 368 READCFGSTR("DmiSystemFamily", pszDmiSystemFamily, "Virtual Machine"); 369 READCFGSTR("DmiChassisVendor", pszDmiChassisVendor, "Sun Microsystems, Inc."); 370 READCFGSTR("DmiChassisVersion", pszDmiChassisVersion, ""); /* default not specified */ 371 READCFGSTR("DmiChassisSerial", pszDmiChassisSerial, ""); /* default not specified */ 372 READCFGSTR("DmiChassisAssetTag", pszDmiChassisAssetTag, ""); /* default not specified */ 373 374 /* DMI BIOS information (Type 0) */ 375 PDMIBIOSINF pBIOSInf = (PDMIBIOSINF)pszStr; 376 CHECKSIZE(sizeof(*pBIOSInf)); 377 378 pszStr = (char *)&pBIOSInf->u8ReleaseMajor; 379 pBIOSInf->header.u8Length = RT_OFFSETOF(DMIBIOSINF, u8ReleaseMajor); 380 381 /* don't set these fields by default for legacy compatibility */ 382 if (iDmiBIOSReleaseMajor != 0 || iDmiBIOSReleaseMinor != 0) 401 bool fHideErrors = true; 402 #else 403 /* 404 * There will be one pass, every error is fatal and will prevent the VM 405 * from starting. 406 */ 407 bool fHideErrors = false; 408 #endif 409 410 for (;; fForceDefault = true, fHideErrors = false) 383 411 { 384 pszStr = (char *)&pBIOSInf->u8FirmwareMajor; 385 pBIOSInf->header.u8Length = RT_OFFSETOF(DMIBIOSINF, u8FirmwareMajor); 386 pBIOSInf->u8ReleaseMajor = iDmiBIOSReleaseMajor; 387 pBIOSInf->u8ReleaseMinor = iDmiBIOSReleaseMinor; 388 if (iDmiBIOSFirmwareMajor != 0 || iDmiBIOSFirmwareMinor != 0) 412 int iStrNr; 413 int rc; 414 char szBuf[256]; 415 char *pszStr = (char *)pTable; 416 char szDmiSystemUuid[64]; 417 char *pszDmiSystemUuid; 418 const char *pszTmp; 419 420 if (fForceDefault) 421 pszDmiSystemUuid = NULL; 422 else 389 423 { 390 pszStr = (char *)(pBIOSInf + 1); 391 pBIOSInf->header.u8Length = sizeof(DMIBIOSINF); 392 pBIOSInf->u8FirmwareMajor = iDmiBIOSFirmwareMajor; 393 pBIOSInf->u8FirmwareMinor = iDmiBIOSFirmwareMinor; 424 rc = CFGMR3QueryString(pCfgHandle, "DmiSystemUuid", szDmiSystemUuid, sizeof(szDmiSystemUuid)); 425 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 426 pszDmiSystemUuid = NULL; 427 else if (RT_FAILURE(rc)) 428 { 429 if (fHideErrors) 430 { 431 LogRel(("Configuration error: Querying \"DmiSystemUuid\" as a string failed, using default DMI data\n")); 432 continue; 433 } 434 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 435 N_("Configuration error: Querying \"DmiSystemUuid\" as a string failed")); 436 } 437 else 438 pszDmiSystemUuid = szDmiSystemUuid; 394 439 } 395 } 396 397 iStrNr = 1; 398 pBIOSInf->header.u8Type = 0; /* BIOS Information */ 399 pBIOSInf->header.u16Handle = 0x0000; 400 SETSTRING(pBIOSInf->u8Vendor, pszDmiBIOSVendor); 401 SETSTRING(pBIOSInf->u8Version, pszDmiBIOSVersion); 402 pBIOSInf->u16Start = 0xE000; 403 SETSTRING(pBIOSInf->u8Release, pszDmiBIOSReleaseDate); 404 pBIOSInf->u8ROMSize = 1; /* 128K */ 405 pBIOSInf->u64Characteristics = RT_BIT(4) /* ISA is supported */ 406 | RT_BIT(7) /* PCI is supported */ 407 | RT_BIT(15) /* Boot from CD is supported */ 408 | RT_BIT(16) /* Selectable Boot is supported */ 409 | RT_BIT(27) /* Int 9h, 8042 Keyboard services supported */ 410 | RT_BIT(30) /* Int 10h, CGA/Mono Video Services supported */ 411 /* any more?? */ 412 ; 413 pBIOSInf->u8CharacteristicsByte1 = RT_BIT(0) /* ACPI is supported */ 440 441 /********************************* 442 * DMI BIOS information (Type 0) * 443 *********************************/ 444 PDMIBIOSINF pBIOSInf = (PDMIBIOSINF)pszStr; 445 CHECKSIZE(sizeof(*pBIOSInf)); 446 447 pszStr = (char *)&pBIOSInf->u8ReleaseMajor; 448 pBIOSInf->header.u8Length = RT_OFFSETOF(DMIBIOSINF, u8ReleaseMajor); 449 450 /* don't set these fields by default for legacy compatibility */ 451 int iDmiBIOSReleaseMajor, iDmiBIOSReleaseMinor; 452 READCFGINT(iDmiBIOSReleaseMajor, DmiBIOSReleaseMajor); 453 READCFGINT(iDmiBIOSReleaseMinor, DmiBIOSReleaseMinor); 454 if (iDmiBIOSReleaseMajor != 0 || iDmiBIOSReleaseMinor != 0) 455 { 456 pszStr = (char *)&pBIOSInf->u8FirmwareMajor; 457 pBIOSInf->header.u8Length = RT_OFFSETOF(DMIBIOSINF, u8FirmwareMajor); 458 pBIOSInf->u8ReleaseMajor = iDmiBIOSReleaseMajor; 459 pBIOSInf->u8ReleaseMinor = iDmiBIOSReleaseMinor; 460 461 int iDmiBIOSFirmwareMajor, iDmiBIOSFirmwareMinor; 462 READCFGINT(iDmiBIOSFirmwareMajor, DmiBIOSFirmwareMajor); 463 READCFGINT(iDmiBIOSFirmwareMinor, DmiBIOSFirmwareMinor); 464 if (iDmiBIOSFirmwareMajor != 0 || iDmiBIOSFirmwareMinor != 0) 465 { 466 pszStr = (char *)(pBIOSInf + 1); 467 pBIOSInf->header.u8Length = sizeof(DMIBIOSINF); 468 pBIOSInf->u8FirmwareMajor = iDmiBIOSFirmwareMajor; 469 pBIOSInf->u8FirmwareMinor = iDmiBIOSFirmwareMinor; 470 } 471 } 472 473 iStrNr = 1; 474 pBIOSInf->header.u8Type = 0; /* BIOS Information */ 475 pBIOSInf->header.u16Handle = 0x0000; 476 READCFGSTR(pBIOSInf->u8Vendor, DmiBIOSVendor); 477 READCFGSTR(pBIOSInf->u8Version, DmiBIOSVersion); 478 pBIOSInf->u16Start = 0xE000; 479 READCFGSTR(pBIOSInf->u8Release, DmiBIOSReleaseDate); 480 pBIOSInf->u8ROMSize = 1; /* 128K */ 481 pBIOSInf->u64Characteristics = RT_BIT(4) /* ISA is supported */ 482 | RT_BIT(7) /* PCI is supported */ 483 | RT_BIT(15) /* Boot from CD is supported */ 484 | RT_BIT(16) /* Selectable Boot is supported */ 485 | RT_BIT(27) /* Int 9h, 8042 Keyboard services supported */ 486 | RT_BIT(30) /* Int 10h, CGA/Mono Video Services supported */ 414 487 /* any more?? */ 415 488 ; 416 pBIOSInf->u8CharacteristicsByte2 = 0 417 /* any more?? */ 418 ; 419 *pszStr++ = '\0'; 420 421 /* DMI system information (Type 1) */ 422 PDMISYSTEMINF pSystemInf = (PDMISYSTEMINF)pszStr; 423 CHECKSIZE(sizeof(*pSystemInf)); 424 pszStr = (char *)(pSystemInf + 1); 425 iStrNr = 1; 426 pSystemInf->header.u8Type = 1; /* System Information */ 427 pSystemInf->header.u8Length = sizeof(*pSystemInf); 428 pSystemInf->header.u16Handle = 0x0001; 429 SETSTRING(pSystemInf->u8Manufacturer, pszDmiSystemVendor); 430 SETSTRING(pSystemInf->u8ProductName, pszDmiSystemProduct); 431 SETSTRING(pSystemInf->u8Version, pszDmiSystemVersion); 432 SETSTRING(pSystemInf->u8SerialNumber, pszDmiSystemSerial); 433 434 RTUUID uuid; 435 if (pszDmiSystemUuid) 436 { 437 rc = RTUuidFromStr(&uuid, pszDmiSystemUuid); 438 if (RT_FAILURE(rc)) 439 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 440 N_("Invalid UUID for DMI tables specified")); 441 uuid.Gen.u32TimeLow = RT_H2BE_U32(uuid.Gen.u32TimeLow); 442 uuid.Gen.u16TimeMid = RT_H2BE_U16(uuid.Gen.u16TimeMid); 443 uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion); 444 pUuid = &uuid; 489 pBIOSInf->u8CharacteristicsByte1 = RT_BIT(0) /* ACPI is supported */ 490 /* any more?? */ 491 ; 492 pBIOSInf->u8CharacteristicsByte2 = 0 493 /* any more?? */ 494 ; 495 *pszStr++ = '\0'; 496 497 /*********************************** 498 * DMI system information (Type 1) * 499 ***********************************/ 500 PDMISYSTEMINF pSystemInf = (PDMISYSTEMINF)pszStr; 501 CHECKSIZE(sizeof(*pSystemInf)); 502 pszStr = (char *)(pSystemInf + 1); 503 iStrNr = 1; 504 pSystemInf->header.u8Type = 1; /* System Information */ 505 pSystemInf->header.u8Length = sizeof(*pSystemInf); 506 pSystemInf->header.u16Handle = 0x0001; 507 READCFGSTR(pSystemInf->u8Manufacturer, DmiSystemVendor); 508 READCFGSTR(pSystemInf->u8ProductName, DmiSystemProduct); 509 READCFGSTR(pSystemInf->u8Version, DmiSystemVersion); 510 READCFGSTR(pSystemInf->u8SerialNumber, DmiSystemSerial); 511 512 RTUUID uuid; 513 if (pszDmiSystemUuid) 514 { 515 rc = RTUuidFromStr(&uuid, pszDmiSystemUuid); 516 if (RT_FAILURE(rc)) 517 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 518 N_("Invalid UUID for DMI tables specified")); 519 uuid.Gen.u32TimeLow = RT_H2BE_U32(uuid.Gen.u32TimeLow); 520 uuid.Gen.u16TimeMid = RT_H2BE_U16(uuid.Gen.u16TimeMid); 521 uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion); 522 pUuid = &uuid; 523 } 524 memcpy(pSystemInf->au8Uuid, pUuid, sizeof(RTUUID)); 525 526 pSystemInf->u8WakeupType = 6; /* Power Switch */ 527 pSystemInf->u8SKUNumber = 0; 528 READCFGSTR(pSystemInf->u8Family, DmiSystemFamily); 529 *pszStr++ = '\0'; 530 531 /******************************************** 532 * DMI System Enclosure or Chassis (Type 3) * 533 ********************************************/ 534 PDMICHASSIS pChassis = (PDMICHASSIS)pszStr; 535 CHECKSIZE(sizeof(*pChassis)); 536 pszStr = (char*)&pChassis->u32OEMdefined; 537 iStrNr = 1; 538 #ifdef VBOX_WITH_DMI_CHASSIS 539 pChassis->header.u8Type = 3; /* System Enclosure or Chassis */ 540 #else 541 pChassis->header.u8Type = 0x7e; /* inactive */ 542 #endif 543 pChassis->header.u8Length = RT_OFFSETOF(DMICHASSIS, u32OEMdefined); 544 pChassis->header.u16Handle = 0x0003; 545 READCFGSTR(pChassis->u8Manufacturer, DmiChassisVendor); 546 pChassis->u8Type = 0x01; /* ''other'', no chassis lock present */ 547 READCFGSTR(pChassis->u8Version, DmiChassisVersion); 548 READCFGSTR(pChassis->u8SerialNumber, DmiChassisSerial); 549 READCFGSTR(pChassis->u8AssetTag, DmiChassisAssetTag); 550 pChassis->u8BootupState = 0x03; /* safe */ 551 pChassis->u8PowerSupplyState = 0x03; /* safe */ 552 pChassis->u8ThermalState = 0x03; /* safe */ 553 pChassis->u8SecurityStatus = 0x03; /* none XXX */ 554 # if 0 555 /* v2.3+, currently not supported */ 556 pChassis->u32OEMdefined = 0; 557 pChassis->u8Height = 0; /* unspecified */ 558 pChassis->u8NumPowerChords = 0; /* unspecified */ 559 pChassis->u8ContElems = 0; /* no contained elements */ 560 pChassis->u8ContElemRecLen = 0; /* no contained elements */ 561 # endif 562 *pszStr++ = '\0'; 563 564 /***************************** 565 * DMI OEM strings (Type 11) * 566 *****************************/ 567 PDMIOEMSTRINGS pOEMStrings = (PDMIOEMSTRINGS)pszStr; 568 CHECKSIZE(sizeof(*pOEMStrings)); 569 pszStr = (char *)(pOEMStrings + 1); 570 iStrNr = 1; 571 #ifdef VBOX_WITH_DMI_OEMSTRINGS 572 pOEMStrings->header.u8Type = 0xb; /* OEM Strings */ 573 #else 574 pOEMStrings->header.u8Type = 0x7e; /* inactive */ 575 #endif 576 pOEMStrings->header.u8Length = sizeof(*pOEMStrings); 577 pOEMStrings->header.u16Handle = 0x0002; 578 pOEMStrings->u8Count = 2; 579 580 char szTmp[64]; 581 RTStrPrintf(szTmp, sizeof(szTmp), "vboxVer_%u.%u.%u", 582 RTBldCfgVersionMajor(), RTBldCfgVersionMinor(), RTBldCfgVersionBuild()); 583 READCFGSTRDEF(pOEMStrings->u8VBoxVersion, "DmiOEMVBoxVer", szTmp); 584 RTStrPrintf(szTmp, sizeof(szTmp), "vboxRev_%u", RTBldCfgRevision()); 585 READCFGSTRDEF(pOEMStrings->u8VBoxRevision, "DmiOEMVBoxRev", szTmp); 586 *pszStr++ = '\0'; 587 588 /* End-of-table marker - includes padding to account for fixed table size. */ 589 PDMIHDR pEndOfTable = (PDMIHDR)pszStr; 590 pEndOfTable->u8Type = 0x7f; 591 pEndOfTable->u8Length = cbMax - ((char *)pszStr - (char *)pTable) - 2; 592 pEndOfTable->u16Handle = 0xFEFF; 593 594 /* If more fields are added here, fix the size check in READCFGSTR */ 595 596 /* Success! */ 597 break; 445 598 } 446 memcpy(pSystemInf->au8Uuid, pUuid, sizeof(RTUUID)); 447 448 pSystemInf->u8WakeupType = 6; /* Power Switch */ 449 pSystemInf->u8SKUNumber = 0; 450 SETSTRING(pSystemInf->u8Family, pszDmiSystemFamily); 451 *pszStr++ = '\0'; 452 453 /* DMI System Enclosure or Chassis (Type 3) */ 454 PDMICHASSIS pChassis = (PDMICHASSIS)pszStr; 455 CHECKSIZE(sizeof(*pChassis)); 456 pszStr = (char*)&pChassis->u32OEMdefined; 457 iStrNr = 1; 458 #ifdef VBOX_WITH_DMI_CHASSIS 459 pChassis->header.u8Type = 3; /* System Enclosure or Chassis */ 460 #else 461 pChassis->header.u8Type = 0x7e; /* inactive */ 462 #endif 463 pChassis->header.u8Length = RT_OFFSETOF(DMICHASSIS, u32OEMdefined); 464 pChassis->header.u16Handle = 0x0003; 465 SETSTRING(pChassis->u8Manufacturer, pszDmiChassisVendor); 466 pChassis->u8Type = 0x01; /* ''other'', no chassis lock present */ 467 SETSTRING(pChassis->u8Version, pszDmiChassisVersion); 468 SETSTRING(pChassis->u8SerialNumber, pszDmiChassisSerial); 469 SETSTRING(pChassis->u8AssetTag, pszDmiChassisAssetTag); 470 pChassis->u8BootupState = 0x03; /* safe */ 471 pChassis->u8PowerSupplyState = 0x03; /* safe */ 472 pChassis->u8ThermalState = 0x03; /* safe */ 473 pChassis->u8SecurityStatus = 0x03; /* none XXX */ 474 # if 0 475 /* v2.3+, currently not supported */ 476 pChassis->u32OEMdefined = 0; 477 pChassis->u8Height = 0; /* unspecified */ 478 pChassis->u8NumPowerChords = 0; /* unspecified */ 479 pChassis->u8ContElems = 0; /* no contained elements */ 480 pChassis->u8ContElemRecLen = 0; /* no contained elements */ 481 # endif 482 *pszStr++ = '\0'; 483 484 /* DMI OEM strings */ 485 PDMIOEMSTRINGS pOEMStrings = (PDMIOEMSTRINGS)pszStr; 486 CHECKSIZE(sizeof(*pOEMStrings)); 487 pszStr = (char *)(pOEMStrings + 1); 488 iStrNr = 1; 489 #ifdef VBOX_WITH_DMI_OEMSTRINGS 490 pOEMStrings->header.u8Type = 0xb; /* OEM Strings */ 491 #else 492 pOEMStrings->header.u8Type = 0x7e; /* inactive */ 493 #endif 494 pOEMStrings->header.u8Length = sizeof(*pOEMStrings); 495 pOEMStrings->header.u16Handle = 0x0002; 496 pOEMStrings->u8Count = 2; 497 498 char szTmp[64]; 499 RTStrPrintf(szTmp, sizeof(szTmp), "vboxVer_%u.%u.%u", 500 RTBldCfgVersionMajor(), RTBldCfgVersionMinor(), RTBldCfgVersionBuild()); 501 READCFGSTR("DmiOEMVBoxVer", pszDmiOEMVBoxVer, szTmp); 502 RTStrPrintf(szTmp, sizeof(szTmp), "vboxRev_%u", RTBldCfgRevision()); 503 READCFGSTR("DmiOEMVBoxRev", pszDmiOEMVBoxRev, szTmp); 504 SETSTRING(pOEMStrings->u8VBoxVersion, pszDmiOEMVBoxVer); 505 SETSTRING(pOEMStrings->u8VBoxRevision, pszDmiOEMVBoxRev); 506 *pszStr++ = '\0'; 507 508 /* End-of-table marker - includes padding to account for fixed table size. */ 509 PDMIHDR pEndOfTable = (PDMIHDR)pszStr; 510 pEndOfTable->u8Type = 0x7f; 511 pEndOfTable->u8Length = cbMax - ((char *)pszStr - (char *)pTable) - 2; 512 pEndOfTable->u16Handle = 0xFEFF; 513 514 /* If more fields are added here, fix the size check in SETSTRING */ 515 516 #undef SETSTRING 599 517 600 #undef READCFGSTR 518 601 #undef READCFGINT 519 602 #undef CHECKSIZE 520 521 MMR3HeapFree(pszDmiBIOSVendor);522 MMR3HeapFree(pszDmiBIOSVersion);523 MMR3HeapFree(pszDmiBIOSReleaseDate);524 MMR3HeapFree(pszDmiSystemVendor);525 MMR3HeapFree(pszDmiSystemProduct);526 MMR3HeapFree(pszDmiSystemVersion);527 MMR3HeapFree(pszDmiSystemSerial);528 MMR3HeapFree(pszDmiSystemUuid);529 MMR3HeapFree(pszDmiSystemFamily);530 MMR3HeapFree(pszDmiChassisVendor);531 MMR3HeapFree(pszDmiChassisVersion);532 MMR3HeapFree(pszDmiChassisSerial);533 MMR3HeapFree(pszDmiChassisAssetTag);534 MMR3HeapFree(pszDmiOEMVBoxVer);535 MMR3HeapFree(pszDmiOEMVBoxRev);536 603 537 604 if (fPutSmbiosHeaders) … … 540 607 struct SMBIOSHDR smbios; 541 608 struct DMIMAINHDR dmi; 542 } aBiosHeaders = 609 } aBiosHeaders 610 = 543 611 { 544 612 // The SMBIOS header
Note:
See TracChangeset
for help on using the changeset viewer.