Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 3 | |
Kyösti Mälkki | ef84401 | 2013-06-25 23:17:43 +0300 | [diff] [blame] | 4 | // Use simple device model for this file even in ramstage |
| 5 | #define __SIMPLE_DEVICE__ |
| 6 | |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 7 | #include <device/pci_ops.h> |
Nico Huber | 3e1b3b1 | 2018-10-07 12:45:47 +0200 | [diff] [blame] | 8 | #include <cf9_reset.h> |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 9 | #include <reset.h> |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 10 | |
| 11 | #define HT_INIT_CONTROL 0x6C |
| 12 | #define HTIC_BIOSR_Detect (1<<5) |
| 13 | |
Kyösti Mälkki | 3d3152e | 2019-01-10 09:05:30 +0200 | [diff] [blame] | 14 | #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 Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 16 | |
Nico Huber | 3e1b3b1 | 2018-10-07 12:45:47 +0200 | [diff] [blame] | 17 | void cf9_reset_prepare(void) |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 18 | { |
| 19 | u32 nodes; |
| 20 | u32 htic; |
Kyösti Mälkki | 3f9a62e | 2013-06-20 20:25:21 +0300 | [diff] [blame] | 21 | pci_devfn_t dev; |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 22 | int i; |
| 23 | |
Kyösti Mälkki | 3d3152e | 2019-01-10 09:05:30 +0200 | [diff] [blame] | 24 | nodes = ((pci_read_config32(PCI_DEV(0, DEV_CDB, 0), 0x60) >> 4) & 7) + 1; |
Elyes HAOUAS | ba28e8d | 2016-08-31 19:22:16 +0200 | [diff] [blame] | 25 | for (i = 0; i < nodes; i++) { |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 26 | 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 Huber | 3e1b3b1 | 2018-10-07 12:45:47 +0200 | [diff] [blame] | 33 | void do_board_reset(void) |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 34 | { |
Nico Huber | 3e1b3b1 | 2018-10-07 12:45:47 +0200 | [diff] [blame] | 35 | system_reset(); |
Kerry Sheh | a3f0607 | 2012-02-07 20:32:38 +0800 | [diff] [blame] | 36 | } |