mirror of
https://github.com/chipsec/chipsec
synced 2026-06-08 13:31:00 +00:00
0654edca19
Revision 1.2.0 -------------- This version includes the following new or updated modules: #. Merged common.secureboot.keys module into common.secureboot.variables module #. Updated tools.secureboot.te module to be able to test PE/TE issue on Linux or UEFI shell #. Updated tools.smm.smm_ptr module This version includes the following updates: #. Added the *controls* abstraction. Modules are encouraged to use ``get_control`` and ``set_control`` when interacting with platform registers. This permits greater flexibility in case the register that controls a given feature or configuration changes between platform generations. The controls are defined in the platform XML file. At this time, only a small number of controls are defined. We plan to move existing modules over to this new mechanism. #. Added XML Schema for the XML configuration files #. Support for reading, writing, and listing UEFI variables from the UEFI Shell environment has been added. #. Added support for decompression while SPI flash parsing via ``decode`` or ``uefi decode`` commands in Linux #. Added basic ACPI table parsing to HAL (RSDP, RSDT/XSDT, APIC, DMAR) #. Added UEFI tables searching and parsing to HAL (EFI system table, runtime services table, boot services table, DXE services table, EFI configuration table) #. Added DIMM Serial Presence Detect (SPD) ROM dumping and parsing to HAL #. Added ``uefi s3bootscript`` command parsing the S3 boot script to chipsec_util.py #. Added virtual-to-physical address translation function to Linux/EFI/Windows helpers #. Added support of server platforms (Haswell server and Ivy Town) to chipset.py This version has the following known issues: #. Decompression of images in SPI flash parsing is not available in UEFI shell. #. When calling alloc_phys_mem, the argument to set maximum physical address (max_pa) for allocation is ignored on linux. A message will be printed in dmesg if the allocation is above the max_pa that is passed in, but the call will return anyway. #. UEFI Shell environment does not support ``cpuid`` or ``get_thread_count``. There are functions that simply warn that they are not supported. #. Size of PCIEXBAR (MMCFG) is calculated incorrectly
69 lines
1.7 KiB
C
69 lines
1.7 KiB
C
#ifndef CHIPSEC_H
|
|
#define CHIPSEC_H
|
|
|
|
#define MSR_IA32_BIOS_UPDT_TRIG 0x79
|
|
#define MSR_IA32_BIOS_SIGN_ID 0x8b
|
|
|
|
#define IOCTL_BASE _IO(0, 0)
|
|
#define IOCTL_RDIO _IOWR(0, 0x1, int*)
|
|
#define IOCTL_WRIO _IOWR(0, 0x2, int*)
|
|
#define IOCTL_RDPCI _IOWR(0, 0x3, int*)
|
|
#define IOCTL_WRPCI _IOWR(0, 0x4, int*)
|
|
#define IOCTL_RDMSR _IOWR(0, 0x5, int*)
|
|
#define IOCTL_WRMSR _IOWR(0, 0x6, int*)
|
|
#define IOCTL_CPUID _IOWR(0, 0x7, int*)
|
|
#define IOCTL_GET_CPU_DESCRIPTOR_TABLE _IOWR(0, 0x8, int*)
|
|
#define IOCTL_SWSMI _IOWR(0, 0xA, int*)
|
|
#define IOCTL_LOAD_UCODE_PATCH _IOWR(0, 0xB, int*)
|
|
#define IOCTL_ALLOC_PHYSMEM _IOWR(0, 0xC, int*)
|
|
#define IOCTL_GET_EFIVAR _IOWR(0, 0xD, int*)
|
|
#define IOCTL_SET_EFIVAR _IOWR(0, 0xE, int*)
|
|
#define IOCTL_RDCR _IOWR(0, 0x10, int*)
|
|
#define IOCTL_WRCR _IOWR(0, 0x11, int*)
|
|
#define IOCTL_RDMMIO _IOWR(0, 0x12, int*)
|
|
#define IOCTL_WRMMIO _IOWR(0, 0x13, int*)
|
|
#define IOCTL_VA2PA _IOWR(0, 0x14, int*)
|
|
|
|
/// if defined debug is enabled
|
|
#define DEBUG
|
|
#ifdef DEBUG
|
|
/// Macro for debug print
|
|
#define dbgprint(format, args...) \
|
|
do { \
|
|
printk(KERN_DEBUG "%s %s %d: "format"\n", program_name, __FUNCTION__, __LINE__, ## args);\
|
|
} while ( 0 )
|
|
#else
|
|
#define dbgprint(format, args...) do {} while( 0 );
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef __x86_64__
|
|
typedef u64 physaddr_t;
|
|
#else
|
|
typedef __u32 physaddr_t;
|
|
#endif
|
|
|
|
typedef enum {
|
|
CPU_DT_CODE_IDTR = 0x0,
|
|
CPU_DT_CODE_GDTR = 0x1,
|
|
CPU_DT_CODE_LDTR = 0x2,
|
|
} DTR_CODE;
|
|
|
|
#pragma pack(1)
|
|
typedef union {
|
|
struct {
|
|
uint32_t low;
|
|
int32_t high;
|
|
} u;
|
|
physaddr_t quadpart;
|
|
} PHYSICAL_ADDRESS;
|
|
#pragma pack()
|
|
|
|
#pragma pack(1)
|
|
typedef struct _DESCRIPTOR_TABLE_RECORD {
|
|
uint16_t limit;
|
|
physaddr_t base;
|
|
} DESCRIPTOR_TABLE_RECORD, *PDESCRIPTOR_TABLE_RECORD;
|
|
#pragma pack()
|
|
|