Home | History | Annotate | Download | only in Register
      1 /** @file
      2   Microcode Definitions.
      3 
      4   Microcode Definitions based on contents of the
      5   Intel(R) 64 and IA-32 Architectures Software Developer's Manual
      6     Volume 3A, Section 9.11  Microcode Definitions
      7 
      8   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
      9   This program and the accompanying materials
     10   are licensed and made available under the terms and conditions of the BSD License
     11   which accompanies this distribution.  The full text of the license may be found at
     12   http://opensource.org/licenses/bsd-license.php
     13 
     14   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     15   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     16 
     17   @par Specification Reference:
     18   Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 3A,
     19   June 2016, Chapter 9 Processor Management and Initialization, Section 9-11.
     20 
     21 **/
     22 
     23 #ifndef __MICROCODE_H__
     24 #define __MICROCODE_H__
     25 
     26 ///
     27 /// CPU Microcode Date in BCD format
     28 ///
     29 typedef union {
     30   struct {
     31     UINT32   Year:16;
     32     UINT32   Day:8;
     33     UINT32   Month:8;
     34   } Bits;
     35   UINT32     Uint32;
     36 } CPU_MICROCODE_DATE;
     37 
     38 ///
     39 /// CPU Microcode Processor Signature format
     40 ///
     41 typedef union {
     42   struct {
     43     UINT32   Stepping:4;
     44     UINT32   Model:4;
     45     UINT32   Family:4;
     46     UINT32   Type:2;
     47     UINT32   Reserved1:2;
     48     UINT32   ExtendedModel:4;
     49     UINT32   ExtendedFamily:8;
     50     UINT32   Reserved2:4;
     51   } Bits;
     52   UINT32     Uint32;
     53 } CPU_MICROCODE_PROCESSOR_SIGNATURE;
     54 
     55 #pragma pack (1)
     56 
     57 ///
     58 /// Microcode Update Format definition
     59 ///
     60 typedef struct {
     61   ///
     62   /// Version number of the update header
     63   ///
     64   UINT32                            HeaderVersion;
     65   ///
     66   /// Unique version number for the update, the basis for the update
     67   /// signature provided by the processor to indicate the current update
     68   /// functioning within the processor. Used by the BIOS to authenticate
     69   /// the update and verify that the processor loads successfully. The
     70   /// value in this field cannot be used for processor stepping identification
     71   /// alone. This is a signed 32-bit number.
     72   ///
     73   UINT32                            UpdateRevision;
     74   ///
     75   /// Date of the update creation in binary format: mmddyyyy (e.g.
     76   /// 07/18/98 is 07181998H).
     77   ///
     78   CPU_MICROCODE_DATE                Date;
     79   ///
     80   /// Extended family, extended model, type, family, model, and stepping
     81   /// of processor that requires this particular update revision (e.g.,
     82   /// 00000650H). Each microcode update is designed specifically for a
     83   /// given extended family, extended model, type, family, model, and
     84   /// stepping of the processor.
     85   /// The BIOS uses the processor signature field in conjunction with the
     86   /// CPUID instruction to determine whether or not an update is
     87   /// appropriate to load on a processor. The information encoded within
     88   /// this field exactly corresponds to the bit representations returned by
     89   /// the CPUID instruction.
     90   ///
     91   CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature;
     92   ///
     93   /// Checksum of Update Data and Header. Used to verify the integrity of
     94   /// the update header and data. Checksum is correct when the
     95   /// summation of all the DWORDs (including the extended Processor
     96   /// Signature Table) that comprise the microcode update result in
     97   /// 00000000H.
     98   ///
     99   UINT32                            Checksum;
    100   ///
    101   /// Version number of the loader program needed to correctly load this
    102   /// update. The initial version is 00000001H
    103   ///
    104   UINT32                            LoaderRevision;
    105   ///
    106   /// Platform type information is encoded in the lower 8 bits of this 4-
    107   /// byte field. Each bit represents a particular platform type for a given
    108   /// CPUID. The BIOS uses the processor flags field in conjunction with
    109   /// the platform Id bits in MSR (17H) to determine whether or not an
    110   /// update is appropriate to load on a processor. Multiple bits may be set
    111   /// representing support for multiple platform IDs.
    112   ///
    113   UINT32                            ProcessorFlags;
    114   ///
    115   /// Specifies the size of the encrypted data in bytes, and must be a
    116   /// multiple of DWORDs. If this value is 00000000H, then the microcode
    117   /// update encrypted data is 2000 bytes (or 500 DWORDs).
    118   ///
    119   UINT32                            DataSize;
    120   ///
    121   /// Specifies the total size of the microcode update in bytes. It is the
    122   /// summation of the header size, the encrypted data size and the size of
    123   /// the optional extended signature table. This value is always a multiple
    124   /// of 1024.
    125   ///
    126   UINT32                            TotalSize;
    127   ///
    128   /// Reserved fields for future expansion.
    129   ///
    130   UINT8                             Reserved[12];
    131 } CPU_MICROCODE_HEADER;
    132 
    133 ///
    134 /// Extended Signature Table Header Field Definitions
    135 ///
    136 typedef struct {
    137   ///
    138   /// Specifies the number of extended signature structures (Processor
    139   /// Signature[n], processor flags[n] and checksum[n]) that exist in this
    140   /// microcode update
    141   ///
    142   UINT32                            ExtendedSignatureCount;
    143   ///
    144   /// Checksum of update extended processor signature table. Used to
    145   /// verify the integrity of the extended processor signature table.
    146   /// Checksum is correct when the summation of the DWORDs that
    147   /// comprise the extended processor signature table results in
    148   /// 00000000H.
    149   ///
    150   UINT32                            ExtendedChecksum;
    151   ///
    152   /// Reserved fields.
    153   ///
    154   UINT8                             Reserved[12];
    155 } CPU_MICROCODE_EXTENDED_TABLE_HEADER;
    156 
    157 ///
    158 /// Extended Signature Table Field Definitions
    159 ///
    160 typedef struct {
    161   ///
    162   /// Extended family, extended model, type, family, model, and stepping
    163   /// of processor that requires this particular update revision (e.g.,
    164   /// 00000650H). Each microcode update is designed specifically for a
    165   /// given extended family, extended model, type, family, model, and
    166   /// stepping of the processor.
    167   /// The BIOS uses the processor signature field in conjunction with the
    168   /// CPUID instruction to determine whether or not an update is
    169   /// appropriate to load on a processor. The information encoded within
    170   /// this field exactly corresponds to the bit representations returned by
    171   /// the CPUID instruction.
    172   ///
    173   CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature;
    174   ///
    175   /// Platform type information is encoded in the lower 8 bits of this 4-
    176   /// byte field. Each bit represents a particular platform type for a given
    177   /// CPUID. The BIOS uses the processor flags field in conjunction with
    178   /// the platform Id bits in MSR (17H) to determine whether or not an
    179   /// update is appropriate to load on a processor. Multiple bits may be set
    180   /// representing support for multiple platform IDs.
    181   ///
    182   UINT32                             ProcessorFlag;
    183   ///
    184   /// Used by utility software to decompose a microcode update into
    185   /// multiple microcode updates where each of the new updates is
    186   /// constructed without the optional Extended Processor Signature
    187   /// Table.
    188   /// To calculate the Checksum, substitute the Primary Processor
    189   /// Signature entry and the Processor Flags entry with the
    190   /// corresponding Extended Patch entry. Delete the Extended Processor
    191   /// Signature Table entries. The Checksum is correct when the
    192   /// summation of all DWORDs that comprise the created Extended
    193   /// Processor Patch results in 00000000H.
    194   ///
    195   UINT32                             Checksum;
    196 } CPU_MICROCODE_EXTENDED_TABLE;
    197 
    198 #pragma pack ()
    199 
    200 #endif
    201