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