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>
6 #include <soc/gpio.h>
7 #include <soc/pci_devs.h>
8 #include <soc/southbridge.h>
9 
10 #include "gpio.h"
11 
12 /***********************************************************
13  * These arrays set up the FCH PCI_INTR registers 0xC00/0xC01.
14  * This table is responsible for physically routing the PIC and
15  * IOAPIC IRQs to the different PCI devices on the system. It
16  * is read and written via registers 0xC00/0xC01 as an
17  * Index/Data pair. These values are chipset and mainboard
18  * dependent and should be updated accordingly.
19  *
20  * These values are used by the PCI configuration space,
21  * MP Tables.
22  */
23 static const u8 mainboard_picr_data[] = {
24  [0x00] = 0x03, 0x04, 0x05, 0x07, 0x0B, 0x0A, 0x1F, 0x1F,
25  [0x08] = 0xFA, 0xF1, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F,
26  [0x10] = 0x1F, 0x1F, 0x1F, 0x03, 0x1F, 0x1F, 0x1F, 0x1F,
27  [0x18] = 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28  [0x20] = 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00,
29  [0x28] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30  [0x30] = 0x05, 0x04, 0x05, 0x04, 0x04, 0x05, 0x04, 0x05,
31  [0x38] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32  [0x40] = 0x04, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33  [0x48] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34  [0x50] = 0x03, 0x04, 0x05, 0x07, 0x1F, 0x1F, 0x1F, 0x1F,
35  [0x58] = 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
36  [0x60] = 0x1F, 0x1F, 0x07, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
37  [0x68] = 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
38  [0x70] = 0x03, 0x0F, 0x06, 0x0E, 0x0A, 0x0B, 0x1F, 0x1F,
39  [0x78] = 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
40 };
41 
42 static const u8 mainboard_intr_data[] = {
43  [0x00] = 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
44  [0x08] = 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F,
45  [0x10] = 0x09, 0x1F, 0x1F, 0x10, 0x1F, 0x1F, 0x1F, 0x10,
46  [0x18] = 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00,
47  [0x20] = 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00,
48  [0x28] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49  [0x30] = 0x12, 0x11, 0x12, 0x11, 0x12, 0x11, 0x12, 0x00,
50  [0x38] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51  [0x40] = 0x11, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52  [0x48] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53  [0x50] = 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00,
54  [0x58] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55  [0x60] = 0x1F, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
56  [0x68] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57  [0x70] = 0x03, 0x0F, 0x06, 0x0E, 0x0A, 0x0B, 0x1F, 0x1F,
58  [0x78] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 };
60 
61 /*
62  * This table defines the index into the picr/intr_data tables for each
63  * device. Any enabled device and slot that uses hardware interrupts should
64  * have an entry in this table to define its index into the FCH PCI_INTR
65  * register 0xC00/0xC01. This index will define the interrupt that it should
66  * use. Putting PIRQ_A into the PIN A index for a device will tell that
67  * device to use PIC IRQ 10 if it uses PIN A for its hardware INT.
68  */
69 static const struct pirq_struct mainboard_pirq_data[] = {
84 };
85 
86 /* PIRQ Setup */
87 static void pirq_setup(void)
88 {
93 }
94 
95 static void mainboard_init(void *chip_info)
96 {
97  size_t num_gpios;
98  const struct soc_amd_gpio *gpios;
99  gpios = gpio_table(&num_gpios);
100  gpio_configure_pads(gpios, num_gpios);
101 }
102 
103 /*************************************************
104  * enable the dedicated function in padmelon board.
105  *************************************************/
106 static void mainboard_enable(struct device *dev)
107 {
108  /* Initialize the PIRQ data structures for consumption */
109  pirq_setup();
110 }
111 
113  .init = mainboard_init,
114  .enable_dev = mainboard_enable,
115 };
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 void mainboard_init(void *chip_info)
Definition: mainboard.c:95
static const struct pirq_struct mainboard_pirq_data[]
Definition: mainboard.c:69
static const u8 mainboard_intr_data[]
Definition: mainboard.c:42
static const u8 mainboard_picr_data[]
Definition: mainboard.c:23
static void mainboard_enable(struct device *dev)
Definition: mainboard.c:106
static void pirq_setup(void)
Definition: mainboard.c:87
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define SD_DEVFN
Definition: variants.h:11
static const struct pad_config gpio_table[]
Definition: gpio.h:24
#define GFX_DEVFN
Definition: pci_devs.h:13
#define PIRQ_SATA
#define PIRQ_SMBUS
#define PIRQ_SD
#define PIRQ_NC
#define SMBUS_DEVFN
Definition: pci_devs.h:117
void gpio_configure_pads(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
program a particular set of GPIO
Definition: gpio.c:307
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_XHCI
#define PIRQ_EHCI
#define PIRQ_HDA
#define EHCI1_DEVFN
Definition: pci_devs.h:170
#define PCIE3_DEVFN
Definition: pci_devs.h:69
#define PCIE4_DEVFN
Definition: pci_devs.h:75
#define PCIE2_DEVFN
Definition: pci_devs.h:63
#define PCIE1_DEVFN
Definition: pci_devs.h:57
#define PSP_DEVFN
Definition: pci_devs.h:81
#define PCIE0_DEVFN
Definition: pci_devs.h:51
#define HDA1_DEVFN
Definition: pci_devs.h:87
#define XHCI_DEVFN
Definition: pci_devs.h:153
#define HDA0_DEVFN
Definition: pci_devs.h:39
uint8_t u8
Definition: stdint.h:45
void(* init)(void *chip_info)
Definition: device.h:25
Definition: device.h:107