blob: 60909fa9df13c22f132294e1efa6c226169bf112 [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. */
zbao246e84b2012-07-13 18:47:03 +08003
zbao246e84b2012-07-13 18:47:03 +08004#include <device/device.h>
5#include <device/pci.h>
6#include <device/pci_ids.h>
zbao246e84b2012-07-13 18:47:03 +08007#include "hudson.h"
Stefan Reinauer13e41822015-04-27 14:02:36 -07008#include <southbridge/amd/common/amd_pci_util.h>
Dave Frodin2093c4f2014-06-13 08:12:48 -06009#include <bootstate.h>
zbao246e84b2012-07-13 18:47:03 +080010
zbao246e84b2012-07-13 18:47:03 +080011
Dave Frodin2093c4f2014-06-13 08:12:48 -060012/*
13 * Update the PCI devices with a valid IRQ number
14 * that is set in the mainboard PCI_IRQ structures.
15 */
16static void set_pci_irqs(void *unused)
17{
18 /* Write PCI_INTR regs 0xC00/0xC01 */
19 write_pci_int_table();
20
21 /* Write IRQs for all devicetree enabled devices */
22 write_pci_cfg_irqs();
23}
24
25/*
26 * Hook this function into the PCI state machine
27 * on entry into BS_DEV_ENABLE.
28 */
Aaron Durbin9ef9d852015-03-16 17:30:09 -050029BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, set_pci_irqs, NULL);
Dave Frodin2093c4f2014-06-13 08:12:48 -060030
zbao246e84b2012-07-13 18:47:03 +080031static struct pci_operations lops_pci = {
32 .set_subsystem = 0,
33};
34
35static struct device_operations pci_ops = {
36 .read_resources = pci_bus_read_resources,
37 .set_resources = pci_dev_set_resources,
38 .enable_resources = pci_bus_enable_resources,
zbao246e84b2012-07-13 18:47:03 +080039 .scan_bus = pci_scan_bridge,
40 .reset_bus = pci_bus_reset,
41 .ops_pci = &lops_pci,
42};
43
44static const struct pci_driver pci_driver __pci_driver = {
45 .ops = &pci_ops,
46 .vendor = PCI_VENDOR_ID_AMD,
Kyösti Mälkki9d9a5522016-11-19 22:14:59 +020047 .device = PCI_DEVICE_ID_AMD_SB900_PCI,
zbao246e84b2012-07-13 18:47:03 +080048};