Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Lewiński <[email protected]>
  • Loading branch information
filipleple committed Aug 23, 2024
1 parent fe4b7ff commit 3f25d73
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
21 changes: 1 addition & 20 deletions src/soc/intel/baytrail/lockdown.c
Original file line number Diff line number Diff line change
@@ -1,47 +1,29 @@
#include <stdint.h>
#include <acpi/acpi_gnvs.h>
#include <arch/io.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <cpu/x86/cache.h>
#include <cpu/x86/smm.h>
#include <cpu/intel/em64t100_save_state.h>
#include <device/pci_def.h>
#include <elog.h>
#include <halt.h>
#include <spi-generic.h>
#include <smmstore.h>
#include <soc/spi.h>
#include <soc/iomap.h>
#include <soc/iosf.h>
#include <soc/pci_devs.h>
#include <soc/pm.h>
#include <soc/nvs.h>
#include <soc/device_nvs.h>
#include <soc/lockdown.h>
#include <bootstate.h>
#include <dasharo/options.h>

// huge overkill with the includes
// let's worry about that later, when it works

void enable_smm_bwp(void){
void *scs = (void *)(SPI_BASE_ADDRESS + SCS);
void *bcr = (void *)(SPI_BASE_ADDRESS + BCR);
uint32_t reg;

// Set to enable SMI generation on WP attempts
reg = read32(scs);
reg |= SMIWPEN; // Set SMIWPEN
reg |= SMIWPEN;
write32(scs, reg);

reg = read32(bcr);
// Set to enforce SMM-based protection
reg |= EISS;
// Set to lock the BIOS write protection settings
reg |= BCR_LE;
// Unset WPDisable
// reg &= ~BCR_WPD;
write32(bcr, reg);
}

Expand All @@ -66,7 +48,6 @@ bool wpd_status(void)

void platform_lockdown_config(void *unused){
if(CONFIG(BOOTMEDIA_SMM_BWP) && is_smm_bwp_permitted()){
printk(BIOS_DEBUG, "Enabling SMM BWP\n");
enable_smm_bwp();
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/soc/intel/baytrail/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,7 @@ static void southbridge_smi_store(void)
ret = smmstore_exec(sub_command, (void *)reg_ebx);
io_smi->rax = ret;

printk(BIOS_DEBUG, "flash SMI triggered\n");

if (!wpd_status() && is_smm_bwp_permitted()) {
printk(BIOS_DEBUG, "enabling smm bwp again\n");
enable_smm_bwp();
}
}
Expand Down

0 comments on commit 3f25d73

Please sign in to comment.