blob: d50c8e66546c5e2c672fda531665ae0d3e58dd4a [file] [log] [blame]
Stefan Reinauer8e073822012-04-04 00:07:22 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 The Chromium OS Authors. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <arch/io.h>
22#include <arch/romcc_io.h>
23#include <northbridge/intel/sandybridge/pcie_config.c>
24#include "pch.h"
Duncan Laurie312ee0c2012-09-09 20:12:32 -070025#include "spi.h"
Stefan Reinauer8e073822012-04-04 00:07:22 +020026
27void intel_pch_finalize_smm(void)
28{
29 /* Set SPI opcode menu */
30 RCBA16(0x3894) = SPI_OPPREFIX;
31 RCBA16(0x3896) = SPI_OPTYPE;
32 RCBA32(0x3898) = SPI_OPMENU_LOWER;
33 RCBA32(0x389c) = SPI_OPMENU_UPPER;
34
35 /* Lock SPIBAR */
36 RCBA32_OR(0x3804, (1 << 15));
Stefan Reinauer8e073822012-04-04 00:07:22 +020037
Duncan Laurie312ee0c2012-09-09 20:12:32 -070038#if CONFIG_SPI_FLASH_SMM
39 /* Re-init SPI driver to handle locked BAR */
40 spi_init();
41#endif
42
Stefan Reinauer8e073822012-04-04 00:07:22 +020043 /* TCLOCKDN: TC Lockdown */
44 RCBA32_OR(0x0050, (1 << 31));
45
46 /* BIOS Interface Lockdown */
47 RCBA32_OR(0x3410, (1 << 0));
48
49 /* Function Disable SUS Well Lockdown */
50 RCBA_AND_OR(8, 0x3420, ~0U, (1 << 7));
51
52 /* Global SMI Lock */
53 pcie_or_config16(PCH_LPC_DEV, 0xa0, 1 << 4);
54
55 /* GEN_PMCON Lock */
56 pcie_or_config8(PCH_LPC_DEV, 0xa6, (1 << 1) | (1 << 2));
57
58 /* R/WO registers */
59 RCBA32(0x21a4) = RCBA32(0x21a4);
60 pcie_write_config32(PCI_DEV(0, 27, 0), 0x74,
61 pcie_read_config32(PCI_DEV(0, 27, 0), 0x74));
62}