static void board_final_cleanup(void) { /* * Un-cache the ROM so the kernel has one * more MTRR available. * * Coreboot should have assigned this to the * top available variable MTRR. */ u8 top_mtrr = (native_read_msr(MTRR_CAP_MSR) & 0xff) - 1; u8 top_type = native_read_msr(MTRR_PHYS_BASE_MSR(top_mtrr)) & 0xff; /* Make sure this MTRR is the correct Write-Protected type */ if (top_type == MTRR_TYPE_WRPROT) { struct mtrr_state state; mtrr_open(&state); wrmsrl(MTRR_PHYS_BASE_MSR(top_mtrr), 0); wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0); mtrr_close(&state); } if (!fdtdec_get_config_bool(gd->fdt_blob, "u-boot,no-apm-finalize")) { /* * Issue SMI to coreboot to lock down ME and registers * when allowed via device tree */ printf("Finalizing coreboot\n"); outb(0xcb, 0xb2); } }
void board_final_cleanup(void) { /* Un-cache the ROM so the kernel has one * more MTRR available. * * Coreboot should have assigned this to the * top available variable MTRR. */ u8 top_mtrr = (native_read_msr(MTRR_CAP_MSR) & 0xff) - 1; u8 top_type = native_read_msr(MTRR_PHYS_BASE_MSR(top_mtrr)) & 0xff; /* Make sure this MTRR is the correct Write-Protected type */ if (top_type == MTRR_TYPE_WRPROT) { struct mtrr_state state; mtrr_open(&state); wrmsrl(MTRR_PHYS_BASE_MSR(top_mtrr), 0); wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0); mtrr_close(&state); } /* Issue SMI to Coreboot to lock down ME and registers */ printf("Finalizing Coreboot\n"); outb(0xcb, 0xb2); }
/* Prepare to adjust MTRRs */ void mtrr_open(struct mtrr_state *state) { state->enable_cache = dcache_status(); if (state->enable_cache) disable_caches(); state->deftype = native_read_msr(MTRR_DEF_TYPE_MSR); wrmsrl(MTRR_DEF_TYPE_MSR, state->deftype & ~MTRR_DEF_TYPE_EN); }