blob: 4a4f021a134710545f2daef9ae3d202272b0c4f0 [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>
Duncan Laurie04c5bae2012-08-13 09:37:42 -070023#include <console/post_codes.h>
Stefan Reinauer8e073822012-04-04 00:07:22 +020024#include <northbridge/intel/sandybridge/pcie_config.c>
25#include "pch.h"
Duncan Laurie312ee0c2012-09-09 20:12:32 -070026#include "spi.h"
Stefan Reinauer8e073822012-04-04 00:07:22 +020027
28void intel_pch_finalize_smm(void)
29{
30 /* Set SPI opcode menu */
31 RCBA16(0x3894) = SPI_OPPREFIX;
32 RCBA16(0x3896) = SPI_OPTYPE;
33 RCBA32(0x3898) = SPI_OPMENU_LOWER;
34 RCBA32(0x389c) = SPI_OPMENU_UPPER;
35
36 /* Lock SPIBAR */
37 RCBA32_OR(0x3804, (1 << 15));
Stefan Reinauer8e073822012-04-04 00:07:22 +020038
Duncan Laurie312ee0c2012-09-09 20:12:32 -070039#if CONFIG_SPI_FLASH_SMM
40 /* Re-init SPI driver to handle locked BAR */
41 spi_init();
42#endif
43
Stefan Reinauer8e073822012-04-04 00:07:22 +020044 /* TCLOCKDN: TC Lockdown */
45 RCBA32_OR(0x0050, (1 << 31));
46
47 /* BIOS Interface Lockdown */
48 RCBA32_OR(0x3410, (1 << 0));
49
50 /* Function Disable SUS Well Lockdown */
51 RCBA_AND_OR(8, 0x3420, ~0U, (1 << 7));
52
53 /* Global SMI Lock */
54 pcie_or_config16(PCH_LPC_DEV, 0xa0, 1 << 4);
55
56 /* GEN_PMCON Lock */
57 pcie_or_config8(PCH_LPC_DEV, 0xa6, (1 << 1) | (1 << 2));
58
59 /* R/WO registers */
60 RCBA32(0x21a4) = RCBA32(0x21a4);
61 pcie_write_config32(PCI_DEV(0, 27, 0), 0x74,
62 pcie_read_config32(PCI_DEV(0, 27, 0), 0x74));
Duncan Laurie04c5bae2012-08-13 09:37:42 -070063
64 /* Indicate finalize step with post code */
65 outb(POST_OS_BOOT, 0x80);
Stefan Reinauer8e073822012-04-04 00:07:22 +020066}