Uwe Hermann | e89d8a5 | 2010-11-26 22:39:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 4 | * Copyright (C) 2008 Advanced Micro Devices, Inc. |
Uwe Hermann | e89d8a5 | 2010-11-26 22:39:40 +0000 | [diff] [blame] | 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 |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 8 | * the Free Software Foundation; version 2 of the License. |
Uwe Hermann | e89d8a5 | 2010-11-26 22:39:40 +0000 | [diff] [blame] | 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. |
Uwe Hermann | e89d8a5 | 2010-11-26 22:39:40 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 16 | #include <stdint.h> |
| 17 | #include <arch/io.h> |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 18 | #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 | */ |
| 30 | static void sb600_enable_rom(void) |
| 31 | { |
| 32 | u8 reg8; |
Edward O'Callaghan | 9a817ef | 2014-10-26 10:12:15 +1100 | [diff] [blame] | 33 | pci_devfn_t dev; |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 34 | |
Dave Frodin | c877d22 | 2012-02-02 14:50:02 -0700 | [diff] [blame] | 35 | dev = pci_io_locate_device(PCI_ID(PCI_VENDOR_ID_ATI, |
| 36 | PCI_DEVICE_ID_ATI_SB600_LPC), 0); |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 37 | |
| 38 | /* Decode variable LPC ROM address ranges 1 and 2. */ |
Dave Frodin | c877d22 | 2012-02-02 14:50:02 -0700 | [diff] [blame] | 39 | reg8 = pci_io_read_config8(dev, 0x48); |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 40 | reg8 |= (1 << 3) | (1 << 4); |
Dave Frodin | c877d22 | 2012-02-02 14:50:02 -0700 | [diff] [blame] | 41 | pci_io_write_config8(dev, 0x48, reg8); |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 42 | |
| 43 | /* LPC ROM address range 1: */ |
| 44 | /* Enable LPC ROM range mirroring start at 0x000e(0000). */ |
Dave Frodin | c877d22 | 2012-02-02 14:50:02 -0700 | [diff] [blame] | 45 | pci_io_write_config16(dev, 0x68, 0x000e); |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 46 | /* Enable LPC ROM range mirroring end at 0x000f(ffff). */ |
Dave Frodin | c877d22 | 2012-02-02 14:50:02 -0700 | [diff] [blame] | 47 | pci_io_write_config16(dev, 0x6a, 0x000f); |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 48 | |
| 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 Frodin | c877d22 | 2012-02-02 14:50:02 -0700 | [diff] [blame] | 57 | pci_io_write_config16(dev, 0x6c, 0x10000 - (CONFIG_COREBOOT_ROMSIZE_KB >> 6)); /* 4 MB */ |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 58 | /* Enable LPC ROM range end at 0xffff(ffff). */ |
Dave Frodin | c877d22 | 2012-02-02 14:50:02 -0700 | [diff] [blame] | 59 | pci_io_write_config16(dev, 0x6e, 0xffff); |
Uwe Hermann | 42b1c43 | 2010-12-09 18:09:14 +0000 | [diff] [blame] | 60 | } |
Uwe Hermann | e89d8a5 | 2010-11-26 22:39:40 +0000 | [diff] [blame] | 61 | |
| 62 | static void bootblock_southbridge_init(void) |
| 63 | { |
| 64 | sb600_enable_rom(); |
| 65 | } |