blob: 8b2901a8d5d9381a08dceaecae03fb2eb5837bf9 [file] [log] [blame]
Uwe Hermanne89d8a52010-11-26 22:39:40 +00001/*
2 * This file is part of the coreboot project.
3 *
Uwe Hermann42b1c432010-12-09 18:09:14 +00004 * Copyright (C) 2008 Advanced Micro Devices, Inc.
Uwe Hermanne89d8a52010-11-26 22:39:40 +00005 *
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
Uwe Hermann42b1c432010-12-09 18:09:14 +00008 * the Free Software Foundation; version 2 of the License.
Uwe Hermanne89d8a52010-11-26 22:39:40 +00009 *
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.
Uwe Hermanne89d8a52010-11-26 22:39:40 +000014 */
15
Uwe Hermann42b1c432010-12-09 18:09:14 +000016#include <stdint.h>
17#include <arch/io.h>
Uwe Hermann42b1c432010-12-09 18:09:14 +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 SB600 power-on default is to map 256K ROM space.
27 *
28 * Details: AMD SB600 BIOS Developer's Guide (BDG), page 15.
29 */
30static void sb600_enable_rom(void)
31{
32 u8 reg8;
Edward O'Callaghan9a817ef2014-10-26 10:12:15 +110033 pci_devfn_t dev;
Uwe Hermann42b1c432010-12-09 18:09:14 +000034
Dave Frodinc877d222012-02-02 14:50:02 -070035 dev = pci_io_locate_device(PCI_ID(PCI_VENDOR_ID_ATI,
36 PCI_DEVICE_ID_ATI_SB600_LPC), 0);
Uwe Hermann42b1c432010-12-09 18:09:14 +000037
38 /* Decode variable LPC ROM address ranges 1 and 2. */
Dave Frodinc877d222012-02-02 14:50:02 -070039 reg8 = pci_io_read_config8(dev, 0x48);
Uwe Hermann42b1c432010-12-09 18:09:14 +000040 reg8 |= (1 << 3) | (1 << 4);
Dave Frodinc877d222012-02-02 14:50:02 -070041 pci_io_write_config8(dev, 0x48, reg8);
Uwe Hermann42b1c432010-12-09 18:09:14 +000042
43 /* LPC ROM address range 1: */
44 /* Enable LPC ROM range mirroring start at 0x000e(0000). */
Dave Frodinc877d222012-02-02 14:50:02 -070045 pci_io_write_config16(dev, 0x68, 0x000e);
Uwe Hermann42b1c432010-12-09 18:09:14 +000046 /* Enable LPC ROM range mirroring end at 0x000f(ffff). */
Dave Frodinc877d222012-02-02 14:50:02 -070047 pci_io_write_config16(dev, 0x6a, 0x000f);
Uwe Hermann42b1c432010-12-09 18:09:14 +000048
49 /* LPC ROM address range 2: */
50 /*
51 * Enable LPC ROM range start at:
52 * 0xfff8(0000): 512KB
53 * 0xfff0(0000): 1MB
54 * 0xffe0(0000): 2MB
55 * 0xffc0(0000): 4MB
56 */
Dave Frodinc877d222012-02-02 14:50:02 -070057 pci_io_write_config16(dev, 0x6c, 0x10000 - (CONFIG_COREBOOT_ROMSIZE_KB >> 6)); /* 4 MB */
Uwe Hermann42b1c432010-12-09 18:09:14 +000058 /* Enable LPC ROM range end at 0xffff(ffff). */
Dave Frodinc877d222012-02-02 14:50:02 -070059 pci_io_write_config16(dev, 0x6e, 0xffff);
Uwe Hermann42b1c432010-12-09 18:09:14 +000060}
Uwe Hermanne89d8a52010-11-26 22:39:40 +000061
62static void bootblock_southbridge_init(void)
63{
64 sb600_enable_rom();
65}