blob: 12cac29832cd28a304dd5da82653089e143af95e [file] [log] [blame]
Yinghai Luc65bd562007-02-01 00:10:05 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Yinghai Luc65bd562007-02-01 00:10:05 +00003 *
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 Luc65bd562007-02-01 00:10:05 +000018 */
19
20#include <arch/io.h>
Stefan Reinauerf8b19232010-04-07 00:38:09 +000021#include <reset.h>
Yinghai Luc65bd562007-02-01 00:10:05 +000022
23#define PCI_DEV(BUS, DEV, FN) ( \
24 (((BUS) & 0xFFF) << 20) | \
25 (((DEV) & 0x1F) << 15) | \
26 (((FN) & 0x7) << 12))
27
Edward O'Callaghan3ec9c952014-10-26 10:36:02 +110028static void pci_write_config32(pci_devfn_t dev, unsigned where, unsigned value)
Yinghai Luc65bd562007-02-01 00:10:05 +000029{
30 unsigned addr;
31 addr = (dev>>4) | where;
32 outl(0x80000000 | (addr & ~3), 0xCF8);
33 outl(value, 0xCFC);
34}
35
Edward O'Callaghan3ec9c952014-10-26 10:36:02 +110036static unsigned pci_read_config32(pci_devfn_t dev, unsigned where)
Yinghai Luc65bd562007-02-01 00:10:05 +000037{
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
46void 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}