Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Tristan Corrick | 44095c1 | 2018-12-22 00:04:18 +1300 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
| 4 | #include <device/device.h> |
Tristan Corrick | 44095c1 | 2018-12-22 00:04:18 +1300 | [diff] [blame] | 5 | #include <option.h> |
Tristan Corrick | 44095c1 | 2018-12-22 00:04:18 +1300 | [diff] [blame] | 6 | #include <types.h> |
| 7 | |
| 8 | /* |
| 9 | * Hiding the AST2400 might be desirable to reduce attack surface. |
| 10 | * |
| 11 | * The PCIe root port that the AST2400 is on is disabled, but the |
| 12 | * AST2400 itself likely remains in an enabled state. |
| 13 | * |
| 14 | * The AST2400 is also attached to the LPC. That interface does not get |
| 15 | * disabled. |
| 16 | */ |
| 17 | static void hide_ast2400(void) |
| 18 | { |
Elyes HAOUAS | d2abe93 | 2019-01-23 14:18:34 +0100 | [diff] [blame] | 19 | struct device *dev = pcidev_on_root(0x1c, 0); |
Tristan Corrick | 44095c1 | 2018-12-22 00:04:18 +1300 | [diff] [blame] | 20 | if (!dev) |
| 21 | return; |
| 22 | |
| 23 | /* |
| 24 | * Marking this device as disabled means that the southbridge code |
| 25 | * will properly disable the root port when it configures it later. |
| 26 | */ |
| 27 | dev->enabled = 0; |
| 28 | printk(BIOS_INFO, "The AST2400 is now set to be hidden.\n"); |
| 29 | } |
| 30 | |
| 31 | static void mainboard_enable(struct device *dev) |
| 32 | { |
Angel Pons | 88dcb31 | 2021-04-26 17:10:28 +0200 | [diff] [blame^] | 33 | if (get_uint_option("hide_ast2400", false)) |
Tristan Corrick | 44095c1 | 2018-12-22 00:04:18 +1300 | [diff] [blame] | 34 | hide_ast2400(); |
| 35 | } |
| 36 | |
| 37 | struct chip_operations mainboard_ops = { |
| 38 | CHIP_NAME("X10SLM+-F") |
| 39 | .enable_dev = mainboard_enable, |
| 40 | }; |