coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mainboard.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
8 
10  /* INTA# - INTH# */
11  [0x00] = 0x03,0x04,0x05,0x07,0x1F,0x1F,0x1F,0x1F,
12  /* Misc-nil,0,1,2, INT from Serial irq */
13  [0x08] = 0x5A,0xF1,0x00,0x00,0x1F,0x1F,0x1F,0x1F,
14  /* SCI, SMBUS0, ASF, HDA, FC, GEC, PerMon, SD */
15  [0x10] = 0x1F,0x1F,0x1F,0x03,0x1F,0x1F,0x1F,0x1F,
16  /* IMC INT0 - 5 */
17  [0x20] = 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,
18  /* USB Devs 18/19/22 INTA-B */
19  [0x30] = 0x05,0x04,0x05,0x04,0x05,0x04,0x1F,0x1F,
20  /* RSVD, SATA */
21  [0x40] = 0x1F, 0x07
22 };
23 
25  /* INTA# - INTH# */
26  [0x00] = 0x10,0x11,0x12,0x13,0x1F,0x1F,0x1F,0x1F,
27  /* Misc-nil,0,1,2, INT from Serial irq */
28  [0x08] = 0x00,0x00,0x00,0x00,0x1F,0x1F,0x1F,0x1F,
29  /* SCI, SMBUS0, ASF, HDA, FC, GEC, PerMon, SD */
30  [0x10] = 0x09,0x1F,0x1F,0x10,0x1F,0x1F,0x1F,0x1F,
31  /* IMC INT0 - 5 */
32  [0x20] = 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,
33  /* USB Devs 18/19/22 INTA-B */
34  [0x30] = 0x12,0x11,0x12,0x11,0x12,0x11,0x1F,0x1F,
35  /* RSVD, SATA */
36  [0x40] = 0x1F, 0x13
37 };
38 
39 /*
40  * This table defines the index into the picr/intr_data
41  * tables for each device. Any enabled device and slot
42  * that uses hardware interrupts should have an entry
43  * in this table to define its index into the FCH
44  * PCI_INTR register 0xC00/0xC01. This index will define
45  * the interrupt that it should use. Putting PIRQ_A into
46  * the PIN A index for a device will tell that device to
47  * use PIC IRQ 10 if it uses PIN A for its hardware INT.
48  */
49 static const struct pirq_struct mainboard_pirq_data[] = {
50  /* {PCI_devfn, {PIN A, PIN B, PIN C, PIN D}}, */
51  {GFX_DEVFN, {PIRQ_A, PIRQ_NC, PIRQ_NC, PIRQ_NC}}, /* VGA: 01.0 */
52  {ACTL_DEVFN,{PIRQ_NC, PIRQ_B, PIRQ_NC, PIRQ_NC}}, /* Audio: 01.1 */
53  {NB_PCIE_PORT1_DEVFN, {PIRQ_A, PIRQ_B, PIRQ_C, PIRQ_D}}, /* x4 PCIe: 02.1 */
54  {NB_PCIE_PORT5_DEVFN, {PIRQ_B, PIRQ_C, PIRQ_D, PIRQ_A}}, /* Edge: 02.5 */
55  {XHCI_DEVFN, {PIRQ_C, PIRQ_NC, PIRQ_NC, PIRQ_NC}}, /* XHCI: 10.0 */
56  {SATA_DEVFN, {PIRQ_SATA, PIRQ_NC, PIRQ_NC, PIRQ_NC}}, /* SATA: 11.0 */
57  {OHCI1_DEVFN, {PIRQ_OHCI1, PIRQ_NC, PIRQ_NC, PIRQ_NC}}, /* OHCI1: 12.0 */
58  {EHCI1_DEVFN, {PIRQ_NC, PIRQ_EHCI1, PIRQ_NC, PIRQ_NC}}, /* EHCI1: 12.2 */
59  {OHCI2_DEVFN, {PIRQ_OHCI2, PIRQ_NC, PIRQ_NC, PIRQ_NC}}, /* OHCI2: 13.0 */
60  {EHCI2_DEVFN, {PIRQ_NC, PIRQ_EHCI2, PIRQ_NC, PIRQ_NC}}, /* EHCI2: 13.2 */
61  {OHCI3_DEVFN, {PIRQ_OHCI3, PIRQ_NC, PIRQ_NC, PIRQ_NC}}, /* OHCI3: 16.0 */
62  {EHCI3_DEVFN, {PIRQ_NC, PIRQ_EHCI3, PIRQ_NC, PIRQ_NC}}, /* EHCI3: 16.2 */
63  {HDA_DEVFN, {PIRQ_HDA, PIRQ_NC, PIRQ_NC, PIRQ_NC}}, /* HDA: 14.2 */
64 };
65 
66 /* PIRQ Setup */
67 static void pirq_setup(void)
68 {
73 }
74 
75 /**********************************************
76  * enable the dedicated function in mainboard.
77  **********************************************/
78 static void mainboard_enable(struct device *dev)
79 {
80  /* Initialize the PIRQ data structures for consumption */
81  pirq_setup();
82 }
83 
86 };
struct chip_operations mainboard_ops
Definition: mainboard.c:19
@ PIRQ_A
Definition: acpi_pirq_gen.h:22
@ PIRQ_C
Definition: acpi_pirq_gen.h:24
@ PIRQ_D
Definition: acpi_pirq_gen.h:25
@ PIRQ_B
Definition: acpi_pirq_gen.h:23
static const u8 mainboard_picr_data[FCH_INT_TABLE_SIZE]
Definition: mainboard.c:9
static const struct pirq_struct mainboard_pirq_data[]
Definition: mainboard.c:49
static void mainboard_enable(struct device *dev)
Definition: mainboard.c:78
static void pirq_setup(void)
Definition: mainboard.c:67
static const u8 mainboard_intr_data[FCH_INT_TABLE_SIZE]
Definition: mainboard.c:24
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define NB_PCIE_PORT1_DEVFN
Definition: pci_devs.h:33
#define GFX_DEVFN
Definition: pci_devs.h:13
#define NB_PCIE_PORT5_DEVFN
Definition: pci_devs.h:37
#define ACTL_DEVFN
Definition: pci_devs.h:27
#define PIRQ_SATA
#define PIRQ_NC
u32 pirq_data_size
Definition: amd_pci_util.c:12
const u8 * intr_data_ptr
Definition: amd_pci_util.c:13
const u8 * picr_data_ptr
Definition: amd_pci_util.c:14
const struct pirq_struct * pirq_data_ptr
Definition: amd_pci_util.c:11
#define SATA_DEVFN
Definition: pci_devs.h:83
#define PIRQ_HDA
#define EHCI1_DEVFN
Definition: pci_devs.h:170
#define XHCI_DEVFN
Definition: pci_devs.h:153
#define PIRQ_OHCI2
#define PIRQ_OHCI1
#define PIRQ_EHCI3
#define PIRQ_OHCI3
#define PIRQ_EHCI2
#define PIRQ_EHCI1
#define HDA_DEVFN
Definition: pci_devs.h:69
#define OHCI1_DEVFN
Definition: pci_devs.h:34
#define EHCI3_DEVFN
Definition: pci_devs.h:49
#define OHCI3_DEVFN
Definition: pci_devs.h:36
#define EHCI2_DEVFN
Definition: pci_devs.h:48
#define OHCI2_DEVFN
Definition: pci_devs.h:35
#define FCH_INT_TABLE_SIZE
uint8_t u8
Definition: stdint.h:45
void(* enable_dev)(struct device *dev)
Definition: device.h:24
Definition: device.h:107