<p>Patrick Georgi <strong>merged</strong> this change.</p><p><a href="https://review.coreboot.org/c/coreboot/+/30018">View Change</a></p><div style="white-space:pre-wrap">Approvals:
build bot (Jenkins): Verified
Nico Huber: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sb/intel/i82801{g,j}x: Remove unused smi.c files<br><br>Now that all targets featuring these southbridges use SMM_TSEG these<br>files are unused.<br><br>Change-Id: Ic3a1d790f3595e98a8d33e6e8274cb72ad356a89<br>Signed-off-by: Arthur Heymans <arthur@aheymans.xyz><br>Reviewed-on: https://review.coreboot.org/c/30018<br>Reviewed-by: Nico Huber <nico.h@gmx.de><br>Tested-by: build bot (Jenkins) <no-reply@coreboot.org><br>---<br>D src/southbridge/intel/i82801gx/smi.c<br>D src/southbridge/intel/i82801jx/smi.c<br>2 files changed, 0 insertions(+), 366 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/southbridge/intel/i82801gx/smi.c b/src/southbridge/intel/i82801gx/smi.c</span><br><span>deleted file mode 100644</span><br><span>index 5618db7..0000000</span><br><span>--- a/src/southbridge/intel/i82801gx/smi.c</span><br><span>+++ /dev/null</span><br><span>@@ -1,185 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * This file is part of the coreboot project.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Copyright (C) 2008-2009 coresystems GmbH</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(0, 100%, 40%);">- * modify it under the terms of the GNU General Public License as</span><br><span style="color: hsl(0, 100%, 40%);">- * published by the Free Software Foundation; version 2 of</span><br><span style="color: hsl(0, 100%, 40%);">- * the License.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(0, 100%, 40%);">- * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(0, 100%, 40%);">- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span><br><span style="color: hsl(0, 100%, 40%);">- * GNU General Public License for more details.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <device/device.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <device/pci.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <console/console.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <arch/io.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <arch/acpi.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <cpu/x86/cache.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <cpu/x86/smm.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <string.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <southbridge/intel/common/pmutil.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include "i82801gx.h"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* I945 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define SMRAM 0x9d</span><br><span style="color: hsl(0, 100%, 40%);">-#define D_OPEN (1 << 6)</span><br><span style="color: hsl(0, 100%, 40%);">-#define D_CLS (1 << 5)</span><br><span style="color: hsl(0, 100%, 40%);">-#define D_LCK (1 << 4)</span><br><span style="color: hsl(0, 100%, 40%);">-#define G_SMRAME (1 << 3)</span><br><span style="color: hsl(0, 100%, 40%);">-#define C_BASE_SEG ((0 << 2) | (1 << 1) | (0 << 0))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* While we read PMBASE dynamically in case it changed, let's</span><br><span style="color: hsl(0, 100%, 40%);">- * initialize it with a sane value</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static u16 pmbase = DEFAULT_PMBASE;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-extern uint8_t smm_relocation_start, smm_relocation_end;</span><br><span style="color: hsl(0, 100%, 40%);">-static void *default_smm_area = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static void smm_relocate(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- u32 smi_en;</span><br><span style="color: hsl(0, 100%, 40%);">- u16 pm1_en;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_DEBUG, "Initializing SMM handler...");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- pmbase = pci_read_config16(dev_find_slot(0, PCI_DEVFN(0x1f, 0)), 0x40) & 0xfffc;</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_SPEW, " ... pmbase = 0x%04x\n", pmbase);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en = inl(pmbase + SMI_EN);</span><br><span style="color: hsl(0, 100%, 40%);">- if (smi_en & APMC_EN) {</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_INFO, "SMI# handler already enabled?\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- default_smm_area = backup_default_smm_area();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* copy the SMM relocation code */</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy((void *)0x38000, &smm_relocation_start,</span><br><span style="color: hsl(0, 100%, 40%);">- &smm_relocation_end - &smm_relocation_start);</span><br><span style="color: hsl(0, 100%, 40%);">- wbinvd();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_DEBUG, "\n");</span><br><span style="color: hsl(0, 100%, 40%);">- dump_smi_status(reset_smi_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_pm1_status(reset_pm1_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_gpe0_status(reset_gpe0_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_alt_gp_smi_status(reset_alt_gp_smi_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_tco_status(reset_tco_status());</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* Enable SMI generation:</span><br><span style="color: hsl(0, 100%, 40%);">- * - on TCO events</span><br><span style="color: hsl(0, 100%, 40%);">- * - on APMC writes (io 0xb2)</span><br><span style="color: hsl(0, 100%, 40%);">- * - on writes to SLP_EN (sleep states)</span><br><span style="color: hsl(0, 100%, 40%);">- * - on writes to GBL_RLS (bios commands)</span><br><span style="color: hsl(0, 100%, 40%);">- * No SMIs:</span><br><span style="color: hsl(0, 100%, 40%);">- * - on microcontroller writes (io 0x62/0x66)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en = 0; /* reset SMI enables */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#if 0</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= LEGACY_USB2_EN | LEGACY_USB_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= TCO_EN;</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= APMC_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-#if DEBUG_PERIODIC_SMIS</span><br><span style="color: hsl(0, 100%, 40%);">- /* Set DEBUG_PERIODIC_SMIS in i82801gx.h to debug using</span><br><span style="color: hsl(0, 100%, 40%);">- * periodic SMIs.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= PERIODIC_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= SLP_SMI_EN;</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= BIOS_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* The following need to be on for SMIs to happen */</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= EOS | GBL_SMI_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- outl(smi_en, pmbase + SMI_EN);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- pm1_en = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- pm1_en |= PWRBTN_EN;</span><br><span style="color: hsl(0, 100%, 40%);">- pm1_en |= GBL_EN;</span><br><span style="color: hsl(0, 100%, 40%);">- outw(pm1_en, pmbase + PM1_EN);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /**</span><br><span style="color: hsl(0, 100%, 40%);">- * There are several methods of raising a controlled SMI# via</span><br><span style="color: hsl(0, 100%, 40%);">- * software, among them:</span><br><span style="color: hsl(0, 100%, 40%);">- * - Writes to io 0xb2 (APMC)</span><br><span style="color: hsl(0, 100%, 40%);">- * - Writes to the Local Apic ICR with Delivery mode SMI.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Using the local apic is a bit more tricky. According to</span><br><span style="color: hsl(0, 100%, 40%);">- * AMD Family 11 Processor BKDG no destination shorthand must be</span><br><span style="color: hsl(0, 100%, 40%);">- * used.</span><br><span style="color: hsl(0, 100%, 40%);">- * The whole SMM initialization is quite a bit hardware specific, so</span><br><span style="color: hsl(0, 100%, 40%);">- * I'm not too worried about the better of the methods at the moment</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* raise an SMI interrupt */</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_SPEW, " ... raise SMI#\n");</span><br><span style="color: hsl(0, 100%, 40%);">- outb(0x00, 0xb2);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int smm_handler_copied = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static void smm_install(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- /* The first CPU running this gets to copy the SMM handler. But not all</span><br><span style="color: hsl(0, 100%, 40%);">- * of them.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (smm_handler_copied)</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(0, 100%, 40%);">- smm_handler_copied = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* if we're resuming from S3, the SMM code is already in place,</span><br><span style="color: hsl(0, 100%, 40%);">- * so don't copy it again to keep the current SMM state */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!acpi_is_wakeup_s3()) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* enable the SMM memory window */</span><br><span style="color: hsl(0, 100%, 40%);">- pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM,</span><br><span style="color: hsl(0, 100%, 40%);">- D_OPEN | G_SMRAME | C_BASE_SEG);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* copy the real SMM handler */</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy((void *)0xa0000, _binary_smm_start,</span><br><span style="color: hsl(0, 100%, 40%);">- _binary_smm_end - _binary_smm_start);</span><br><span style="color: hsl(0, 100%, 40%);">- wbinvd();</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* close the SMM memory window and enable normal SMM */</span><br><span style="color: hsl(0, 100%, 40%);">- pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM,</span><br><span style="color: hsl(0, 100%, 40%);">- G_SMRAME | C_BASE_SEG);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void smm_init(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- /* Put SMM code to 0xa0000 */</span><br><span style="color: hsl(0, 100%, 40%);">- smm_install();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* Put relocation code to 0x38000 and relocate SMBASE */</span><br><span style="color: hsl(0, 100%, 40%);">- smm_relocate();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* We're done. Make sure SMIs can happen! */</span><br><span style="color: hsl(0, 100%, 40%);">- smi_set_eos();</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void smm_init_completion(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- restore_default_smm_area(default_smm_area);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void smm_lock(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- /* LOCK the SMM memory window and enable normal SMM.</span><br><span style="color: hsl(0, 100%, 40%);">- * After running this function, only a full reset can</span><br><span style="color: hsl(0, 100%, 40%);">- * make the SMM registers writable again.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_DEBUG, "Locking SMM.\n");</span><br><span style="color: hsl(0, 100%, 40%);">- pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM,</span><br><span style="color: hsl(0, 100%, 40%);">- D_LCK | G_SMRAME | C_BASE_SEG);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span>diff --git a/src/southbridge/intel/i82801jx/smi.c b/src/southbridge/intel/i82801jx/smi.c</span><br><span>deleted file mode 100644</span><br><span>index 7ab5c28..0000000</span><br><span>--- a/src/southbridge/intel/i82801jx/smi.c</span><br><span>+++ /dev/null</span><br><span>@@ -1,181 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * This file is part of the coreboot project.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Copyright (C) 2008-2009 coresystems GmbH</span><br><span style="color: hsl(0, 100%, 40%);">- * 2012 secunet Security Networks AG</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(0, 100%, 40%);">- * modify it under the terms of the GNU General Public License as</span><br><span style="color: hsl(0, 100%, 40%);">- * published by the Free Software Foundation; version 2 of</span><br><span style="color: hsl(0, 100%, 40%);">- * the License.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(0, 100%, 40%);">- * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(0, 100%, 40%);">- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span><br><span style="color: hsl(0, 100%, 40%);">- * GNU General Public License for more details.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <device/device.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <device/pci.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <console/console.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <arch/io.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <arch/acpi.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <cpu/x86/cache.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <cpu/x86/smm.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <string.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <southbridge/intel/common/pmutil.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include "i82801jx.h"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* I945/GM45 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define SMRAM 0x9d</span><br><span style="color: hsl(0, 100%, 40%);">-#define D_OPEN (1 << 6)</span><br><span style="color: hsl(0, 100%, 40%);">-#define D_CLS (1 << 5)</span><br><span style="color: hsl(0, 100%, 40%);">-#define D_LCK (1 << 4)</span><br><span style="color: hsl(0, 100%, 40%);">-#define G_SMRAME (1 << 3)</span><br><span style="color: hsl(0, 100%, 40%);">-#define C_BASE_SEG ((0 << 2) | (1 << 1) | (0 << 0))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* While we read PMBASE dynamically in case it changed, let's</span><br><span style="color: hsl(0, 100%, 40%);">- * initialize it with a sane value</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static u16 pmbase = DEFAULT_PMBASE;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-extern uint8_t smm_relocation_start, smm_relocation_end;</span><br><span style="color: hsl(0, 100%, 40%);">-static void *default_smm_area = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static void smm_relocate(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- u32 smi_en;</span><br><span style="color: hsl(0, 100%, 40%);">- u16 pm1_en;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_DEBUG, "Initializing SMM handler...");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- pmbase = pci_read_config16(dev_find_slot(0, PCI_DEVFN(0x1f, 0)), D31F0_PMBASE) & 0xfffc;</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_SPEW, " ... pmbase = 0x%04x\n", pmbase);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en = inl(pmbase + SMI_EN);</span><br><span style="color: hsl(0, 100%, 40%);">- if (smi_en & GBL_SMI_EN) {</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_INFO, "SMI# handler already enabled?\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- default_smm_area = backup_default_smm_area();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* copy the SMM relocation code */</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy((void *)0x38000, &smm_relocation_start,</span><br><span style="color: hsl(0, 100%, 40%);">- &smm_relocation_end - &smm_relocation_start);</span><br><span style="color: hsl(0, 100%, 40%);">- wbinvd();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_DEBUG, "\n");</span><br><span style="color: hsl(0, 100%, 40%);">- dump_smi_status(reset_smi_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_pm1_status(reset_pm1_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_gpe0_status(reset_gpe0_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_alt_gp_smi_status(reset_alt_gp_smi_status());</span><br><span style="color: hsl(0, 100%, 40%);">- dump_tco_status(reset_tco_status());</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* Enable SMI generation:</span><br><span style="color: hsl(0, 100%, 40%);">- * - on TCO events</span><br><span style="color: hsl(0, 100%, 40%);">- * - on APMC writes (io 0xb2)</span><br><span style="color: hsl(0, 100%, 40%);">- * - on writes to GBL_RLS (bios commands)</span><br><span style="color: hsl(0, 100%, 40%);">- * No SMIs:</span><br><span style="color: hsl(0, 100%, 40%);">- * - on microcontroller writes (io 0x62/0x66)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en = 0; /* reset SMI enables */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= TCO_EN;</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= APMC_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-#if DEBUG_PERIODIC_SMIS</span><br><span style="color: hsl(0, 100%, 40%);">- /* Set DEBUG_PERIODIC_SMIS in i82801jx.h to debug using</span><br><span style="color: hsl(0, 100%, 40%);">- * periodic SMIs.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= PERIODIC_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= BIOS_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* The following need to be on for SMIs to happen */</span><br><span style="color: hsl(0, 100%, 40%);">- smi_en |= EOS | GBL_SMI_EN;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- outl(smi_en, pmbase + SMI_EN);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- pm1_en = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- pm1_en |= PWRBTN_EN;</span><br><span style="color: hsl(0, 100%, 40%);">- pm1_en |= GBL_EN;</span><br><span style="color: hsl(0, 100%, 40%);">- outw(pm1_en, pmbase + PM1_EN);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /**</span><br><span style="color: hsl(0, 100%, 40%);">- * There are several methods of raising a controlled SMI# via</span><br><span style="color: hsl(0, 100%, 40%);">- * software, among them:</span><br><span style="color: hsl(0, 100%, 40%);">- * - Writes to io 0xb2 (APMC)</span><br><span style="color: hsl(0, 100%, 40%);">- * - Writes to the Local Apic ICR with Delivery mode SMI.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Using the local apic is a bit more tricky. According to</span><br><span style="color: hsl(0, 100%, 40%);">- * AMD Family 11 Processor BKDG no destination shorthand must be</span><br><span style="color: hsl(0, 100%, 40%);">- * used.</span><br><span style="color: hsl(0, 100%, 40%);">- * The whole SMM initialization is quite a bit hardware specific, so</span><br><span style="color: hsl(0, 100%, 40%);">- * I'm not too worried about the better of the methods at the moment</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* raise an SMI interrupt */</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_SPEW, " ... raise SMI#\n");</span><br><span style="color: hsl(0, 100%, 40%);">- outb(0x00, 0xb2);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int smm_handler_copied = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static void smm_install(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- /* The first CPU running this gets to copy the SMM handler. But not all</span><br><span style="color: hsl(0, 100%, 40%);">- * of them.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (smm_handler_copied)</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(0, 100%, 40%);">- smm_handler_copied = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* if we're resuming from S3, the SMM code is already in place,</span><br><span style="color: hsl(0, 100%, 40%);">- * so don't copy it again to keep the current SMM state */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!acpi_is_wakeup_s3()) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* enable the SMM memory window */</span><br><span style="color: hsl(0, 100%, 40%);">- pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM,</span><br><span style="color: hsl(0, 100%, 40%);">- D_OPEN | G_SMRAME | C_BASE_SEG);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* copy the real SMM handler */</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy((void *)0xa0000, _binary_smm_start,</span><br><span style="color: hsl(0, 100%, 40%);">- _binary_smm_end - _binary_smm_start);</span><br><span style="color: hsl(0, 100%, 40%);">- wbinvd();</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* close the SMM memory window and enable normal SMM */</span><br><span style="color: hsl(0, 100%, 40%);">- pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM,</span><br><span style="color: hsl(0, 100%, 40%);">- G_SMRAME | C_BASE_SEG);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void smm_init(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- /* Put SMM code to 0xa0000 */</span><br><span style="color: hsl(0, 100%, 40%);">- smm_install();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* Put relocation code to 0x38000 and relocate SMBASE */</span><br><span style="color: hsl(0, 100%, 40%);">- smm_relocate();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* We're done. Make sure SMIs can happen! */</span><br><span style="color: hsl(0, 100%, 40%);">- smi_set_eos();</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void smm_init_completion(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- restore_default_smm_area(default_smm_area);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void smm_lock(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- /* LOCK the SMM memory window and enable normal SMM.</span><br><span style="color: hsl(0, 100%, 40%);">- * After running this function, only a full reset can</span><br><span style="color: hsl(0, 100%, 40%);">- * make the SMM registers writable again.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- printk(BIOS_DEBUG, "Locking SMM.\n");</span><br><span style="color: hsl(0, 100%, 40%);">- pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM,</span><br><span style="color: hsl(0, 100%, 40%);">- D_LCK | G_SMRAME | C_BASE_SEG);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/c/coreboot/+/30018">change 30018</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/c/coreboot/+/30018"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ic3a1d790f3595e98a8d33e6e8274cb72ad356a89 </div>
<div style="display:none"> Gerrit-Change-Number: 30018 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> </div>
<div style="display:none"> Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz> </div>
<div style="display:none"> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> </div>
<div style="display:none"> Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com> </div>
<div style="display:none"> Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org> </div>
<div style="display:none"> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>