blob: 9fcfa2c0d10b5ebe4b2dae5259072cf341e9d572 [file] [log] [blame]
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +03001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Advanced Micro Devices, Inc.
5 * Copyright (C) 2014 Sage Electronic Engineering, LLC.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
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.
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030015 */
16
17#include <console/console.h>
18#include <device/device.h>
19#include <device/pci.h>
20#include <device/pci_ids.h>
21#include <device/pci_ops.h>
22#include "hudson.h"
Stefan Reinauer13e41822015-04-27 14:02:36 -070023#include <southbridge/amd/common/amd_pci_util.h>
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030024#include <bootstate.h>
25
26static void pci_init(struct device *dev)
27{
28}
29
30/*
31 * Update the PCI devices with a valid IRQ number
32 * that is set in the mainboard PCI_IRQ structures.
33 */
34static void set_pci_irqs(void *unused)
35{
36 /* Write PCI_INTR regs 0xC00/0xC01 */
37 write_pci_int_table();
38
39 /* Write IRQs for all devicetree enabled devices */
40 write_pci_cfg_irqs();
41}
42
43/*
44 * Hook this function into the PCI state machine
45 * on entry into BS_DEV_ENABLE.
46 */
Aaron Durbin9ef9d852015-03-16 17:30:09 -050047BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, set_pci_irqs, NULL);
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030048
49static struct pci_operations lops_pci = {
50 .set_subsystem = 0,
51};
52
53static struct device_operations pci_ops = {
54 .read_resources = pci_bus_read_resources,
55 .set_resources = pci_dev_set_resources,
56 .enable_resources = pci_bus_enable_resources,
57 .init = pci_init,
58 .scan_bus = pci_scan_bridge,
59 .reset_bus = pci_bus_reset,
60 .ops_pci = &lops_pci,
61};
62
63static const struct pci_driver pci_driver __pci_driver = {
64 .ops = &pci_ops,
65 .vendor = PCI_VENDOR_ID_AMD,
Kyösti Mälkki9d9a5522016-11-19 22:14:59 +020066 .device = PCI_DEVICE_ID_AMD_SB900_PCI,
Kyösti Mälkkie8b4da22014-10-21 18:22:32 +030067};