coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
smi.c File Reference
#include <device/device.h>
#include <device/pci.h>
#include <console/console.h>
#include <arch/io.h>
#include <device/pci_ops.h>
#include <acpi/acpi.h>
#include <cpu/x86/cache.h>
#include <cpu/x86/smm.h>
#include <cpu/x86/smi_deprecated.h>
#include <string.h>
#include <southbridge/intel/common/pmutil.h>
#include "i82801ix.h"
Include dependency graph for smi.c:

Go to the source code of this file.

Macros

#define SMRAM   0x9d
 
#define D_OPEN   (1 << 6)
 
#define D_CLS   (1 << 5)
 
#define D_LCK   (1 << 4)
 
#define G_SMRAME   (1 << 3)
 
#define C_BASE_SEG   ((0 << 2) | (1 << 1) | (0 << 0))
 

Functions

static void aseg_smm_relocate (void)
 
static void aseg_smm_install (void)
 
void smm_init (void)
 
void smm_init_completion (void)
 
void aseg_smm_lock (void)
 

Variables

static u16 pmbase = DEFAULT_PMBASE
 
uint8_t smm_relocation_start
 
uint8_t smm_relocation_end
 
static voiddefault_smm_area = NULL
 
static int smm_handler_copied = 0
 

Macro Definition Documentation

◆ C_BASE_SEG

#define C_BASE_SEG   ((0 << 2) | (1 << 1) | (0 << 0))

Definition at line 22 of file smi.c.

◆ D_CLS

#define D_CLS   (1 << 5)

Definition at line 19 of file smi.c.

◆ D_LCK

#define D_LCK   (1 << 4)

Definition at line 20 of file smi.c.

◆ D_OPEN

#define D_OPEN   (1 << 6)

Definition at line 18 of file smi.c.

◆ G_SMRAME

#define G_SMRAME   (1 << 3)

Definition at line 21 of file smi.c.

◆ SMRAM

#define SMRAM   0x9d

Definition at line 17 of file smi.c.

Function Documentation

◆ aseg_smm_install()

static void aseg_smm_install ( void  )
static

Definition at line 108 of file smi.c.

References _binary_smm_end, _binary_smm_start, acpi_is_wakeup_s3(), C_BASE_SEG, D_OPEN, G_SMRAME, memcpy(), pci_write_config8(), pcidev_on_root(), smm_handler_copied, SMRAM, and wbinvd().

Referenced by smm_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ aseg_smm_lock()

void aseg_smm_lock ( void  )

Definition at line 153 of file smi.c.

References BIOS_DEBUG, C_BASE_SEG, D_LCK, G_SMRAME, northbridge_write_smram(), pci_write_config8(), pcidev_on_root(), printk, and SMRAM.

Referenced by lpc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ aseg_smm_relocate()

static void aseg_smm_relocate ( void  )
static

There are several methods of raising a controlled SMI# via software, among them:

  • Writes to io 0xb2 (APMC)
  • Writes to the Local Apic ICR with Delivery mode SMI.

Using the local APIC is a bit more tricky. According to AMD Family 11 Processor BKDG no destination shorthand must be used. The whole SMM initialization is quite a bit hardware specific, so I'm not too worried about the better of the methods at the moment

Definition at line 32 of file smi.c.

References APM_CNT_NOOP_SMI, apm_control(), APMC_EN, backup_default_smm_area(), BIOS_DEBUG, BIOS_EN, BIOS_INFO, BIOS_SPEW, CONFIG, D31F0_PMBASE, default_smm_area, dump_alt_gp_smi_status(), dump_gpe0_status(), dump_pm1_status(), dump_smi_status(), dump_tco_status(), EOS, GBL_EN, GBL_SMI_EN, inl(), memcpy(), outl(), outw(), pci_read_config16(), pcidev_on_root(), PERIODIC_EN, PM1_EN, pmbase, printk, PWRBTN_EN, reset_alt_gp_smi_status(), reset_gpe0_status(), reset_pm1_status(), reset_smi_status(), reset_tco_status(), SMI_EN, smm_relocation_end, smm_relocation_start, TCO_EN, and wbinvd().

Referenced by smm_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smm_init()

void smm_init ( void  )

Definition at line 136 of file smi.c.

References aseg_smm_install(), aseg_smm_relocate(), and smi_set_eos().

Here is the call graph for this function:

◆ smm_init_completion()

void smm_init_completion ( void  )

Definition at line 148 of file smi.c.

References default_smm_area, and restore_default_smm_area().

Here is the call graph for this function:

Variable Documentation

◆ default_smm_area

void* default_smm_area = NULL
static

Definition at line 30 of file smi.c.

Referenced by aseg_smm_relocate(), and smm_init_completion().

◆ pmbase

u16 pmbase = DEFAULT_PMBASE
static

Definition at line 27 of file smi.c.

Referenced by aseg_smm_relocate().

◆ smm_handler_copied

int smm_handler_copied = 0
static

Definition at line 106 of file smi.c.

Referenced by aseg_smm_install().

◆ smm_relocation_end

uint8_t smm_relocation_end

Definition at line 29 of file smi.c.

◆ smm_relocation_start

uint8_t smm_relocation_start
extern