| 1 |
|
| 2 |
#include <device/pci_ops.h> |
| 3 |
#include <device/device.h> |
| 4 |
#include <device/pci_def.h> |
| 5 |
#include <intelblocks/fast_spi.h> |
| 6 |
#include <intelblocks/gspi.h> |
| 7 |
#include <intelblocks/itss.h> |
| 8 |
#include <intelblocks/lpc_lib.h> |
| 9 |
#include <intelblocks/p2sb.h> |
| 10 |
#include <intelblocks/pcr.h> |
| 11 |
#include <intelblocks/pmclib.h> |
| 12 |
#include <intelblocks/rtc.h> |
| 13 |
#include <soc/bootblock.h> |
| 14 |
#include <soc/iomap.h> |
| 15 |
#include <soc/p2sb.h> |
| 16 |
#include <soc/pch.h> |
| 17 |
#include <soc/pci_devs.h> |
| 18 |
#include <soc/pcr_ids.h> |
| 19 |
#include <soc/pm.h> |
| 20 |
#include <soc/pmc.h> |
| 21 |
#include <static.h> |
| 22 |
#include "../chip.h" |
| 23 |
|
| 24 |
#define PCR_DMI_ACPIBA 0x27B4 |
| 25 |
#define PCR_DMI_ACPIBDID 0x27B8 |
| 26 |
#define PCR_DMI_PMBASEA 0x27AC |
| 27 |
#define PCR_DMI_PMBASEC 0x27B0 |
| 28 |
|
| 29 |
void bootblock_pch_early_init(void) |
| 30 |
{ |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
p2sb_enable_bar(); |
| 36 |
p2sb_configure_hpet(); |
| 37 |
|
| 38 |
fast_spi_early_init(SPI_BASE_ADDRESS); |
| 39 |
} |
| 40 |
|
| 41 |
static void soc_config_acpibase(void) |
| 42 |
{ |
| 43 |
uint32_t reg32; |
| 44 |
|
| 45 |
|
| 46 |
reg32 = pci_read_config32(PCH_DEV_PMC, ACTL); |
| 47 |
pci_write_config32(PCH_DEV_PMC, ACTL, reg32 & ~ACPI_EN); |
| 48 |
|
| 49 |
|
| 50 |
pci_write_config32(PCH_DEV_PMC, ABASE, ACPI_BASE_ADDRESS); |
| 51 |
|
| 52 |
|
| 53 |
pci_write_config32(PCH_DEV_PMC, ACTL, reg32 | ACPI_EN); |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
reg32 = ((0x3f << 18) | ACPI_BASE_ADDRESS | 1); |
| 60 |
pcr_write32(PID_DMI, PCR_DMI_ACPIBA, reg32); |
| 61 |
if (CONFIG(SKYLAKE_SOC_PCH_H)) |
| 62 |
pcr_write32(PID_DMI, PCR_DMI_ACPIBDID, 0x23a8); |
| 63 |
else |
| 64 |
pcr_write32(PID_DMI, PCR_DMI_ACPIBDID, 0x23a0); |
| 65 |
} |
| 66 |
|
| 67 |
static void soc_config_pwrmbase(void) |
| 68 |
{ |
| 69 |
uint32_t reg32; |
| 70 |
|
| 71 |
|
| 72 |
reg32 = pci_read_config32(PCH_DEV_PMC, ACTL); |
| 73 |
pci_write_config32(PCH_DEV_PMC, ACTL, reg32 & ~PWRM_EN); |
| 74 |
|
| 75 |
|
| 76 |
pci_write_config32(PCH_DEV_PMC, PWRMBASE, PCH_PWRM_BASE_ADDRESS); |
| 77 |
|
| 78 |
|
| 79 |
pci_write_config32(PCH_DEV_PMC, ACTL, reg32 | PWRM_EN); |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
pcr_write32(PID_DMI, PCR_DMI_PMBASEA, |
| 93 |
((PCH_PWRM_BASE_ADDRESS & 0xFFFF0000) | |
| 94 |
(PCH_PWRM_BASE_ADDRESS >> 16))); |
| 95 |
if (CONFIG(SKYLAKE_SOC_PCH_H)) |
| 96 |
pcr_write32(PID_DMI, PCR_DMI_PMBASEC, 0x800023a8); |
| 97 |
else |
| 98 |
pcr_write32(PID_DMI, PCR_DMI_PMBASEC, 0x800023a0); |
| 99 |
} |
| 100 |
|
| 101 |
void pch_early_iorange_init(void) |
| 102 |
{ |
| 103 |
uint16_t io_enables = LPC_IOE_SUPERIO_2E_2F | LPC_IOE_KBC_60_64 | |
| 104 |
LPC_IOE_EC_62_66; |
| 105 |
|
| 106 |
const config_t *config = config_of_soc(); |
| 107 |
|
| 108 |
if (config->lpc_ioe) { |
| 109 |
io_enables = config->lpc_ioe & 0x3f0f; |
| 110 |
lpc_set_fixed_io_ranges(config->lpc_iod, 0x1377); |
| 111 |
} else { |
| 112 |
|
| 113 |
if (CONFIG(DRIVERS_UART_8250IO)) |
| 114 |
lpc_io_setup_comm_a_b(); |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
lpc_enable_fixed_io_ranges(io_enables); |
| 119 |
|
| 120 |
|
| 121 |
pch_enable_lpc(); |
| 122 |
} |
| 123 |
|
| 124 |
void bootblock_pch_init(void) |
| 125 |
{ |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
soc_config_acpibase(); |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
soc_config_pwrmbase(); |
| 137 |
|
| 138 |
|
| 139 |
pmc_gpe_init(); |
| 140 |
|
| 141 |
enable_rtc_upper_bank(); |
| 142 |
|
| 143 |
gspi_early_bar_init(); |
| 144 |
} |