blob: b99413c9c45594a98c1af22e777c54e636399718 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
zbao246e84b2012-07-13 18:47:03 +08002
zbao246e84b2012-07-13 18:47:03 +08003#include <device/device.h>
4#include <device/pci.h>
5#include <device/pci_ids.h>
zbao246e84b2012-07-13 18:47:03 +08006#include "hudson.h"
Stefan Reinauer13e41822015-04-27 14:02:36 -07007#include <southbridge/amd/common/amd_pci_util.h>
Dave Frodin2093c4f2014-06-13 08:12:48 -06008#include <bootstate.h>
zbao246e84b2012-07-13 18:47:03 +08009
Dave Frodin2093c4f2014-06-13 08:12:48 -060010/*
11 * Update the PCI devices with a valid IRQ number
12 * that is set in the mainboard PCI_IRQ structures.
13 */
14static 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 Durbin9ef9d852015-03-16 17:30:09 -050027BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, set_pci_irqs, NULL);
Dave Frodin2093c4f2014-06-13 08:12:48 -060028
zbao246e84b2012-07-13 18:47:03 +080029static struct pci_operations lops_pci = {
30 .set_subsystem = 0,
31};
32
33static 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,
zbao246e84b2012-07-13 18:47:03 +080037 .scan_bus = pci_scan_bridge,
38 .reset_bus = pci_bus_reset,
39 .ops_pci = &lops_pci,
40};
41
42static const struct pci_driver pci_driver __pci_driver = {
43 .ops = &pci_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010044 .vendor = PCI_VID_AMD,
45 .device = PCI_DID_AMD_SB900_PCI,
zbao246e84b2012-07-13 18:47:03 +080046};