Changeset 39707 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Jan 6, 2012 12:16:54 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75563
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevFwCommon.cpp
r39274 r39707 65 65 static const char *s_szDefDmiChassisSerial = ""; 66 66 static const char *s_szDefDmiChassisAssetTag = ""; 67 static const char *s_szDefDmiProcManufacturer = "GenuineIntel"; 68 static const char *s_szDefDmiProcVersion = "Pentium(R) III"; 67 69 68 70 static char g_szHostDmiSystemProduct[64]; … … 189 191 uint8_t u8ProcessorFamily; 190 192 uint8_t u8ProcessorManufacturer; 191 uint64_t u64ProcessorI dentification;193 uint64_t u64ProcessorID; 192 194 uint8_t u8ProcessorVersion; 193 195 uint8_t u8Voltage; … … 197 199 uint8_t u8Status; 198 200 uint8_t u8ProcessorUpgrade; 201 /* v2.1+ */ 199 202 uint16_t u16L1CacheHandle; 200 203 uint16_t u16L2CacheHandle; 201 204 uint16_t u16L3CacheHandle; 205 /* v2.3+ */ 202 206 uint8_t u8SerialNumber; 203 207 uint8_t u8AssetTag; 204 208 uint8_t u8PartNumber; 209 /* v2.5+ */ 205 210 uint8_t u8CoreCount; 206 211 uint8_t u8CoreEnabled; 207 212 uint8_t u8ThreadCount; 208 213 uint16_t u16ProcessorCharacteristics; 214 /* v2.6+ */ 209 215 uint16_t u16ProcessorFamily2; 210 216 } *PDMIPROCESSORINF; … … 398 404 * @param pCfg The handle to our config node. 399 405 */ 400 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg )406 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, uint16_t cCpus) 401 407 { 402 408 #define CHECKSIZE(cbWant) \ … … 514 520 return PDMDEV_SET_ERROR(pDevIns, rc, 515 521 N_("Configuration error: Failed to read \"DmiExposeMemoryTable\"")); 522 uint8_t fDmiExposeProcessorInf; 523 rc = CFGMR3QueryU8Def(pCfg, "DmiExposeProcInf", &fDmiExposeProcessorInf, 0); 524 if (RT_FAILURE (rc)) 525 return PDMDEV_SET_ERROR(pDevIns, rc, 526 N_("Configuration error: Failed to read \"DmiExposeProcInf\"")); 516 527 517 528 for (;; fForceDefault = true, fHideErrors = false) … … 606 617 PDMISYSTEMINF pSystemInf = (PDMISYSTEMINF)pszStr; 607 618 CHECKSIZE(sizeof(*pSystemInf)); 608 pszStr = (char *)(pSystemInf + 1);619 START_STRUCT(pSystemInf); 609 620 iStrNr = 1; 610 621 pSystemInf->header.u8Type = 1; /* System Information */ … … 675 686 TERM_STRUCT; 676 687 688 /************************************** 689 * DMI Processor Information (Type 4) * 690 **************************************/ 691 692 /* 693 * This is just a dummy processor. Should we expose the real guest CPU features 694 * here? Accessing this information at this point is difficult. 695 */ 696 char szSocket[32]; 697 PDMIPROCESSORINF pProcessorInf = (PDMIPROCESSORINF)pszStr; 698 CHECKSIZE(sizeof(*pProcessorInf)); 699 START_STRUCT(pProcessorInf); 700 iStrNr = 1; 701 if (fDmiExposeProcessorInf) 702 pProcessorInf->header.u8Type = 4; /* Processor Information */ 703 else 704 pProcessorInf->header.u8Type = 126; /* inactive structure */ 705 pProcessorInf->header.u8Length = sizeof(*pProcessorInf); 706 pProcessorInf->header.u16Handle = 0x0007; 707 RTStrPrintf(szSocket, sizeof(szSocket), "Socket #%u", 0); 708 pProcessorInf->u8SocketDesignation = iStrNr++; 709 { 710 size_t cStr = strlen(szSocket) + 1; 711 CHECKSIZE(cStr); 712 memcpy(pszStr, szSocket, cStr); 713 pszStr += cStr; 714 } 715 pProcessorInf->u8ProcessorType = 0x03; /* Central Processor */ 716 pProcessorInf->u8ProcessorFamily = 0xB1; /* Pentium III with Intel SpeedStep(TM) */ 717 READCFGSTR(pProcessorInf->u8ProcessorManufacturer, DmiProcManufacturer); 718 719 pProcessorInf->u64ProcessorID = UINT64_C(0x0FEBFBFF00010676); 720 /* Ext Family ID = 0 721 * Ext Model ID = 2 722 * Processor Type = 0 723 * Family ID = 6 724 * Model = 7 725 * Stepping = 6 726 * Features: FPU, VME, DE, PSE, TSC, MSR, PAE, MCE, CX8, 727 * APIC, SEP, MTRR, PGE, MCA, CMOV, PAT, PSE-36, 728 * CFLSH, DS, ACPI, MMX, FXSR, SSE, SSE2, SS */ 729 READCFGSTR(pProcessorInf->u8ProcessorVersion, DmiProcVersion); 730 pProcessorInf->u8Voltage = 0x02; /* 3.3V */ 731 pProcessorInf->u16ExternalClock = 0x00; /* unknown */ 732 pProcessorInf->u16MaxSpeed = 3000; /* 3GHz */ 733 pProcessorInf->u16CurrentSpeed = 3000; /* 3GHz */ 734 pProcessorInf->u8Status = RT_BIT(6) /* CPU socket populated */ 735 | RT_BIT(0) /* CPU enabled */ 736 ; 737 pProcessorInf->u8ProcessorUpgrade = 0x04; /* ZIF Socket */ 738 pProcessorInf->u16L1CacheHandle = 0x001C; 739 pProcessorInf->u16L2CacheHandle = 0x001D; 740 pProcessorInf->u16L3CacheHandle = 0xFFFF; /* unknown */ 741 pProcessorInf->u8SerialNumber = 0; /* not specified */ 742 pProcessorInf->u8AssetTag = 0; /* not specified */ 743 pProcessorInf->u8PartNumber = 0; /* not specified */ 744 pProcessorInf->u8CoreCount = cCpus; /* */ 745 pProcessorInf->u8CoreEnabled = cCpus; 746 pProcessorInf->u8ThreadCount = 1; 747 pProcessorInf->u16ProcessorCharacteristics 748 = RT_BIT(2); /* 64-bit capable */ 749 pProcessorInf->u16ProcessorFamily2 = 0; 750 TERM_STRUCT; 751 752 /*************************************** 753 * DMI Physical Memory Array (Type 16) * 754 ***************************************/ 755 uint64_t u64RamSize; 756 rc = CFGMR3QueryU64(pCfg, "RamSize", &u64RamSize); 757 if (RT_FAILURE (rc)) 758 return PDMDEV_SET_ERROR(pDevIns, rc, 759 N_("Configuration error: Failed to read \"RamSize\"")); 760 761 PDMIRAMARRAY pMemArray = (PDMIRAMARRAY)pszStr; 762 CHECKSIZE(sizeof(*pMemArray)); 763 START_STRUCT(pMemArray); 677 764 if (fDmiExposeMemoryTable) 678 { 679 /*************************************** 680 * DMI Physical Memory Array (Type 16) * 681 ***************************************/ 682 uint64_t u64RamSize; 683 rc = CFGMR3QueryU64(pCfg, "RamSize", &u64RamSize); 684 if (RT_FAILURE (rc)) 685 return PDMDEV_SET_ERROR(pDevIns, rc, 686 N_("Configuration error: Failed to read \"RamSize\"")); 687 688 PDMIRAMARRAY pMemArray = (PDMIRAMARRAY)pszStr; 689 CHECKSIZE(sizeof(*pMemArray)); 690 691 START_STRUCT(pMemArray); 692 pMemArray->header.u8Type = 16; /* Physical Memory Array */ 693 pMemArray->header.u8Length = sizeof(*pMemArray); 694 pMemArray->header.u16Handle = 0x0005; 695 pMemArray->u8Location = 0x03; /* Motherboard */ 696 pMemArray->u8Use = 0x03; /* System memory */ 697 pMemArray->u8MemErrorCorrection = 0x01; /* Other */ 698 uint32_t u32RamSizeK = (uint32_t)(u64RamSize / _1K); 699 pMemArray->u32MaxCapacity = u32RamSizeK; /* RAM size in K */ 700 pMemArray->u16MemErrorHandle = 0xfffe; /* No error info structure */ 701 pMemArray->u16NumberOfMemDevices = 1; 702 TERM_STRUCT; 703 704 /*************************************** 705 * DMI Memory Device (Type 17) * 706 ***************************************/ 707 PDMIMEMORYDEV pMemDev = (PDMIMEMORYDEV)pszStr; 708 CHECKSIZE(sizeof(*pMemDev)); 709 710 START_STRUCT(pMemDev); 711 pMemDev->header.u8Type = 17; /* Memory Device */ 712 pMemDev->header.u8Length = sizeof(*pMemDev); 713 pMemDev->header.u16Handle = 0x0006; 714 pMemDev->u16PhysMemArrayHandle = 0x0005; /* handle of array we belong to */ 715 pMemDev->u16MemErrHandle = 0xfffe; /* system doesn't provide this information */ 716 pMemDev->u16TotalWidth = 0xffff; /* Unknown */ 717 pMemDev->u16DataWidth = 0xffff; /* Unknown */ 718 int16_t u16RamSizeM = (uint16_t)(u64RamSize / _1M); 719 if (u16RamSizeM == 0) 720 u16RamSizeM = 0x400; /* 1G */ 721 pMemDev->u16Size = u16RamSizeM; /* RAM size */ 722 pMemDev->u8FormFactor = 0x09; /* DIMM */ 723 pMemDev->u8DeviceSet = 0x00; /* Not part of a device set */ 724 READCFGSTRDEF(pMemDev->u8DeviceLocator, " ", "DIMM 0"); 725 READCFGSTRDEF(pMemDev->u8BankLocator, " ", "Bank 0"); 726 pMemDev->u8MemoryType = 0x03; /* DRAM */ 727 pMemDev->u16TypeDetail = 0; /* Nothing special */ 728 pMemDev->u16Speed = 1600; /* Unknown, shall be speed in MHz */ 729 READCFGSTR(pMemDev->u8Manufacturer, DmiSystemVendor); 730 READCFGSTRDEF(pMemDev->u8SerialNumber, " ", "00000000"); 731 READCFGSTRDEF(pMemDev->u8AssetTag, " ", "00000000"); 732 READCFGSTRDEF(pMemDev->u8PartNumber, " ", "00000000"); 733 pMemDev->u8Attributes = 0; /* Unknown */ 734 TERM_STRUCT; 735 } 765 pMemArray->header.u8Type = 16; /* Physical Memory Array */ 766 else 767 pMemArray->header.u8Type = 126; /* inactive structure */ 768 pMemArray->header.u8Length = sizeof(*pMemArray); 769 pMemArray->header.u16Handle = 0x0005; 770 pMemArray->u8Location = 0x03; /* Motherboard */ 771 pMemArray->u8Use = 0x03; /* System memory */ 772 pMemArray->u8MemErrorCorrection = 0x01; /* Other */ 773 pMemArray->u32MaxCapacity = (uint32_t)(u64RamSize / _1K); /* RAM size in K */ 774 pMemArray->u16MemErrorHandle = 0xfffe; /* No error info structure */ 775 pMemArray->u16NumberOfMemDevices = 1; 776 TERM_STRUCT; 777 778 /*************************************** 779 * DMI Memory Device (Type 17) * 780 ***************************************/ 781 PDMIMEMORYDEV pMemDev = (PDMIMEMORYDEV)pszStr; 782 CHECKSIZE(sizeof(*pMemDev)); 783 START_STRUCT(pMemDev); 784 if (fDmiExposeMemoryTable) 785 pMemDev->header.u8Type = 17; /* Memory Device */ 786 else 787 pMemDev->header.u8Type = 126; /* inactive structure */ 788 pMemDev->header.u8Length = sizeof(*pMemDev); 789 pMemDev->header.u16Handle = 0x0006; 790 pMemDev->u16PhysMemArrayHandle = 0x0005; /* handle of array we belong to */ 791 pMemDev->u16MemErrHandle = 0xfffe; /* system doesn't provide this information */ 792 pMemDev->u16TotalWidth = 0xffff; /* Unknown */ 793 pMemDev->u16DataWidth = 0xffff; /* Unknown */ 794 int16_t u16RamSizeM = (uint16_t)(u64RamSize / _1M); 795 if (u16RamSizeM == 0) 796 u16RamSizeM = 0x400; /* 1G */ 797 pMemDev->u16Size = u16RamSizeM; /* RAM size */ 798 pMemDev->u8FormFactor = 0x09; /* DIMM */ 799 pMemDev->u8DeviceSet = 0x00; /* Not part of a device set */ 800 READCFGSTRDEF(pMemDev->u8DeviceLocator, " ", "DIMM 0"); 801 READCFGSTRDEF(pMemDev->u8BankLocator, " ", "Bank 0"); 802 pMemDev->u8MemoryType = 0x03; /* DRAM */ 803 pMemDev->u16TypeDetail = 0; /* Nothing special */ 804 pMemDev->u16Speed = 1600; /* Unknown, shall be speed in MHz */ 805 READCFGSTR(pMemDev->u8Manufacturer, DmiSystemVendor); 806 READCFGSTRDEF(pMemDev->u8SerialNumber, " ", "00000000"); 807 READCFGSTRDEF(pMemDev->u8AssetTag, " ", "00000000"); 808 READCFGSTRDEF(pMemDev->u8PartNumber, " ", "00000000"); 809 pMemDev->u8Attributes = 0; /* Unknown */ 810 TERM_STRUCT; 736 811 737 812 /***************************** … … 740 815 PDMIOEMSTRINGS pOEMStrings = (PDMIOEMSTRINGS)pszStr; 741 816 CHECKSIZE(sizeof(*pOEMStrings)); 742 pszStr = (char *)(pOEMStrings + 1);817 START_STRUCT(pOEMStrings); 743 818 iStrNr = 1; 744 819 #ifdef VBOX_WITH_DMI_OEMSTRINGS 745 820 pOEMStrings->header.u8Type = 0xb; /* OEM Strings */ 746 821 #else 747 pOEMStrings->header.u8Type = 0x7e; /* inactive */822 pOEMStrings->header.u8Type = 126; /* inactive structure */ 748 823 #endif 749 824 pOEMStrings->header.u8Length = sizeof(*pOEMStrings); … … 762 837 PDMIHDR pEndOfTable = (PDMIHDR)pszStr; 763 838 pEndOfTable->u8Type = 0x7f; 764 pEndOfTable->u8Length = cbMax - ((char *)pszStr - (char *)pTable) - 2; 839 uint32_t cbEof = cbMax - ((uintptr_t)pszStr - (uintptr_t)pTable) - 2; 840 if (cbEof > 255) 841 return PDMDevHlpVMSetError(pDevIns, VERR_TOO_MUCH_DATA, RT_SRC_POS, \ 842 N_("DMI table has the wrong length (%u bytes left for the EOF marker). One of the DMI strings is too long. Check all bios/Dmi* configuration entries"), cbEof); \ 843 pEndOfTable->u8Length = cbEof; 765 844 pEndOfTable->u16Handle = 0xFEFF; 766 845 … … 818 897 PDMDevHlpPhysWrite(pDevIns, 0xfe300, &aBiosHeaders, sizeof(aBiosHeaders)); 819 898 } 820 AssertCompile(VBOX_DMI_TABLE_ENTR == 5);899 AssertCompile(VBOX_DMI_TABLE_ENTR == 8); 821 900 822 901 /** -
trunk/src/VBox/Devices/PC/DevFwCommon.h
r28800 r39707 28 28 29 29 /* Plant DMI table */ 30 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg );30 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, uint16_t cCpus); 31 31 void FwCommonPlantSmbiosAndDmiHdrs(PPDMDEVINS pDevIns); 32 32 -
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r38698 r39707 982 982 "DmiUseHostInfo\0" 983 983 "DmiExposeMemoryTable\0" 984 "DmiExposeProcInf\0" 984 985 )) 985 986 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, … … 1089 1090 uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion); 1090 1091 rc = FwCommonPlantDMITable(pDevIns, pThis->au8DMIPage, 1091 VBOX_DMI_TABLE_SIZE, &uuid, pCfg );1092 VBOX_DMI_TABLE_SIZE, &uuid, pCfg, pThis->cCpus); 1092 1093 if (RT_FAILURE(rc)) 1093 1094 return rc; -
trunk/src/VBox/Devices/PC/DevPcBios.h
r34081 r39707 22 22 #define VBOX_DMI_TABLE_BASE 0xe1000 23 23 #define VBOX_DMI_TABLE_VER 0x25 24 #define VBOX_DMI_TABLE_ENTR 524 #define VBOX_DMI_TABLE_ENTR 8 25 25 26 26 /** def VBOX_DMI_TABLE_SIZE … … 31 31 * the MPS table. 32 32 */ 33 #define VBOX_DMI_TABLE_SIZE 35233 #define VBOX_DMI_TABLE_SIZE 496 34 34 35 35
Note:
See TracChangeset
for help on using the changeset viewer.