summaryrefslogtreecommitdiff
path: root/Nt32Pkg/CpuRuntimeDxe
diff options
context:
space:
mode:
authordavidhuang <davidhuang@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-20 04:02:03 +0000
committerdavidhuang <davidhuang@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-20 04:02:03 +0000
commit1fdd39d371ecd0c660dce8926add29846c95cd37 (patch)
treea29761d31d8e025753d9b4e3d0c45b86cf425c09 /Nt32Pkg/CpuRuntimeDxe
parent310b04e6f192fc7494b1f69fd37efeef6aacfc50 (diff)
downloadedk2-platforms-1fdd39d371ecd0c660dce8926add29846c95cd37.tar.xz
1. PI SMBIOS Checkin. Major change include:
1) Produce PI SMBIOS protocol in MdeModulePkg 2) Update all consumers (in CorePkgs and native platform pkgs) to consume SMBIOS protocol instead of DataHub 3) Pass ECC tool; Verify Nt32, Duet, Unix platform git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9457 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg/CpuRuntimeDxe')
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/Cpu.c132
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/CpuDriver.h5
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf9
3 files changed, 75 insertions, 71 deletions
diff --git a/Nt32Pkg/CpuRuntimeDxe/Cpu.c b/Nt32Pkg/CpuRuntimeDxe/Cpu.c
index f0a138d96d..074781e6ff 100644
--- a/Nt32Pkg/CpuRuntimeDxe/Cpu.c
+++ b/Nt32Pkg/CpuRuntimeDxe/Cpu.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -55,19 +55,6 @@ CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
-typedef union {
- EFI_CPU_DATA_RECORD *DataRecord;
- UINT8 *Raw;
-} EFI_CPU_DATA_RECORD_BUFFER;
-
-EFI_SUBCLASS_TYPE1_HEADER mCpuDataRecordHeader = {
- EFI_PROCESSOR_SUBCLASS_VERSION, // Version
- sizeof (EFI_SUBCLASS_TYPE1_HEADER), // Header Size
- 0, // Instance, Initialize later
- EFI_SUBCLASS_INSTANCE_NON_APPLICABLE, // SubInstance
- 0 // RecordType, Initialize later
-};
-
//
// Service routines for the driver
//
@@ -390,14 +377,42 @@ Returns:
}
+
+/**
+ Logs SMBIOS record.
+
+ @param Smbios Pointer to SMBIOS protocol instance.
+ @param Buffer Pointer to the data buffer.
+
+**/
+VOID
+LogSmbiosData (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ IN UINT8 *Buffer
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+
+ SmbiosHandle = 0;
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER*)Buffer
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+
VOID
-CpuUpdateDataHub (
+CpuUpdateSmbios (
VOID
)
/*++
Routine Description:
- This function will log processor version and frequency data to data hub.
+ This function will log processor version and frequency data to Smbios.
Arguments:
Event - Event whose notification function is being invoked.
@@ -409,32 +424,25 @@ Returns:
--*/
{
EFI_STATUS Status;
- EFI_CPU_DATA_RECORD_BUFFER RecordBuffer;
- UINT32 HeaderSize;
UINT32 TotalSize;
- EFI_DATA_HUB_PROTOCOL *DataHub;
+ EFI_SMBIOS_PROTOCOL *Smbios;
EFI_HII_HANDLE HiiHandle;
+ STRING_REF Token;
+ UINTN CpuVerStrLen;
+ EFI_STRING CpuVerStr;
+ SMBIOS_TABLE_TYPE4 *SmbiosRecord;
+ CHAR8 *OptionalStrStart;
//
- // Locate DataHub protocol.
+ // Locate Smbios protocol.
//
- Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID**)&DataHub);
+ Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios);
+
if (EFI_ERROR (Status)) {
return;
}
//
- // Initialize data record header
- //
- mCpuDataRecordHeader.Instance = 1;
- HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
-
- RecordBuffer.Raw = AllocatePool (HeaderSize + EFI_CPU_DATA_MAXIMUM_LENGTH);
- if (RecordBuffer.Raw == NULL) {
- return ;
- }
-
- //
// Initialize strings to HII database
//
HiiHandle = HiiAddPackages (
@@ -445,40 +453,40 @@ Returns:
);
ASSERT (HiiHandle != NULL);
- CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
-
+ Token = STRING_TOKEN (STR_PROCESSOR_VERSION);
+ CpuVerStr = HiiGetPackageString(&gEfiCallerIdGuid, Token, NULL);
+ CpuVerStrLen = StrLen(CpuVerStr);
+ ASSERT (CpuVerStrLen <= SMBIOS_STRING_MAX_LENGTH);
- RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorVersionRecordType;
- RecordBuffer.DataRecord->VariableRecord.ProcessorVersion = STRING_TOKEN (STR_PROCESSOR_VERSION);
- TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_VERSION_DATA);
- Status = DataHub->LogData (
- DataHub,
- &gEfiProcessorSubClassGuid,
- &gEfiCallerIdGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- RecordBuffer.Raw,
- TotalSize
- );
+ TotalSize = sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1;
+ SmbiosRecord = AllocatePool(TotalSize);
+ ZeroMem(SmbiosRecord, TotalSize);
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE4);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ //
+ // Processor version is the 1st string.
+ //
+ SmbiosRecord->ProcessorVersion = 1;
//
// Store CPU frequency data record to data hub - It's an emulator so make up a value
//
- RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorCoreFrequencyRecordType;
- RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Value = 1234;
- RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Exponent = 6;
- TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CORE_FREQUENCY_DATA);
-
- Status = DataHub->LogData (
- DataHub,
- &gEfiProcessorSubClassGuid,
- &gEfiCallerIdGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- RecordBuffer.Raw,
- TotalSize
- );
-
- FreePool (RecordBuffer.Raw);
+ SmbiosRecord->CurrentSpeed = 1234;
+
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(CpuVerStr, OptionalStrStart);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ LogSmbiosData(Smbios, (UINT8 *) SmbiosRecord);
+ FreePool (SmbiosRecord);
+
}
@@ -512,7 +520,7 @@ Returns:
{
EFI_STATUS Status;
- CpuUpdateDataHub ();
+ CpuUpdateSmbios ();
Status = gBS->InstallMultipleProtocolInterfaces (
&mCpuTemplate.Handle,
@@ -524,5 +532,3 @@ Returns:
return Status;
}
-
-
diff --git a/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h b/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h
index f7fdea9a92..2cd644c489 100644
--- a/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h
+++ b/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -24,8 +24,9 @@ Abstract:
#include <FrameworkDxe.h>
+#include <IndustryStandard/SmBios.h>
#include <Protocol/Cpu.h>
-#include <Protocol/DataHub.h>
+#include <Protocol/Smbios.h>
#include <Protocol/FrameworkHii.h>
#include <Guid/DataHubRecords.h>
#include <Protocol/CpuIo.h>
diff --git a/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf b/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
index ded73b3661..28f116c3eb 100644
--- a/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
+++ b/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
@@ -2,7 +2,7 @@
# Component description file for Cpu module.
#
# This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair.
-# Copyright (c) 2006 - 2007, Intel Corporation
+# Copyright (c) 2006 - 2009, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -51,16 +51,13 @@
UefiDriverEntryPoint
DebugLib
HiiLib
-
-[Guids]
- gEfiProcessorSubClassGuid # SOMETIMES_CONSUMED
[Protocols]
gEfiWinNtIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
- gEfiDataHubProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
+ gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiWinNtIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiCpuIoProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
[Depex]
- gEfiDataHubProtocolGuid
+ gEfiSmbiosProtocolGuid