blob: 4b96d3c8c0a2abd06b8762efea0aea298f0f8d55 [file] [log] [blame]
Kerry Sheha3f06072012-02-07 20:32:38 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 - 2012 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.
Kerry Sheha3f06072012-02-07 20:32:38 +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
Stefan Reinauer24d1d4b2013-03-21 11:51:41 -070019#include <arch/io.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020020#include <device/pci_ops.h>
Nico Huber3e1b3b12018-10-07 12:45:47 +020021#include <cf9_reset.h>
Kerry Sheha3f06072012-02-07 20:32:38 +080022#include <reset.h>
Kerry Sheha3f06072012-02-07 20:32:38 +080023
24#define HT_INIT_CONTROL 0x6C
25#define HTIC_BIOSR_Detect (1<<5)
26
Kyösti Mälkki3d3152e2019-01-10 09:05:30 +020027#define DEV_CDB 0x18
28#define NODE_PCI(x, fn) (((DEV_CDB+x)<32)?(PCI_DEV(0,(DEV_CDB+x),fn)):(PCI_DEV((0-1),(DEV_CDB+x-32),fn)))
Kerry Sheha3f06072012-02-07 20:32:38 +080029
Nico Huber3e1b3b12018-10-07 12:45:47 +020030void cf9_reset_prepare(void)
Kerry Sheha3f06072012-02-07 20:32:38 +080031{
32 u32 nodes;
33 u32 htic;
Kyösti Mälkki3f9a62e2013-06-20 20:25:21 +030034 pci_devfn_t dev;
Kerry Sheha3f06072012-02-07 20:32:38 +080035 int i;
36
Kyösti Mälkki3d3152e2019-01-10 09:05:30 +020037 nodes = ((pci_read_config32(PCI_DEV(0, DEV_CDB, 0), 0x60) >> 4) & 7) + 1;
Elyes HAOUASba28e8d2016-08-31 19:22:16 +020038 for (i = 0; i < nodes; i++) {
Kerry Sheha3f06072012-02-07 20:32:38 +080039 dev = NODE_PCI(i, 0);
40 htic = pci_read_config32(dev, HT_INIT_CONTROL);
41 htic &= ~HTIC_BIOSR_Detect;
42 pci_write_config32(dev, HT_INIT_CONTROL, htic);
43 }
44}
45
Nico Huber3e1b3b12018-10-07 12:45:47 +020046void do_board_reset(void)
Kerry Sheha3f06072012-02-07 20:32:38 +080047{
Nico Huber3e1b3b12018-10-07 12:45:47 +020048 system_reset();
Kerry Sheha3f06072012-02-07 20:32:38 +080049}