blob: 8c2a2ed58f11ceef7b92693d02c408d3ba890e50 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Kerry Sheha3f06072012-02-07 20:32:38 +08003
Kyösti Mälkkief844012013-06-25 23:17:43 +03004// Use simple device model for this file even in ramstage
5#define __SIMPLE_DEVICE__
6
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02007#include <device/pci_ops.h>
Nico Huber3e1b3b12018-10-07 12:45:47 +02008#include <cf9_reset.h>
Kerry Sheha3f06072012-02-07 20:32:38 +08009#include <reset.h>
Kerry Sheha3f06072012-02-07 20:32:38 +080010
11#define HT_INIT_CONTROL 0x6C
12#define HTIC_BIOSR_Detect (1<<5)
13
Kyösti Mälkki3d3152e2019-01-10 09:05:30 +020014#define DEV_CDB 0x18
15#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 +080016
Nico Huber3e1b3b12018-10-07 12:45:47 +020017void cf9_reset_prepare(void)
Kerry Sheha3f06072012-02-07 20:32:38 +080018{
19 u32 nodes;
20 u32 htic;
Kyösti Mälkki3f9a62e2013-06-20 20:25:21 +030021 pci_devfn_t dev;
Kerry Sheha3f06072012-02-07 20:32:38 +080022 int i;
23
Kyösti Mälkki3d3152e2019-01-10 09:05:30 +020024 nodes = ((pci_read_config32(PCI_DEV(0, DEV_CDB, 0), 0x60) >> 4) & 7) + 1;
Elyes HAOUASba28e8d2016-08-31 19:22:16 +020025 for (i = 0; i < nodes; i++) {
Kerry Sheha3f06072012-02-07 20:32:38 +080026 dev = NODE_PCI(i, 0);
27 htic = pci_read_config32(dev, HT_INIT_CONTROL);
28 htic &= ~HTIC_BIOSR_Detect;
29 pci_write_config32(dev, HT_INIT_CONTROL, htic);
30 }
31}
32
Nico Huber3e1b3b12018-10-07 12:45:47 +020033void do_board_reset(void)
Kerry Sheha3f06072012-02-07 20:32:38 +080034{
Nico Huber3e1b3b12018-10-07 12:45:47 +020035 system_reset();
Kerry Sheha3f06072012-02-07 20:32:38 +080036}