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 
4 #include <commonlib/helpers.h>
5 #include <device/device.h>
6 #include <soc/acpi.h>
7 #include <string.h>
8 #include <types.h>
9 
10 /*
11  * These arrays set up the FCH PCI_INTR registers 0xC00/0xC01.
12  * This table is responsible for physically routing the PIC and
13  * IOAPIC IRQs to the different PCI devices on the system. It
14  * is read and written via registers 0xC00/0xC01 as an
15  * Index/Data pair. These values are chipset and mainboard
16  * dependent and should be updated accordingly.
17  */
18 static uint8_t fch_pic_routing[0x80];
20 
22  "PIC and APIC FCH interrupt tables must be the same size");
23 
24 /*
25  * This controls the device -> IRQ routing.
26  *
27  * Hardcoded IRQs:
28  * 0: timer < soc/amd/common/acpi/lpc.asl
29  * 1: i8042 - Keyboard
30  * 2: cascade
31  * 8: rtc0 <- soc/amd/common/acpi/lpc.asl
32  * 9: acpi <- soc/amd/common/acpi/lpc.asl
33  */
34 static const struct fch_irq_routing {
38 } majolica_fch[] = {
39  { PIRQ_A, 12, PIRQ_NC },
40  { PIRQ_B, 14, PIRQ_NC },
41  { PIRQ_C, 15, PIRQ_NC },
42  { PIRQ_D, 12, PIRQ_NC },
43  { PIRQ_E, 14, PIRQ_NC },
44  { PIRQ_F, 15, PIRQ_NC },
45  { PIRQ_G, 12, PIRQ_NC },
46  { PIRQ_H, 14, PIRQ_NC },
47 
49  { PIRQ_SD, PIRQ_NC, PIRQ_NC },
53  { PIRQ_GPIO, 11, 11 },
54  { PIRQ_I2C0, 10, 10 },
55  { PIRQ_I2C1, 7, 7 },
56  { PIRQ_I2C2, 6, 6 },
57  { PIRQ_I2C3, 5, 5 },
58  { PIRQ_UART0, 4, 4 },
59  { PIRQ_UART1, 3, 3 },
60 
61  /* The MISC registers are not interrupt numbers */
62  { PIRQ_MISC, 0xfa, 0x00 },
63  { PIRQ_MISC0, 0x91, 0x00 },
64  { PIRQ_HPET_L, 0x00, 0x00 },
65  { PIRQ_HPET_H, 0x00, 0x00 },
66 };
67 
68 static void init_tables(void)
69 {
70  const struct fch_irq_routing *entry;
71  int i;
72 
75 
76  for (i = 0; i < ARRAY_SIZE(majolica_fch); i++) {
77  entry = majolica_fch + i;
78  fch_pic_routing[entry->intr_index] = entry->pic_irq_num;
79  fch_apic_routing[entry->intr_index] = entry->apic_irq_num;
80  }
81 }
82 
83 static void pirq_setup(void)
84 {
87 }
88 
89 static void mainboard_init(void *chip_info)
90 {
91 }
92 
93 static void mainboard_enable(struct device *dev)
94 {
95  init_tables();
96  /* Initialize the PIRQ data structures for consumption */
97  pirq_setup();
98 }
99 
101  .init = mainboard_init,
102  .enable_dev = mainboard_enable,
103 };
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_G
Definition: acpi_pirq_gen.h:28
@ PIRQ_H
Definition: acpi_pirq_gen.h:29
@ PIRQ_E
Definition: acpi_pirq_gen.h:26
@ PIRQ_D
Definition: acpi_pirq_gen.h:25
@ PIRQ_F
Definition: acpi_pirq_gen.h:27
@ PIRQ_B
Definition: acpi_pirq_gen.h:23
_Static_assert(sizeof(fch_pic_routing)==sizeof(fch_apic_routing), "PIC and APIC FCH interrupt tables must be the same size")
static const struct fch_irq_routing majolica_fch[]
static void mainboard_init(void *chip_info)
Definition: mainboard.c:89
static void init_tables(void)
Definition: mainboard.c:68
static void mainboard_enable(struct device *dev)
Definition: mainboard.c:93
static uint8_t fch_apic_routing[0x80]
Definition: mainboard.c:19
static void pirq_setup(void)
Definition: mainboard.c:83
static uint8_t fch_pic_routing[0x80]
Definition: mainboard.c:18
void * memset(void *dstpp, int c, size_t len)
Definition: memset.c:12
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define ACPI_SCI_IRQ
Definition: acpi.h:11
#define PIRQ_EMMC
#define PIRQ_SATA
#define PIRQ_SDIO
#define PIRQ_I2C0
#define PIRQ_HPET_L
#define PIRQ_MISC0
#define PIRQ_SCI
#define PIRQ_MISC
#define PIRQ_SD
#define PIRQ_NC
#define PIRQ_UART0
#define PIRQ_HPET_H
#define PIRQ_I2C3
#define PIRQ_I2C2
#define PIRQ_UART1
#define PIRQ_I2C1
#define PIRQ_GPIO
const u8 * intr_data_ptr
Definition: amd_pci_util.c:13
const u8 * picr_data_ptr
Definition: amd_pci_util.c:14
unsigned char uint8_t
Definition: stdint.h:8
void(* init)(void *chip_info)
Definition: device.h:25
Definition: device.h:107
uint8_t pic_irq_num
Definition: mainboard.c:38
uint8_t apic_irq_num
Definition: mainboard.c:39
uint8_t intr_index
Definition: mainboard.c:37