blob: eec0180676d7ea12ab70741828a9f0c324d6ca65 [file] [log] [blame]
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03001/*
2 * This file is part of the coreboot project.
3 *
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030013 */
14
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030015#include <device/device.h>
16#include <device/pci.h>
17#include <device/pci_ids.h>
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030018#include "hudson.h"
Stefan Reinauer13e41822015-04-27 14:02:36 -070019#include <southbridge/amd/common/amd_pci_util.h>
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030020#include <bootstate.h>
21
22static void pci_init(struct device *dev)
23{
24}
25
26/*
27 * Update the PCI devices with a valid IRQ number
28 * that is set in the mainboard PCI_IRQ structures.
29 */
30static void set_pci_irqs(void *unused)
31{
32 /* Write PCI_INTR regs 0xC00/0xC01 */
33 write_pci_int_table();
34
35 /* Write IRQs for all devicetree enabled devices */
36 write_pci_cfg_irqs();
37}
38
39/*
40 * Hook this function into the PCI state machine
41 * on entry into BS_DEV_ENABLE.
42 */
Aaron Durbin9ef9d852015-03-16 17:30:09 -050043BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, set_pci_irqs, NULL);
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030044
45static struct pci_operations lops_pci = {
46 .set_subsystem = 0,
47};
48
49static struct device_operations pci_ops = {
50 .read_resources = pci_bus_read_resources,
51 .set_resources = pci_dev_set_resources,
52 .enable_resources = pci_bus_enable_resources,
53 .init = pci_init,
54 .scan_bus = pci_scan_bridge,
55 .reset_bus = pci_bus_reset,
56 .ops_pci = &lops_pci,
57};
58
59static const struct pci_driver pci_driver __pci_driver = {
60 .ops = &pci_ops,
61 .vendor = PCI_VENDOR_ID_AMD,
Kyösti Mälkki9d9a5522016-11-19 22:14:59 +020062 .device = PCI_DEVICE_ID_AMD_SB900_PCI,
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030063};