Tristan Corrick | 44095c1 | 2018-12-22 00:04:18 +1300 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2018 Tristan Corrick <tristan@corrick.kiwi> |
| 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, either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | |
| 17 | #include <console/console.h> |
| 18 | #include <device/device.h> |
| 19 | #include <device/pci_def.h> |
| 20 | #include <option.h> |
| 21 | #include <stdint.h> |
| 22 | #include <types.h> |
| 23 | |
| 24 | /* |
| 25 | * Hiding the AST2400 might be desirable to reduce attack surface. |
| 26 | * |
| 27 | * The PCIe root port that the AST2400 is on is disabled, but the |
| 28 | * AST2400 itself likely remains in an enabled state. |
| 29 | * |
| 30 | * The AST2400 is also attached to the LPC. That interface does not get |
| 31 | * disabled. |
| 32 | */ |
| 33 | static void hide_ast2400(void) |
| 34 | { |
| 35 | struct device *dev = dev_find_slot(0, PCI_DEVFN(0x1c, 0)); |
| 36 | if (!dev) |
| 37 | return; |
| 38 | |
| 39 | /* |
| 40 | * Marking this device as disabled means that the southbridge code |
| 41 | * will properly disable the root port when it configures it later. |
| 42 | */ |
| 43 | dev->enabled = 0; |
| 44 | printk(BIOS_INFO, "The AST2400 is now set to be hidden.\n"); |
| 45 | } |
| 46 | |
| 47 | static void mainboard_enable(struct device *dev) |
| 48 | { |
| 49 | u8 hide = 0; |
| 50 | |
| 51 | if (get_option(&hide, "hide_ast2400") == CB_SUCCESS && hide) |
| 52 | hide_ast2400(); |
| 53 | } |
| 54 | |
| 55 | struct chip_operations mainboard_ops = { |
| 56 | CHIP_NAME("X10SLM+-F") |
| 57 | .enable_dev = mainboard_enable, |
| 58 | }; |