blob: 315456dbd6fc5f0bd8c935249f8d76e43cabaddd [file] [log] [blame]
zbao246e84b2012-07-13 18:47:03 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Advanced Micro Devices, Inc.
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
8 * the Free Software Foundation; version 2 of the License.
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.
zbao246e84b2012-07-13 18:47:03 +080014 */
15
Kyösti Mälkkief844012013-06-25 23:17:43 +030016// Use simple device model for this file even in ramstage
17#define __SIMPLE_DEVICE__
18
zbao246e84b2012-07-13 18:47:03 +080019#include <arch/io.h>
Stefan Reinauer24d1d4b2013-03-21 11:51:41 -070020#include <reset.h>
zbao246e84b2012-07-13 18:47:03 +080021
Kyösti Mälkki8251fa02018-05-30 06:51:28 +030022#define HT_INIT_CONTROL 0x6c
23#define HTIC_ColdR_Detect (1<<4)
24#define HTIC_BIOSR_Detect (1<<5)
25#define HTIC_INIT_Detect (1<<6)
26
27static void set_bios_reset(void)
28{
29 u32 htic;
30 htic = pci_io_read_config32(PCI_DEV(0, 0x18, 0), HT_INIT_CONTROL);
31 htic &= ~HTIC_BIOSR_Detect;
32 pci_io_write_config32(PCI_DEV(0, 0x18, 0), HT_INIT_CONTROL, htic);
33}
zbao246e84b2012-07-13 18:47:03 +080034
Julius Werner01f9aa52017-05-18 16:03:26 -070035void do_hard_reset(void)
zbao246e84b2012-07-13 18:47:03 +080036{
37 set_bios_reset();
38 /* Try rebooting through port 0xcf9 */
39 /* Actually it is not a real hard_reset --- it only reset coherent link table, but not reset link freq and width */
40 outb((0 << 3) | (0 << 2) | (1 << 1), 0xcf9);
41 outb((0 << 3) | (1 << 2) | (1 << 1), 0xcf9);
42}