coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
amd_pci_util.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef AMD_BLOCK_PCI_UTIL_H
4 #define AMD_BLOCK_PCI_UTIL_H
5 
6 #include <types.h>
7 #include <soc/amd_pci_int_defs.h>
8 #include <device/device.h>
9 
10 /* FCH index/data registers */
11 #define PCI_INTR_INDEX 0xc00
12 #define PCI_INTR_DATA 0xc01
13 
14 struct pirq_struct {
16  u8 PIN[4]; /* PINA/B/C/D are index 0/1/2/3 */
17 };
18 
19 struct irq_idx_name {
21  const char *const name;
22 };
23 
24 extern const struct pirq_struct *pirq_data_ptr;
25 extern u32 pirq_data_size;
26 extern const u8 *intr_data_ptr;
27 extern const u8 *picr_data_ptr;
28 
29 u8 read_pci_int_idx(u8 index, int mode);
30 void write_pci_int_idx(u8 index, int mode, u8 data);
31 void write_pci_cfg_irqs(void);
32 void write_pci_int_table(void);
33 const struct irq_idx_name *sb_get_apic_reg_association(size_t *size);
34 
40 };
41 
42 /**
43  * Each PCI bridge has its INTx lines routed to one of the GNB IO-APIC PCI
44  * groups. Each group has 4 interrupts. The INTx lines can be swizzled before
45  * being routed to the IO-APIC. If the IO-APIC redirection entry is masked, the
46  * interrupt is reduced modulo 8 onto INT[A-H] and forwarded to the FCH IO-APIC.
47  **/
54 
55 void populate_pirq_data(void);
56 
57 /* Implemented by the SoC */
58 const struct pci_routing_info *get_pci_routing_table(size_t *entries);
59 
60 const struct pci_routing_info *get_pci_routing_info(unsigned int devfn);
61 
62 unsigned int pci_calculate_irq(const struct pci_routing_info *routing_info, unsigned int pin);
63 
64 void acpigen_write_pci_GNB_PRT(const struct device *dev);
65 void acpigen_write_pci_FCH_PRT(const struct device *dev);
66 
67 #endif /* AMD_BLOCK_PCI_UTIL_H */
const struct irq_idx_name * sb_get_apic_reg_association(size_t *size)
Definition: fch.c:75
u32 pirq_data_size
Definition: amd_pci_util.c:12
void acpigen_write_pci_GNB_PRT(const struct device *dev)
Definition: acpi_prt.c:128
void write_pci_int_idx(u8 index, int mode, u8 data)
Definition: amd_pci_util.c:30
void write_pci_cfg_irqs(void)
Definition: amd_pci_util.c:84
void write_pci_int_table(void)
Definition: amd_pci_util.c:41
void populate_pirq_data(void)
const u8 * intr_data_ptr
Definition: amd_pci_util.c:13
const u8 * picr_data_ptr
Definition: amd_pci_util.c:14
unsigned int pci_calculate_irq(const struct pci_routing_info *routing_info, unsigned int pin)
u8 read_pci_int_idx(u8 index, int mode)
Definition: amd_pci_util.c:20
const struct pci_routing_info * get_pci_routing_info(unsigned int devfn)
const struct pirq_struct * pirq_data_ptr
Definition: amd_pci_util.c:11
void acpigen_write_pci_FCH_PRT(const struct device *dev)
Definition: acpi_prt.c:195
pci_routing_swizzle
Definition: amd_pci_util.h:35
@ PCI_SWIZZLE_DABC
Definition: amd_pci_util.h:39
@ PCI_SWIZZLE_BCDA
Definition: amd_pci_util.h:37
@ PCI_SWIZZLE_ABCD
Definition: amd_pci_util.h:36
@ PCI_SWIZZLE_CDAB
Definition: amd_pci_util.h:38
struct pci_routing_info __packed
const struct pci_routing_info * get_pci_routing_table(size_t *entries)
uint32_t u32
Definition: stdint.h:51
uint8_t u8
Definition: stdint.h:45
unsigned char uint8_t
Definition: stdint.h:8
Definition: device.h:107
const char *const name
Definition: amd_pci_util.h:21
uint8_t index
Definition: amd_pci_util.h:20
Each PCI bridge has its INTx lines routed to one of the GNB IO-APIC PCI groups.
Definition: amd_pci_util.h:48