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 #include "gpio.h"
10 
11 /*
12  * These arrays set up the FCH PCI_INTR registers 0xC00/0xC01.
13  * This table is responsible for physically routing the PIC and
14  * IOAPIC IRQs to the different PCI devices on the system. It
15  * is read and written via registers 0xC00/0xC01 as an
16  * Index/Data pair. These values are chipset and mainboard
17  * dependent and should be updated accordingly.
18  */
19 static uint8_t fch_pic_routing[0x80];
21 
23  "PIC and APIC FCH interrupt tables must be the same size");
24 
25 /*
26  * This controls the device -> IRQ routing.
27  *
28  * Hardcoded IRQs:
29  * 0: timer < soc/amd/common/acpi/lpc.asl
30  * 1: i8042 - Keyboard
31  * 2: cascade
32  * 8: rtc0 <- soc/amd/common/acpi/lpc.asl
33  * 9: acpi <- soc/amd/common/acpi/lpc.asl
34  */
35 static const struct fch_irq_routing {
39 } chausie_fch[] = {
40  { PIRQ_A, 12, PIRQ_NC },
41  { PIRQ_B, 14, PIRQ_NC },
42  { PIRQ_C, 15, PIRQ_NC },
43  { PIRQ_D, 12, PIRQ_NC },
44  { PIRQ_E, 14, PIRQ_NC },
45  { PIRQ_F, 15, PIRQ_NC },
46  { PIRQ_G, 12, PIRQ_NC },
47  { PIRQ_H, 14, PIRQ_NC },
48 
50  { 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(chausie_fch); i++) {
77  entry = chausie_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 {
92 }
93 
94 static void mainboard_enable(struct device *dev)
95 {
96  init_tables();
97  /* Initialize the PIRQ data structures for consumption */
98  pirq_setup();
99 }
100 
102  .init = mainboard_init,
103  .enable_dev = mainboard_enable,
104 };
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 chausie_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:94
static uint8_t fch_apic_routing[0x80]
Definition: mainboard.c:20
static void pirq_setup(void)
Definition: mainboard.c:83
static uint8_t fch_pic_routing[0x80]
Definition: mainboard.c:19
void * memset(void *dstpp, int c, size_t len)
Definition: memset.c:12
#define ARRAY_SIZE(a)
Definition: helpers.h:12
void mainboard_program_gpios(void)
Definition: gpio.c:24
#define ACPI_SCI_IRQ
Definition: acpi.h:11
#define PIRQ_EMMC
#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