Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 2 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <device/pci.h> |
| 5 | #include <device/pci_ids.h> |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 6 | #include "hudson.h" |
Stefan Reinauer | 13e4182 | 2015-04-27 14:02:36 -0700 | [diff] [blame] | 7 | #include <southbridge/amd/common/amd_pci_util.h> |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 8 | #include <bootstate.h> |
| 9 | |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 10 | /* |
| 11 | * Update the PCI devices with a valid IRQ number |
| 12 | * that is set in the mainboard PCI_IRQ structures. |
| 13 | */ |
| 14 | static void set_pci_irqs(void *unused) |
| 15 | { |
| 16 | /* Write PCI_INTR regs 0xC00/0xC01 */ |
| 17 | write_pci_int_table(); |
| 18 | |
| 19 | /* Write IRQs for all devicetree enabled devices */ |
| 20 | write_pci_cfg_irqs(); |
| 21 | } |
| 22 | |
| 23 | /* |
| 24 | * Hook this function into the PCI state machine |
| 25 | * on entry into BS_DEV_ENABLE. |
| 26 | */ |
Aaron Durbin | 9ef9d85 | 2015-03-16 17:30:09 -0500 | [diff] [blame] | 27 | BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, set_pci_irqs, NULL); |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 28 | |
| 29 | static struct pci_operations lops_pci = { |
| 30 | .set_subsystem = 0, |
| 31 | }; |
| 32 | |
| 33 | static struct device_operations pci_ops = { |
| 34 | .read_resources = pci_bus_read_resources, |
| 35 | .set_resources = pci_dev_set_resources, |
| 36 | .enable_resources = pci_bus_enable_resources, |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 37 | .scan_bus = pci_scan_bridge, |
| 38 | .reset_bus = pci_bus_reset, |
| 39 | .ops_pci = &lops_pci, |
| 40 | }; |
| 41 | |
| 42 | static const struct pci_driver pci_driver __pci_driver = { |
| 43 | .ops = &pci_ops, |
Felix Singer | 43b7f41 | 2022-03-07 04:34:52 +0100 | [diff] [blame] | 44 | .vendor = PCI_VID_AMD, |
| 45 | .device = PCI_DID_AMD_SB900_PCI, |
Kyösti Mälkki | e8b4da2 | 2014-10-21 18:22:32 +0300 | [diff] [blame] | 46 | }; |