blob: e95d4e9ddfbac22d0ad2dfacaafdaf6e8a48a074 [file] [log] [blame]
Zheng Baod0985752011-01-20 04:45:48 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Advanced Micro Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Zheng Baod0985752011-01-20 04:45:48 +000014 */
15
16#include <stdint.h>
17#include <arch/io.h>
Zheng Baod0985752011-01-20 04:45:48 +000018#include <device/pci_ids.h>
19
20/*
21 * Enable 4MB (LPC) ROM access at 0xFFC00000 - 0xFFFFFFFF.
22 *
23 * Hardware should enable LPC ROM by pin straps. This function does not
24 * handle the theoretically possible PCI ROM, FWH, or SPI ROM configurations.
25 *
26 * The SB800 power-on default is to map 512K ROM space.
27 *
28 */
29static void sb800_enable_rom(void)
30{
31 u8 reg8;
Edward O'Callaghan9a817ef2014-10-26 10:12:15 +110032 pci_devfn_t dev;
Zheng Baod0985752011-01-20 04:45:48 +000033
Zheng Bao72cc87f2011-01-21 08:46:27 +000034 dev = PCI_DEV(0, 0x14, 3);
Zheng Baod0985752011-01-20 04:45:48 +000035
36 /* Decode variable LPC ROM address ranges 1 and 2. */
Dave Frodin2eacc0e2012-02-02 14:56:23 -070037 reg8 = pci_io_read_config8(dev, 0x48);
Zheng Baod0985752011-01-20 04:45:48 +000038 reg8 |= (1 << 3) | (1 << 4);
Dave Frodin2eacc0e2012-02-02 14:56:23 -070039 pci_io_write_config8(dev, 0x48, reg8);
Zheng Baod0985752011-01-20 04:45:48 +000040
41 /* LPC ROM address range 1: */
42 /* Enable LPC ROM range mirroring start at 0x000e(0000). */
Dave Frodin2eacc0e2012-02-02 14:56:23 -070043 pci_io_write_config16(dev, 0x68, 0x000e);
Zheng Baod0985752011-01-20 04:45:48 +000044 /* Enable LPC ROM range mirroring end at 0x000f(ffff). */
Dave Frodin2eacc0e2012-02-02 14:56:23 -070045 pci_io_write_config16(dev, 0x6a, 0x000f);
Zheng Baod0985752011-01-20 04:45:48 +000046
47 /* LPC ROM address range 2: */
48 /*
49 * Enable LPC ROM range start at:
50 * 0xfff8(0000): 512KB
51 * 0xfff0(0000): 1MB
52 * 0xffe0(0000): 2MB
53 * 0xffc0(0000): 4MB
54 */
Dave Frodin2eacc0e2012-02-02 14:56:23 -070055 pci_io_write_config16(dev, 0x6c, 0x10000 - (CONFIG_COREBOOT_ROMSIZE_KB >> 6));
Zheng Baod0985752011-01-20 04:45:48 +000056 /* Enable LPC ROM range end at 0xffff(ffff). */
Dave Frodin2eacc0e2012-02-02 14:56:23 -070057 pci_io_write_config16(dev, 0x6e, 0xffff);
Zheng Baod0985752011-01-20 04:45:48 +000058}
59
60static void bootblock_southbridge_init(void)
61{
62 sb800_enable_rom();
63}