Add TINY_BOOTBLOCK support for AMD SB700.
[coreboot.git] / src / southbridge / amd / sb700 / bootblock.c
1 /*
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.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #include <stdint.h>
21 #include <arch/io.h>
22 #include <arch/romcc_io.h>
23 #include <device/pci_ids.h>
24
25 /*
26  * Enable 1MB (LPC) ROM access at 0xFFF00000 - 0xFFFFFFFF.
27  *
28  * Hardware should enable LPC ROM by pin straps. This function does not
29  * handle the theoretically possible PCI ROM, FWH, or SPI ROM configurations.
30  *
31  * The SB700 power-on default is to map 256K ROM space.
32  *
33  * Details: AMD SB700/710/750 BIOS Developer's Guide (BDG), Rev. 1.00,
34  *          PN 43366_sb7xx_bdg_pub_1.00, June 2009, section 3.1, page 14.
35  */
36 static void sb700_enable_rom(void)
37 {
38         u8 reg8;
39         device_t dev;
40
41         dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_ATI,
42                                 PCI_DEVICE_ID_ATI_SB700_LPC), 0);
43
44         /* Decode variable LPC ROM address ranges 1 and 2. */
45         reg8 = pci_read_config8(dev, 0x48);
46         reg8 |= (1 << 3) | (1 << 4);
47         pci_write_config8(dev, 0x48, reg8);
48
49         /* LPC ROM address range 1: */
50         /* Enable LPC ROM range mirroring start at 0x000e(0000). */
51         pci_write_config16(dev, 0x68, 0x000e);
52         /* Enable LPC ROM range mirroring end at 0x000f(ffff). */
53         pci_write_config16(dev, 0x6a, 0x000f);
54
55         /* LPC ROM address range 2: */
56         /*
57          * Enable LPC ROM range start at:
58          * 0xfff8(0000): 512KB
59          * 0xfff0(0000): 1MB
60          */
61         pci_write_config16(dev, 0x6c, 0xfff0); /* 1 MB */
62         /* Enable LPC ROM range end at 0xffff(ffff). */
63         pci_write_config16(dev, 0x6e, 0xffff);
64 }
65
66 static void bootblock_southbridge_init(void)
67 {
68         sb700_enable_rom();
69 }