/*++ @file\r
Emu driver to produce CPU Architectural Protocol.\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2011 - 2012, Apple Inc. All rights reserved.\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
0, // ProcessorXModel: 4;\r
0, // ProcessorXFamily: 8;\r
0, // ProcessorReserved2: 4;\r
- }, \r
+ },\r
{ // PROCESSOR_FEATURE_FLAGS\r
0, // ProcessorFpu :1;\r
0, // ProcessorVme :1;\r
},\r
3, // ProcessorVersion String;\r
{ // Voltage;\r
- 1, // ProcessorVoltageCapability5V :1; \r
- 1, // ProcessorVoltageCapability3_3V :1; \r
- 1, // ProcessorVoltageCapability2_9V :1; \r
+ 1, // ProcessorVoltageCapability5V :1;\r
+ 1, // ProcessorVoltageCapability3_3V :1;\r
+ 1, // ProcessorVoltageCapability2_9V :1;\r
0, // ProcessorVoltageCapabilityReserved :1; ///< Bit 3, must be zero.\r
0, // ProcessorVoltageReserved :3; ///< Bits 4-6, must be zero.\r
0 // ProcessorVoltageIndicateLegacy :1;\r
- }, \r
+ },\r
0, // ExternalClock;\r
0, // MaxSpeed;\r
0, // CurrentSpeed;\r
\r
CHAR8 *mCpuSmbiosType4Strings[] = {\r
"Socket",\r
- "edk2.svn.sourceforge.net",\r
+ "http://www.tianocore.org/edk2/",\r
"Emulated Processor",\r
"1.0",\r
"1.0",\r
\r
\r
/**\r
- Logs SMBIOS record.\r
-\r
- Note: This should be a genric library function.\r
-\r
- @param Template Fixed SMBIOS structure\r
- @param StringPack Array of strings to convert to an SMBIOS string pack. \r
+ Create SMBIOS record.\r
+\r
+ Converts a fixed SMBIOS structure and an array of pointers to strings into\r
+ an SMBIOS record where the strings are cat'ed on the end of the fixed record\r
+ and terminated via a double NULL and add to SMBIOS table.\r
+\r
+ SMBIOS_TABLE_TYPE32 gSmbiosType12 = {\r
+ { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },\r
+ 1 // StringCount\r
+ };\r
+ CHAR8 *gSmbiosType12Strings[] = {\r
+ "Not Found",\r
+ NULL\r
+ };\r
+\r
+ ...\r
+ LogSmbiosData (\r
+ (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,\r
+ gSmbiosType12Strings\r
+ );\r
+\r
+ @param Template Fixed SMBIOS structure, required.\r
+ @param StringArray Array of strings to convert to an SMBIOS string pack.\r
+ NULL is OK.\r
\r
**/\r
EFI_STATUS\r
LogSmbiosData (\r
IN EFI_SMBIOS_TABLE_HEADER *Template,\r
- IN CHAR8 **StringPack \r
+ IN CHAR8 **StringPack\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_SMBIOS_PROTOCOL *Smbios; \r
+ EFI_SMBIOS_PROTOCOL *Smbios;\r
EFI_SMBIOS_HANDLE SmbiosHandle;\r
EFI_SMBIOS_TABLE_HEADER *Record;\r
UINTN Index;\r
\r
// Calculate the size of the fixed record and optional string pack\r
Size = Template->Length;\r
- for (Index = 0; StringPack[Index] != NULL; Index++) {\r
- StringSize = AsciiStrSize (StringPack[Index]);\r
- Size += StringSize;\r
+ if (StringPack == NULL) {\r
+ // At least a double null is required\r
+ Size += 2;\r
+ } else {\r
+ for (Index = 0; StringPack[Index] != NULL; Index++) {\r
+ StringSize = AsciiStrSize (StringPack[Index]);\r
+ Size += StringSize;\r
+ }\r
+ if (StringPack[0] == NULL) {\r
+ // At least a double null is required\r
+ Size += 1;\r
+ }\r
+ // Don't forget the terminating double null\r
+ Size += 1;\r
}\r
- // Don't forget the terminating double null\r
- Size += 1;\r
\r
// Copy over Template\r
Record = (EFI_SMBIOS_TABLE_HEADER *)AllocateZeroPool (Size);\r
Str += StringSize;\r
}\r
*Str = 0;\r
- \r
+\r
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
Status = Smbios->Add (\r
Smbios,\r
Record\r
);\r
ASSERT_EFI_ERROR (Status);\r
- \r
+\r
FreePool (Record);\r
return Status;\r
}\r
IN UINTN MaxCpus\r
)\r
{\r
- mCpuSmbiosType4.CoreCount = MaxCpus;\r
- mCpuSmbiosType4.EnabledCoreCount = MaxCpus;\r
- mCpuSmbiosType4.ThreadCount = MaxCpus;\r
+ mCpuSmbiosType4.CoreCount = (UINT8) MaxCpus;\r
+ mCpuSmbiosType4.EnabledCoreCount = (UINT8) MaxCpus;\r
+ mCpuSmbiosType4.ThreadCount = (UINT8) MaxCpus;\r
\r
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCpuSmbiosType4, mCpuSmbiosType4Strings);\r
}\r
IN EFI_CPU_INIT_TYPE InitType\r
)\r
{\r
- CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
return EFI_UNSUPPORTED;\r
}\r
\r
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
)\r
{\r
- CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
//\r
// Do parameter checking for EFI spec conformance\r
//\r
//\r
// Do nothing for Emu emulation\r
//\r
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
return EFI_UNSUPPORTED;\r
}\r
\r
IN UINT64 Attributes\r
)\r
{\r
- CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
//\r
// Check for invalid parameter for Spec conformance\r
//\r
//\r
// Do nothing for Nt32 emulation\r
//\r
- Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
return EFI_UNSUPPORTED;\r
}\r
\r