Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2004 Tyan Computer |
| 5 | * Written by Yinghai Lu <yhlu@tyan.com> for Tyan Computer. |
| 6 | * Copyright (C) 2006,2007 AMD |
| 7 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #include <arch/io.h> |
Stefan Reinauer | f8b1923 | 2010-04-07 00:38:09 +0000 | [diff] [blame] | 21 | #include <reset.h> |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 22 | |
| 23 | #define PCI_DEV(BUS, DEV, FN) ( \ |
| 24 | (((BUS) & 0xFFF) << 20) | \ |
| 25 | (((DEV) & 0x1F) << 15) | \ |
| 26 | (((FN) & 0x7) << 12)) |
| 27 | |
Edward O'Callaghan | 3ec9c95 | 2014-10-26 10:36:02 +1100 | [diff] [blame] | 28 | static void pci_write_config32(pci_devfn_t dev, unsigned where, unsigned value) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 29 | { |
| 30 | unsigned addr; |
| 31 | addr = (dev>>4) | where; |
| 32 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 33 | outl(value, 0xCFC); |
| 34 | } |
| 35 | |
Edward O'Callaghan | 3ec9c95 | 2014-10-26 10:36:02 +1100 | [diff] [blame] | 36 | static unsigned pci_read_config32(pci_devfn_t dev, unsigned where) |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 37 | { |
| 38 | unsigned addr; |
| 39 | addr = (dev>>4) | where; |
| 40 | outl(0x80000000 | (addr & ~3), 0xCF8); |
| 41 | return inl(0xCFC); |
| 42 | } |
| 43 | |
| 44 | #include "../../../northbridge/amd/amdk8/reset_test.c" |
| 45 | |
| 46 | void hard_reset(void) |
| 47 | { |
| 48 | set_bios_reset(); |
| 49 | /* Try rebooting through port 0xcf9 */ |
| 50 | /* Actually it is not a real hard_reset --- it only reset coherent link table, but not reset link freq and width */ |
| 51 | outb((0 <<3)|(0<<2)|(1<<1), 0xcf9); |
| 52 | outb((0 <<3)|(1<<2)|(1<<1), 0xcf9); |
| 53 | } |