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 <amdblocks/acpimmio.h>
5 #include <device/device.h>
7 
8 static const u8 mainboard_intr_data[] = {
9  [0x00] = 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* INTA# - INTH# */
10  [0x08] = 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, /* Misc-nil, 0, 1, 2, INT from Serial irq */
11  [0x10] = 0x09, 0x1F, 0x1F, 0x10, 0x1F, 0x12, 0x1F, 0x00,
12  [0x18] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13  [0x20] = 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00,
14  [0x28] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15  [0x30] = 0x12, 0x11, 0x12, 0x11, 0x12, 0x11, 0x12, 0x00,
16  [0x38] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17  [0x40] = 0x11, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18  [0x48] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19  [0x50] = 0x10, 0x11, 0x12, 0x13
20 };
21 
22 static void init_gpios(void)
23 {
24  /**
25  * GPIO32 Pcie Device DeAssert for APU
26  * GPIO25 Pcie LAN, APU GPP2
27  * GPIO02 MINIPCIE SLOT1, APU GPP3
28  * GPIO50 Pcie Device DeAssert for Hudson Southbridge
29  * GPIO05 Express Card, SB GPP0
30  * GPIO26 NEC USB3.0GPPUSB, SB GPP1
31  * GPIO00 MINIPCIE SLOT2, SB GPP2
32  * GPIO05 Pcie X1 Slot, SB GPP3
33  */
34 
35  /* Multi-function pins switch to GPIO0-35, these pins are shared with
36  * PCI pins, make sure Hudson PCI device is disabled.
37  */
38  pm_write8(0xea, (pm_read8(0xea) & 0xfe) | 1);
39 
40  /* select IOMux to function1/2, corresponds to GPIO */
41  iomux_write8(0x32, (iomux_read8(0x32) & 0xfc) | 1);
42  iomux_write8(0x50, (iomux_read8(0x50) & 0xfc) | 2);
43 
44  /* output low */
45  gpio_100_write8(0x20, 0x48);
46  gpio_100_write8(0x32, 0x48);
47 }
48 
49 /* PIRQ Setup */
50 static void pirq_setup(void)
51 {
53 }
54 
55 /**********************************************
56  * Enable the dedicated functions of the board.
57  **********************************************/
58 static void mainboard_enable(struct device *dev)
59 {
60  /* Initialize the PIRQ data structures for consumption */
61  pirq_setup();
62 
63  /* Inagua mainboard specific setting */
64  init_gpios();
65 
66  /*
67  * Initialize ASF registers to an arbitrary address because someone
68  * long ago set things up this way inside the SPD read code. The
69  * SPD read code has been made generic and moved out of the board
70  * directory, so the ASF init is being done here.
71  */
72  pm_write8(0x29, 0x80);
73  pm_write8(0x28, 0x61);
74 }
75 
78 };
struct chip_operations mainboard_ops
Definition: mainboard.c:19
static uint8_t pm_read8(uint8_t reg)
Definition: acpimmio.h:166
static void pm_write8(uint8_t reg, uint8_t value)
Definition: acpimmio.h:181
static uint8_t iomux_read8(uint8_t reg)
static void gpio_100_write8(uint8_t reg, uint8_t value)
static void iomux_write8(uint8_t reg, uint8_t value)
static const u8 mainboard_intr_data[]
Definition: mainboard.c:8
static void mainboard_enable(struct device *dev)
Definition: mainboard.c:58
static void init_gpios(void)
Definition: mainboard.c:22
static void pirq_setup(void)
Definition: mainboard.c:50
const u8 * intr_data_ptr
Definition: amd_pci_util.c:13
uint8_t u8
Definition: stdint.h:45
void(* enable_dev)(struct device *dev)
Definition: device.h:24
Definition: device.h:107