]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: Add microcode definitions defined in IA32 SDM
authorJeff Fan <jeff.fan@intel.com>
Tue, 19 Jul 2016 01:49:35 +0000 (09:49 +0800)
committerJeff Fan <jeff.fan@intel.com>
Wed, 17 Aug 2016 11:55:25 +0000 (19:55 +0800)
Add microcode definitions defined in Intel(R) 64 and IA-32 Architectures
Software Developer's Manual Volume 3A, Section 9.11.

v4:
  1. ProcessorSignature type changed to CPU_MICROCODE_PROCESSOR_SIGNATURE
  2. Add pack(1) for structure CPU_MICROCODE_HEADER and
     CPU_MICROCODE_EXTENDED_TABLE.
v3:
  1. Update SDM date to June, 2016
  2. Mention BCD format in CPU_MICROCODE_DATE
  3. Rename ProcessorChecksum to Checksum to match SDM.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
UefiCpuPkg/Include/Register/Microcode.h [new file with mode: 0644]

diff --git a/UefiCpuPkg/Include/Register/Microcode.h b/UefiCpuPkg/Include/Register/Microcode.h
new file mode 100644 (file)
index 0000000..94529a1
--- /dev/null
@@ -0,0 +1,200 @@
+/** @file\r
+  Microcode Definitions.\r
+\r
+  Microcode Definitions based on contents of the\r
+  Intel(R) 64 and IA-32 Architectures Software Developer's Manual\r
+    Volume 3A, Section 9.11  Microcode Definitions\r
+\r
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  @par Specification Reference:\r
+  Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 3A,\r
+  June 2016, Chapter 9 Processor Management and Initialization, Section 9-11.\r
+\r
+**/\r
+\r
+#ifndef __MICROCODE_H__\r
+#define __MICROCODE_H__\r
+\r
+///\r
+/// CPU Microcode Date in BCD format\r
+///\r
+typedef union {\r
+  struct {\r
+    UINT32   Year:16;\r
+    UINT32   Day:8;\r
+    UINT32   Month:8;\r
+  } Bits;\r
+  UINT32     Uint32;\r
+} CPU_MICROCODE_DATE;\r
+\r
+///\r
+/// CPU Microcode Processor Signature format\r
+///\r
+typedef union {\r
+  struct {\r
+    UINT32   Stepping:4;\r
+    UINT32   Model:4;\r
+    UINT32   Family:4;\r
+    UINT32   Type:2;\r
+    UINT32   Reserved1:2;\r
+    UINT32   ExtendedModel:4;\r
+    UINT32   ExtendedFamily:8;\r
+    UINT32   Reserved2:4;\r
+  } Bits;\r
+  UINT32     Uint32;\r
+} CPU_MICROCODE_PROCESSOR_SIGNATURE;\r
+\r
+#pragma pack (1)\r
+\r
+///\r
+/// Microcode Update Format definition\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Version number of the update header\r
+  ///\r
+  UINT32                            HeaderVersion;\r
+  ///\r
+  /// Unique version number for the update, the basis for the update\r
+  /// signature provided by the processor to indicate the current update\r
+  /// functioning within the processor. Used by the BIOS to authenticate\r
+  /// the update and verify that the processor loads successfully. The\r
+  /// value in this field cannot be used for processor stepping identification\r
+  /// alone. This is a signed 32-bit number.\r
+  ///\r
+  UINT32                            UpdateRevision;\r
+  ///\r
+  /// Date of the update creation in binary format: mmddyyyy (e.g.\r
+  /// 07/18/98 is 07181998H).\r
+  ///\r
+  CPU_MICROCODE_DATE                Date;\r
+  ///\r
+  /// Extended family, extended model, type, family, model, and stepping\r
+  /// of processor that requires this particular update revision (e.g.,\r
+  /// 00000650H). Each microcode update is designed specifically for a\r
+  /// given extended family, extended model, type, family, model, and\r
+  /// stepping of the processor.\r
+  /// The BIOS uses the processor signature field in conjunction with the\r
+  /// CPUID instruction to determine whether or not an update is\r
+  /// appropriate to load on a processor. The information encoded within\r
+  /// this field exactly corresponds to the bit representations returned by\r
+  /// the CPUID instruction.\r
+  ///\r
+  CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature;\r
+  ///\r
+  /// Checksum of Update Data and Header. Used to verify the integrity of\r
+  /// the update header and data. Checksum is correct when the\r
+  /// summation of all the DWORDs (including the extended Processor\r
+  /// Signature Table) that comprise the microcode update result in\r
+  /// 00000000H.\r
+  ///\r
+  UINT32                            Checksum;\r
+  ///\r
+  /// Version number of the loader program needed to correctly load this\r
+  /// update. The initial version is 00000001H\r
+  ///\r
+  UINT32                            LoaderRevision;\r
+  ///\r
+  /// Platform type information is encoded in the lower 8 bits of this 4-\r
+  /// byte field. Each bit represents a particular platform type for a given\r
+  /// CPUID. The BIOS uses the processor flags field in conjunction with\r
+  /// the platform Id bits in MSR (17H) to determine whether or not an\r
+  /// update is appropriate to load on a processor. Multiple bits may be set\r
+  /// representing support for multiple platform IDs.\r
+  ///\r
+  UINT32                            ProcessorFlags;\r
+  ///\r
+  /// Specifies the size of the encrypted data in bytes, and must be a\r
+  /// multiple of DWORDs. If this value is 00000000H, then the microcode\r
+  /// update encrypted data is 2000 bytes (or 500 DWORDs).\r
+  ///\r
+  UINT32                            DataSize;\r
+  ///\r
+  /// Specifies the total size of the microcode update in bytes. It is the\r
+  /// summation of the header size, the encrypted data size and the size of\r
+  /// the optional extended signature table. This value is always a multiple\r
+  /// of 1024.\r
+  ///\r
+  UINT32                            TotalSize;\r
+  ///\r
+  /// Reserved fields for future expansion.\r
+  ///\r
+  UINT8                             Reserved[12];\r
+} CPU_MICROCODE_HEADER;\r
+\r
+///\r
+/// Extended Signature Table Header Field Definitions\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Specifies the number of extended signature structures (Processor\r
+  /// Signature[n], processor flags[n] and checksum[n]) that exist in this\r
+  /// microcode update\r
+  ///\r
+  UINT32                            ExtendedSignatureCount;\r
+  ///\r
+  /// Checksum of update extended processor signature table. Used to\r
+  /// verify the integrity of the extended processor signature table.\r
+  /// Checksum is correct when the summation of the DWORDs that\r
+  /// comprise the extended processor signature table results in\r
+  /// 00000000H.\r
+  ///\r
+  UINT32                            ExtendedChecksum;\r
+  ///\r
+  /// Reserved fields.\r
+  ///\r
+  UINT8                             Reserved[12];\r
+} CPU_MICROCODE_EXTENDED_TABLE_HEADER;\r
+\r
+///\r
+/// Extended Signature Table Field Definitions\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Extended family, extended model, type, family, model, and stepping\r
+  /// of processor that requires this particular update revision (e.g.,\r
+  /// 00000650H). Each microcode update is designed specifically for a\r
+  /// given extended family, extended model, type, family, model, and\r
+  /// stepping of the processor.\r
+  /// The BIOS uses the processor signature field in conjunction with the\r
+  /// CPUID instruction to determine whether or not an update is\r
+  /// appropriate to load on a processor. The information encoded within\r
+  /// this field exactly corresponds to the bit representations returned by\r
+  /// the CPUID instruction.\r
+  ///\r
+  CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature;\r
+  ///\r
+  /// Platform type information is encoded in the lower 8 bits of this 4-\r
+  /// byte field. Each bit represents a particular platform type for a given\r
+  /// CPUID. The BIOS uses the processor flags field in conjunction with\r
+  /// the platform Id bits in MSR (17H) to determine whether or not an\r
+  /// update is appropriate to load on a processor. Multiple bits may be set\r
+  /// representing support for multiple platform IDs.\r
+  ///\r
+  UINT32                             ProcessorFlag;\r
+  ///\r
+  /// Used by utility software to decompose a microcode update into\r
+  /// multiple microcode updates where each of the new updates is\r
+  /// constructed without the optional Extended Processor Signature\r
+  /// Table.\r
+  /// To calculate the Checksum, substitute the Primary Processor\r
+  /// Signature entry and the Processor Flags entry with the\r
+  /// corresponding Extended Patch entry. Delete the Extended Processor\r
+  /// Signature Table entries. The Checksum is correct when the\r
+  /// summation of all DWORDs that comprise the created Extended\r
+  /// Processor Patch results in 00000000H.\r
+  ///\r
+  UINT32                             Checksum;\r
+} CPU_MICROCODE_EXTENDED_TABLE;\r
+\r
+#pragma pack ()\r
+\r
+#endif\r