blob: 004ad585b48f0c811f85756ba835a8c6ea2bbf61 [file] [log] [blame]
arch import user (historical)98d0d302005-07-06 17:13:46 +00001/*
Uwe Hermann8af6d552010-10-17 19:13:18 +00002 * 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)98d0d302005-07-06 17:13:46 +000015 */
16
17#include <arch/io.h>
Stefan Reinauerde3206a2010-02-22 06:09:43 +000018#include <reset.h>
arch import user (historical)98d0d302005-07-06 17:13:46 +000019
20#define PCI_DEV(BUS, DEV, FN) ( \
Myles Watson64caf362008-09-18 16:27:00 +000021 (((BUS) & 0xFFF) << 20) | \
22 (((DEV) & 0x1F) << 15) | \
23 (((FN) & 0x7) << 12))
arch import user (historical)98d0d302005-07-06 17:13:46 +000024
Edward O'Callaghan3ec9c952014-10-26 10:36:02 +110025static void pci_write_config32(pci_devfn_t dev, unsigned where, unsigned value)
arch import user (historical)98d0d302005-07-06 17:13:46 +000026{
Myles Watson64caf362008-09-18 16:27:00 +000027 unsigned addr;
Uwe Hermann7f3d48c2008-10-02 18:19:17 +000028 addr = (dev >> 4) | where;
Myles Watson64caf362008-09-18 16:27:00 +000029 outl(0x80000000 | (addr & ~3), 0xCF8);
30 outl(value, 0xCFC);
arch import user (historical)98d0d302005-07-06 17:13:46 +000031}
32
Edward O'Callaghan3ec9c952014-10-26 10:36:02 +110033static unsigned pci_read_config32(pci_devfn_t dev, unsigned where)
arch import user (historical)98d0d302005-07-06 17:13:46 +000034{
Myles Watson64caf362008-09-18 16:27:00 +000035 unsigned addr;
Uwe Hermann7f3d48c2008-10-02 18:19:17 +000036 addr = (dev >> 4) | where;
Myles Watson64caf362008-09-18 16:27:00 +000037 outl(0x80000000 | (addr & ~3), 0xCF8);
38 return inl(0xCFC);
arch import user (historical)98d0d302005-07-06 17:13:46 +000039}
40
41#include "../../../northbridge/amd/amdk8/reset_test.c"
42
43void hard_reset(void)
44{
45 set_bios_reset();
Uwe Hermann7f3d48c2008-10-02 18:19:17 +000046 /* 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)98d0d302005-07-06 17:13:46 +000049}