- Timestamp:
- May 21, 2008 9:42:46 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r8942 r9005 173 173 uint8_t u8CharacteristicsByte1; 174 174 uint8_t u8CharacteristicsByte2; 175 uint8_t u8ReleaseMajor; 176 uint8_t u8ReleaseMinor; 177 uint8_t u8FirmwareMajor; 178 uint8_t u8FirmwareMinor; 175 179 } *PDMIBIOSINF; 176 AssertCompileSize(DMIBIOSINF, 0x1 4);180 AssertCompileSize(DMIBIOSINF, 0x18); 177 181 178 182 /** DMI system information */ … … 818 822 int iStrNr; 819 823 int rc; 820 char *pszDmiVendor, *pszDmiProduct, *pszDmiVersion, *pszDmiRelease, *pszDmiSerial, *pszDmiUuid, *pszDmiFamily; 824 char *pszDmiBIOSVendor, *pszDmiBIOSVersion, *pszDmiBIOSReleaseDate; 825 int iDmiBIOSReleaseMajor, iDmiBIOSReleaseMinor, iDmiBIOSFirmwareMajor, iDmiBIOSFirmwareMinor; 826 char *pszDmiSystemVendor, *pszDmiSystemProduct, *pszDmiSystemVersion, *pszDmiSystemSerial, *pszDmiSystemUuid, *pszDmiSystemFamily; 821 827 822 828 #define STRCPY(p, s) \ … … 830 836 p += _len; \ 831 837 } while (0) 832 #define READCFG (name, variable, default_value) \838 #define READCFGSTR(name, variable, default_value) \ 833 839 do { \ 834 840 rc = CFGMR3QueryStringAlloc(pCfgHandle, name, & variable); \ … … 839 845 N_("Configuration error: Querying \"" name "\" as a string failed")); \ 840 846 } while (0) 841 842 843 READCFG("DmiVendor", pszDmiVendor, "innotek GmbH"); 844 READCFG("DmiProduct", pszDmiProduct, "VirtualBox"); 845 READCFG("DmiVersion", pszDmiVersion, "1.2"); 846 READCFG("DmiRelease", pszDmiRelease, "12/01/2006"); 847 READCFG("DmiSerial", pszDmiSerial, "0"); 848 rc = CFGMR3QueryStringAlloc(pCfgHandle, "DmiUuid", &pszDmiUuid); 847 #define READCFGINT(name, variable, default_value) \ 848 do { \ 849 rc = CFGMR3QueryS32(pCfgHandle, name, & variable); \ 850 if (rc == VERR_CFGM_VALUE_NOT_FOUND) \ 851 variable = default_value; \ 852 else if (VBOX_FAILURE(rc)) \ 853 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, \ 854 N_("Configuration error: Querying \"" name "\" as a Int failed")); \ 855 } while (0) 856 857 858 READCFGSTR("DmiBIOSVendor", pszDmiBIOSVendor, "innotek GmbH"); 859 READCFGSTR("DmiBIOSVersion", pszDmiBIOSVersion, "VirtualBox"); 860 READCFGSTR("DmiBIOSReleaseDate", pszDmiBIOSReleaseDate, "12/01/2006"); 861 READCFGINT("DmiBIOSReleaseMajor", iDmiBIOSReleaseMajor, 0); 862 READCFGINT("DmiBIOSReleaseMinor", iDmiBIOSReleaseMinor, 0); 863 READCFGINT("DmiBIOSFirmwareMajor", iDmiBIOSFirmwareMajor, 0); 864 READCFGINT("DmiBIOSFirmwareMinor", iDmiBIOSFirmwareMinor, 0); 865 READCFGSTR("DmiSystemVendor", pszDmiSystemVendor, "innotek GmbH"); 866 READCFGSTR("DmiSystemProduct", pszDmiSystemProduct, "VirtualBox"); 867 READCFGSTR("DmiSystemVersion", pszDmiSystemVersion, "1.2"); 868 READCFGSTR("DmiSystemSerial", pszDmiSystemSerial, "0"); 869 rc = CFGMR3QueryStringAlloc(pCfgHandle, "DmiSystemUuid", &pszDmiSystemUuid); 849 870 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 850 pszDmi Uuid = NULL;871 pszDmiSystemUuid = NULL; 851 872 else if (VBOX_FAILURE(rc)) 852 873 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 853 874 N_("Configuration error: Querying \"DmiUuid\" as a string failed")); 854 READCFG ("DmiFamily", pszDmiFamily,"Virtual Machine");875 READCFGSTR("DmiSystemFamily", pszDmiSystemFamily, "Virtual Machine"); 855 876 856 877 /* DMI BIOS information */ 857 878 PDMIBIOSINF pBIOSInf = (PDMIBIOSINF)pszStr; 858 pszStr = (char *)(pBIOSInf + 1); 879 880 pszStr = (char *)&pBIOSInf->u8ReleaseMajor; 881 pBIOSInf->header.u8Length = RT_OFFSETOF(DMIBIOSINF, u8ReleaseMajor); 882 883 /* don't set these fields by default for legacy compatibility */ 884 if (iDmiBIOSReleaseMajor != 0 || iDmiBIOSReleaseMinor != 0) 885 { 886 pszStr = (char *)&pBIOSInf->u8FirmwareMajor; 887 pBIOSInf->header.u8Length = RT_OFFSETOF(DMIBIOSINF, u8FirmwareMajor); 888 pBIOSInf->u8ReleaseMajor = iDmiBIOSReleaseMajor; 889 pBIOSInf->u8ReleaseMinor = iDmiBIOSReleaseMinor; 890 if (iDmiBIOSFirmwareMajor != 0 || iDmiBIOSFirmwareMinor != 0) 891 { 892 pszStr = (char *)(pBIOSInf + 1); 893 pBIOSInf->header.u8Length = sizeof(DMIBIOSINF); 894 pBIOSInf->u8FirmwareMajor = iDmiBIOSFirmwareMajor; 895 pBIOSInf->u8FirmwareMinor = iDmiBIOSFirmwareMinor; 896 } 897 } 898 859 899 iStrNr = 1; 860 900 pBIOSInf->header.u8Type = 0; /* BIOS Information */ 861 pBIOSInf->header.u8Length = sizeof(*pBIOSInf);862 901 pBIOSInf->header.u16Handle = 0x0000; 863 902 pBIOSInf->u8Vendor = iStrNr++; 864 STRCPY(pszStr, pszDmi Vendor);903 STRCPY(pszStr, pszDmiBIOSVendor); 865 904 pBIOSInf->u8Version = iStrNr++; 866 STRCPY(pszStr, pszDmi Product);905 STRCPY(pszStr, pszDmiBIOSVersion); 867 906 pBIOSInf->u16Start = 0xE000; 868 907 pBIOSInf->u8Release = iStrNr++; 869 STRCPY(pszStr, pszDmi Release);908 STRCPY(pszStr, pszDmiBIOSReleaseDate); 870 909 pBIOSInf->u8ROMSize = 1; /* 128K */ 871 910 pBIOSInf->u64Characteristics = RT_BIT(4) /* ISA is supported */ … … 893 932 pSystemInf->header.u16Handle = 0x0001; 894 933 pSystemInf->u8Manufacturer = iStrNr++; 895 STRCPY(pszStr, pszDmi Vendor);934 STRCPY(pszStr, pszDmiSystemVendor); 896 935 pSystemInf->u8ProductName = iStrNr++; 897 STRCPY(pszStr, pszDmi Product);936 STRCPY(pszStr, pszDmiSystemProduct); 898 937 pSystemInf->u8Version = iStrNr++; 899 STRCPY(pszStr, pszDmi Version);938 STRCPY(pszStr, pszDmiSystemVersion); 900 939 pSystemInf->u8SerialNumber = iStrNr++; 901 STRCPY(pszStr, pszDmiS erial);940 STRCPY(pszStr, pszDmiSystemSerial); 902 941 903 942 RTUUID uuid; 904 if (pszDmi Uuid)905 { 906 int rc = RTUuidFromStr(&uuid, pszDmi Uuid);943 if (pszDmiSystemUuid) 944 { 945 int rc = RTUuidFromStr(&uuid, pszDmiSystemUuid); 907 946 if (VBOX_FAILURE(rc)) 908 947 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, … … 918 957 pSystemInf->u8SKUNumber = 0; 919 958 pSystemInf->u8Family = iStrNr++; 920 STRCPY(pszStr, pszDmi Family);959 STRCPY(pszStr, pszDmiSystemFamily); 921 960 *pszStr++ = '\0'; 922 961 … … 926 965 #undef READCFG 927 966 928 MMR3HeapFree(pszDmiVendor); 929 MMR3HeapFree(pszDmiProduct); 930 MMR3HeapFree(pszDmiVersion); 931 MMR3HeapFree(pszDmiRelease); 932 MMR3HeapFree(pszDmiSerial); 933 MMR3HeapFree(pszDmiUuid); 934 MMR3HeapFree(pszDmiFamily); 967 MMR3HeapFree(pszDmiBIOSVendor); 968 MMR3HeapFree(pszDmiBIOSVersion); 969 MMR3HeapFree(pszDmiBIOSReleaseDate); 970 MMR3HeapFree(pszDmiSystemVendor); 971 MMR3HeapFree(pszDmiSystemProduct); 972 MMR3HeapFree(pszDmiSystemVersion); 973 MMR3HeapFree(pszDmiSystemSerial); 974 MMR3HeapFree(pszDmiSystemUuid); 975 MMR3HeapFree(pszDmiSystemFamily); 935 976 936 977 return VINF_SUCCESS; … … 1222 1263 "UUID\0" 1223 1264 "IOAPIC\0" 1224 "DmiVendor\0" 1225 "DmiProduct\0" 1226 "DmiVersion\0" 1227 "DmiSerial\0" 1228 "DmiUuid\0" 1229 "DmiFamily\0")) 1265 "DmiBIOSVendor\0" 1266 "DmiBIOSVersion\0" 1267 "DmiBIOSReleaseDate\0" 1268 "DmiBIOSReleaseMajor\0" 1269 "DmiBIOSReleaseMinor\0" 1270 "DmiBIOSFirmwareMajor\0" 1271 "DmiBIOSFirmwareMinor\0" 1272 "DmiSystemFamily\0" 1273 "DmiSystemProduct\0" 1274 "DmiSystemSerial\0" 1275 "DmiSystemUuid\0" 1276 "DmiSystemVendor\0" 1277 "DmiSystemVersion\0")) 1230 1278 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 1231 1279 N_("Invalid configuraton for device pcbios device"));
Note:
See TracChangeset
for help on using the changeset viewer.