2015-07-05 12:20:03 +08:00
|
|
|
/* fit.h
|
|
|
|
|
|
|
|
Copyright (c) 2015, Nikolaj Schlej. 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
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
*/
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#ifndef FIT_H
|
|
|
|
#define FIT_H
|
2015-07-05 12:20:03 +08:00
|
|
|
|
|
|
|
#include "basetypes.h"
|
2016-07-05 23:22:03 +08:00
|
|
|
#include "ubytearray.h"
|
2015-07-05 12:20:03 +08:00
|
|
|
|
|
|
|
// Make sure we use right packing rules
|
2016-04-09 18:47:19 +08:00
|
|
|
#pragma pack(push, 1)
|
2015-07-05 12:20:03 +08:00
|
|
|
|
|
|
|
// Memory address of a pointer to FIT, 40h back from the end of flash chip
|
2015-07-07 21:57:41 +08:00
|
|
|
#define FIT_POINTER_OFFSET 0x40
|
2015-07-05 12:20:03 +08:00
|
|
|
|
|
|
|
// Entry types
|
|
|
|
#define FIT_TYPE_HEADER 0x00
|
|
|
|
#define FIT_TYPE_MICROCODE 0x01
|
|
|
|
#define FIT_TYPE_BIOS_AC_MODULE 0x02
|
|
|
|
#define FIT_TYPE_BIOS_INIT_MODULE 0x07
|
|
|
|
#define FIT_TYPE_TPM_POLICY 0x08
|
|
|
|
#define FIT_TYPE_BIOS_POLICY_DATA 0x09
|
|
|
|
#define FIT_TYPE_TXT_CONF_POLICY 0x0A
|
|
|
|
#define FIT_TYPE_AC_KEY_MANIFEST 0x0B
|
|
|
|
#define FIT_TYPE_AC_BOOT_POLICY 0x0C
|
2015-07-07 21:57:41 +08:00
|
|
|
#define FIT_TYPE_EMPTY 0x7F
|
2015-07-05 12:20:03 +08:00
|
|
|
|
|
|
|
#define FIT_HEADER_VERSION 0x0100
|
|
|
|
#define FIT_MICROCODE_VERSION 0x0100
|
|
|
|
|
2016-07-05 23:22:03 +08:00
|
|
|
const UByteArray FIT_SIGNATURE
|
2015-07-05 12:20:03 +08:00
|
|
|
("\x5F\x46\x49\x54\x5F\x20\x20\x20", 8);
|
|
|
|
|
2016-04-09 19:47:28 +08:00
|
|
|
typedef struct FIT_ENTRY_ {
|
2015-07-05 12:20:03 +08:00
|
|
|
UINT64 Address;
|
2017-10-12 13:59:23 +08:00
|
|
|
UINT32 Size : 24;
|
|
|
|
UINT32 : 8;
|
2015-07-05 12:20:03 +08:00
|
|
|
UINT16 Version;
|
2017-10-12 13:59:23 +08:00
|
|
|
UINT8 Type : 7;
|
|
|
|
UINT8 CsFlag : 1;
|
2015-07-05 12:20:03 +08:00
|
|
|
UINT8 Checksum;
|
|
|
|
} FIT_ENTRY;
|
|
|
|
|
2016-04-09 19:47:28 +08:00
|
|
|
typedef struct INTEL_MICROCODE_HEADER_ {
|
2015-07-05 12:20:03 +08:00
|
|
|
UINT32 Version;
|
|
|
|
UINT32 Revision;
|
2017-10-12 13:59:23 +08:00
|
|
|
UINT16 DateYear;
|
|
|
|
UINT8 DateDay;
|
|
|
|
UINT8 DateMonth;
|
2015-07-05 12:20:03 +08:00
|
|
|
UINT32 CpuSignature;
|
|
|
|
UINT32 Checksum;
|
|
|
|
UINT32 LoaderRevision;
|
|
|
|
UINT32 CpuFlags;
|
|
|
|
UINT32 DataSize;
|
|
|
|
UINT32 TotalSize;
|
|
|
|
UINT8 Reserved[12];
|
|
|
|
} INTEL_MICROCODE_HEADER;
|
|
|
|
|
2018-08-23 13:43:46 +08:00
|
|
|
typedef union {
|
|
|
|
struct {
|
|
|
|
UINT16 IndexRegisterAddress;
|
|
|
|
UINT16 DataRegisterAddress;
|
|
|
|
UINT8 AccessWidth;
|
|
|
|
UINT8 BitPosition;
|
|
|
|
UINT16 Index;
|
|
|
|
} IndexedIOPtrInfo;
|
|
|
|
struct {
|
|
|
|
UINT64 FlatMemoryPhysicalAddress : 63;
|
|
|
|
UINT64 TxtEnabled : 1; // bit 0 - configuration policy (0 = TXT Disabled, 1 = TXT Enabled)
|
|
|
|
} FlatMemoryPtrInfo;
|
|
|
|
} TXT_CONFIG_POLICY;
|
|
|
|
|
2016-04-15 02:36:59 +08:00
|
|
|
#define INTEL_MICROCODE_HEADER_VERSION 0x00000001
|
|
|
|
#define INTEL_MICROCODE_HEADER_RESERVED_BYTE 0x00
|
|
|
|
#define INTEL_MICROCODE_HEADER_SIZES_VALID(ptr) (((INTEL_MICROCODE_HEADER*)ptr)->TotalSize - ((INTEL_MICROCODE_HEADER*)ptr)->DataSize == sizeof(INTEL_MICROCODE_HEADER))
|
|
|
|
|
2015-07-05 12:20:03 +08:00
|
|
|
#pragma pack(pop)
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#endif // FIT_H
|