70 changes: 0 additions & 70 deletions src/arch/x86/include/arch/pci_mmio_cfg_romcc.h

This file was deleted.

6 changes: 0 additions & 6 deletions src/arch/x86/include/arch/pci_ops.h
Expand Up @@ -15,12 +15,6 @@
#define ARCH_I386_PCI_OPS_H

#include <arch/pci_io_cfg.h>

#if defined(__ROMCC__)
/* Must come before <device/pci_mmio_cfg.h> */
#include <arch/pci_mmio_cfg_romcc.h>
#endif

#include <device/pci_mmio_cfg.h>

#endif /* ARCH_I386_PCI_OPS_H */
1 change: 0 additions & 1 deletion src/arch/x86/include/arch/romstage.h
Expand Up @@ -14,7 +14,6 @@
#ifndef __ARCH_ROMSTAGE_H__
#define __ARCH_ROMSTAGE_H__

#include <arch/cpu.h>
#include <stddef.h>
#include <stdint.h>

Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86/ioapic.c
Expand Up @@ -73,7 +73,7 @@ void set_ioapic_id(void *ioapic_base, u8 ioapic_id)
u32 bsp_lapicid = lapicid();
int i;

printk(BIOS_DEBUG, "IOAPIC: Initializing IOAPIC at 0x%p\n",
printk(BIOS_DEBUG, "IOAPIC: Initializing IOAPIC at %p\n",
ioapic_base);
printk(BIOS_DEBUG, "IOAPIC: Bootstrap Processor Local APIC = 0x%02x\n",
bsp_lapicid);
Expand Down
1 change: 0 additions & 1 deletion src/arch/x86/memlayout.ld
Expand Up @@ -49,7 +49,6 @@ SECTIONS

#include EARLY_MEMLAYOUT
#elif ENV_BOOTBLOCK
/* arch/x86/bootblock.ld contains the logic for the ROMCC_BOOTBLOCK linking. */
BOOTBLOCK(CONFIG_X86_RESET_VECTOR - CONFIG_C_ENV_BOOTBLOCK_SIZE + 0x10,
CONFIG_C_ENV_BOOTBLOCK_SIZE)

Expand Down
1 change: 0 additions & 1 deletion src/arch/x86/mmap_boot.c
Expand Up @@ -13,7 +13,6 @@

#include <boot_device.h>
#include <endian.h>
#include <stdlib.h>

/* The ROM is memory mapped just below 4GiB. Form a pointer for the base. */
#define rom_base ((void *)(uintptr_t)(0x100000000ULL-CONFIG_ROM_SIZE))
Expand Down
10 changes: 10 additions & 0 deletions src/arch/x86/postcar_loader.c
Expand Up @@ -19,6 +19,7 @@
#include <cpu/x86/mtrr.h>
#include <cpu/x86/smm.h>
#include <program_loading.h>
#include <reset.h>
#include <rmodule.h>
#include <romstage_handoff.h>
#include <stage_cache.h>
Expand Down Expand Up @@ -208,6 +209,12 @@ void postcar_enable_tseg_cache(struct postcar_frame *pcf)
MTRR_TYPE_WRBACK);
}

static void postcar_cache_invalid(void)
{
printk(BIOS_ERR, "postcar cache invalid.\n");
board_reset();
}

void run_postcar_phase(struct postcar_frame *pcf)
{
struct prog prog =
Expand All @@ -222,6 +229,9 @@ void run_postcar_phase(struct postcar_frame *pcf)
parameters between S3 resume and normal boot. On the
platforms where the values are the same it's a nop. */
finalize_load(prog.arg, pcf->stack);

if (prog_entry(&prog) == NULL)
postcar_cache_invalid();
} else
load_postcar_cbfs(&prog, pcf);

Expand Down
1 change: 0 additions & 1 deletion src/arch/x86/smbios.c
Expand Up @@ -12,7 +12,6 @@
* GNU General Public License for more details.
*/

#include <stdlib.h>
#include <string.h>
#include <smbios.h>
#include <console/console.h>
Expand Down
4 changes: 2 additions & 2 deletions src/commonlib/fsp_relocate.c
Expand Up @@ -136,8 +136,8 @@ static int te_relocate(uintptr_t new_addr, void *te)
/*
* A TE image is created by converting a PE file. Because of this
* the offsets within the headers are off. In order to calculate
* the correct releative offets one needs to subtract fixup_offset
* from the encoded offets. Similarly, the linked address of the
* the correct relative offsets one needs to subtract fixup_offset
* from the encoded offsets. Similarly, the linked address of the
* program is found by adding the fixup_offset to the ImageBase.
*/
fixup_offset = read_le16(&teih->StrippedSize);
Expand Down
7 changes: 0 additions & 7 deletions src/commonlib/include/commonlib/cbfs_serialized.h
Expand Up @@ -187,11 +187,6 @@ struct cbfs_file_attr_align {
uint32_t alignment;
} __packed;

/*
* ROMCC does not understand uint64_t, so we hide future definitions as they are
* unlikely to be ever needed from ROMCC
*/
#ifndef __ROMCC__

/*** Component sub-headers ***/

Expand Down Expand Up @@ -236,6 +231,4 @@ struct cbfs_optionrom {
uint32_t len;
} __packed;

#endif /* __ROMCC__ */

#endif /* _CBFS_SERIALIZED_H_ */
9 changes: 1 addition & 8 deletions src/commonlib/include/commonlib/helpers.h
Expand Up @@ -41,13 +41,10 @@
var_a op var_b ? var_a : var_b; \
})

#ifdef __ROMCC__ /* romcc doesn't support __builtin_choose_expr() */
#define __CMP(a, b, op) __CMP_UNSAFE(a, b, op)
#else

#define __CMP(a, b, op) __builtin_choose_expr( \
__builtin_constant_p(a) && __builtin_constant_p(b), \
__CMP_UNSAFE(a, b, op), __CMP_SAFE(a, b, op, __TMPNAME, __TMPNAME))
#endif

#ifndef MIN
#define MIN(a, b) __CMP(a, b, <)
Expand Down Expand Up @@ -108,12 +105,8 @@
#define GHz (1000 * MHz)

#ifndef offsetof
#ifdef __ROMCC__
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#else
#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
#endif
#endif

#define check_member(structure, member, offset) _Static_assert( \
offsetof(struct structure, member) == offset, \
Expand Down
1 change: 1 addition & 0 deletions src/commonlib/storage/mmc.c
Expand Up @@ -186,6 +186,7 @@ static int mmc_select_hs(struct storage_media *media)

/* Increase the controller clock speed */
SET_TIMING(media->ctrlr, BUS_TIMING_MMC_HS);
media->caps &= ~(DRVR_CAP_HS200 | DRVR_CAP_HS400);
media->caps |= DRVR_CAP_HS52 | DRVR_CAP_HS;
mmc_recalculate_clock(media);
ret = sd_mmc_send_status(media, SD_MMC_IO_RETRIES);
Expand Down
2 changes: 1 addition & 1 deletion src/commonlib/storage/sdhci.c
Expand Up @@ -722,7 +722,7 @@ static int sdhci_init(struct sdhci_ctrlr *sdhci_ctrlr)
if (ctrlr->initialized)
return 0;

sdhc_debug("SDHCI Controller Base Address: 0x%p\n",
sdhc_debug("SDHCI Controller Base Address: %p\n",
sdhci_ctrlr->ioaddr);

rv = sdhci_pre_init(sdhci_ctrlr);
Expand Down
7 changes: 6 additions & 1 deletion src/console/Kconfig
Expand Up @@ -5,7 +5,7 @@ config NO_BOOTBLOCK_CONSOLE

config BOOTBLOCK_CONSOLE
bool "Enable early (bootblock) console output."
depends on !ROMCC_BOOTBLOCK && !NO_BOOTBLOCK_CONSOLE
depends on !NO_BOOTBLOCK_CONSOLE
default y
help
Use console during the bootblock if supported
Expand Down Expand Up @@ -417,6 +417,7 @@ config POST_DEVICE
choice
prompt "Device to send POST codes to"
depends on POST_DEVICE
default POST_DEVICE_LPC if DEFAULT_POST_ON_LPC
default POST_DEVICE_NONE

config POST_DEVICE_NONE
Expand All @@ -429,6 +430,10 @@ config POST_DEVICE_PCI_PCIE
depends on PCI
endchoice

config DEFAULT_POST_ON_LPC
bool
default n

config POST_IO
bool "Send POST codes to an IO port"
depends on PC80_SYSTEM && !NO_POST
Expand Down
3 changes: 0 additions & 3 deletions src/console/die.c
Expand Up @@ -15,8 +15,6 @@
#include <console/console.h>
#include <halt.h>

#ifndef __ROMCC__

/*
* The method should be overwritten in mainboard directory to signal that a
* fatal error had occurred. On boards that do share the same EC and where the
Expand All @@ -39,4 +37,3 @@ void __noreturn die(const char *fmt, ...)
die_notify();
halt();
}
#endif
7 changes: 0 additions & 7 deletions src/console/post.c
Expand Up @@ -24,20 +24,13 @@

/* Write POST information */

/* someday romcc will be gone. */
#ifndef __ROMCC__
/* Some mainboards have very nice features beyond just a simple display.
* They can override this function.
*/
void __weak mainboard_post(uint8_t value)
{
}

#else
/* This just keeps the number of #ifs to a minimum */
#define mainboard_post(x)
#endif

#if CONFIG(CMOS_POST)

DECLARE_SPIN_LOCK(cmos_post_lock)
Expand Down
9 changes: 5 additions & 4 deletions src/console/vtxprintf.c
Expand Up @@ -220,10 +220,11 @@ int vtxprintf(void (*tx_byte)(unsigned char byte, void *data),
continue;

case 'p':
if (field_width == -1) {
field_width = 2*sizeof(void *);
flags |= ZEROPAD;
}
/* even on 64-bit systems, coreboot only resides in the
low 4GB so pad pointers to 32-bit for readability. */
if (field_width == -1 && precision == -1)
precision = 2*sizeof(uint32_t);
flags |= SPECIAL;
count += number(tx_byte,
(unsigned long) va_arg(args, void *), 16,
field_width, precision, flags, data);
Expand Down
9 changes: 8 additions & 1 deletion src/cpu/amd/agesa/Kconfig
Expand Up @@ -26,7 +26,6 @@ config CPU_AMD_AGESA
select UDELAY_LAPIC
select LAPIC_MONOTONIC_TIMER
select SPI_FLASH if HAVE_ACPI_RESUME
select CBMEM_STAGE_CACHE if HAVE_ACPI_RESUME
select SMM_ASEG
select NO_FIXED_XIP_ROM_SIZE
select SSE2
Expand All @@ -49,6 +48,14 @@ config DCACHE_RAM_SIZE
hex
default 0x10000

config DCACHE_BSP_STACK_SIZE
hex
default 0x4000

config C_ENV_BOOTBLOCK_SIZE
hex
default 0x8000

config ENABLE_MRC_CACHE
bool "Use cached memory configuration"
default n
Expand Down
1 change: 0 additions & 1 deletion src/cpu/amd/agesa/family14/Makefile.inc
Expand Up @@ -12,7 +12,6 @@
#

romstage-y += fixme.c
romstage-y += romstage.c

ramstage-y += fixme.c
ramstage-y += chip_name.c
Expand Down
37 changes: 0 additions & 37 deletions src/cpu/amd/agesa/family14/fixme.c
Expand Up @@ -18,10 +18,6 @@
#include <AGESA.h>
#include <amdlib.h>

/* Define AMD Ontario APPU SSID/SVID */
#define AMD_APU_SVID 0x1022
#define AMD_APU_SSID 0x1234

void amd_initcpuio(void)
{
UINT64 MsrReg;
Expand Down Expand Up @@ -65,39 +61,6 @@ void amd_initcpuio(void)
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
}

void amd_initmmio(void)
{
UINT64 MsrReg;
UINT32 PciData;
PCI_ADDR PciAddress;
AMD_CONFIG_PARAMS StdHeader;

/*
Set the MMIO Configuration Base Address and Bus Range onto MMIO configuration base
Address MSR register.
*/
MsrReg = CONFIG_MMCONF_BASE_ADDRESS | (LibAmdBitScanReverse(CONFIG_MMCONF_BUS_NUMBER) << 2) | 1;
LibAmdMsrWrite(MMIO_CONF_BASE, &MsrReg, &StdHeader);

/* Set Ontario Link Data */
PciAddress.AddressValue = MAKE_SBDFO(0, 0, 0, 0, 0xE0);
PciData = 0x01308002;
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
PciAddress.AddressValue = MAKE_SBDFO(0, 0, 0, 0, 0xE4);
PciData = (AMD_APU_SSID << 0x10) | AMD_APU_SVID;
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);

/* Set ROM cache onto WP to decrease post time */
MsrReg = (0x0100000000ull - CACHE_ROM_SIZE) | MTRR_TYPE_WRPROT;
LibAmdMsrWrite(MTRR_PHYS_BASE(6), &MsrReg, &StdHeader);
MsrReg = ((1ULL << CONFIG_CPU_ADDR_BITS) - CACHE_ROM_SIZE) | MTRR_PHYS_MASK_VALID;
LibAmdMsrWrite(MTRR_PHYS_MASK(6), &MsrReg, &StdHeader);

/* Set P-state 0 (1600 MHz) early to save a few ms of boot time */
MsrReg = 0;
LibAmdMsrWrite(PS_CTL_REG, &MsrReg, &StdHeader);
}

void amd_initenv(void)
{
AMD_INTERFACE_PARAMS AmdParamStruct;
Expand Down
19 changes: 0 additions & 19 deletions src/cpu/amd/agesa/family15tn/fixme.c
Expand Up @@ -60,22 +60,3 @@ void amd_initcpuio(void)
PciData = 0x00000003;
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
}

void amd_initmmio(void)
{
UINT64 MsrReg;
AMD_CONFIG_PARAMS StdHeader;

/*
Set the MMIO Configuration Base Address and Bus Range onto MMIO configuration base
Address MSR register.
*/
MsrReg = CONFIG_MMCONF_BASE_ADDRESS | (LibAmdBitScanReverse (CONFIG_MMCONF_BUS_NUMBER) << 2) | 1;
LibAmdMsrWrite(MMIO_CONF_BASE, &MsrReg, &StdHeader);

/* Set ROM cache onto WP to decrease post time */
MsrReg = (0x0100000000ull - CACHE_ROM_SIZE) | 5ull;
LibAmdMsrWrite(MTRR_PHYS_BASE(6), &MsrReg, &StdHeader);
MsrReg = ((1ULL << CONFIG_CPU_ADDR_BITS) - CACHE_ROM_SIZE) | 0x800ull;
LibAmdMsrWrite(MTRR_PHYS_MASK(6), &MsrReg, &StdHeader);
}
19 changes: 0 additions & 19 deletions src/cpu/amd/agesa/family16kb/fixme.c
Expand Up @@ -60,22 +60,3 @@ void amd_initcpuio(void)
PciData = 0x00000003;
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
}

void amd_initmmio(void)
{
UINT64 MsrReg;
AMD_CONFIG_PARAMS StdHeader;

/*
Set the MMIO Configuration Base Address and Bus Range onto MMIO configuration base
Address MSR register.
*/
MsrReg = CONFIG_MMCONF_BASE_ADDRESS | (LibAmdBitScanReverse (CONFIG_MMCONF_BUS_NUMBER) << 2) | 1;
LibAmdMsrWrite(MMIO_CONF_BASE, &MsrReg, &StdHeader);

/* Set ROM cache onto WP to decrease post time */
MsrReg = (0x0100000000ull - CACHE_ROM_SIZE) | 5ull;
LibAmdMsrWrite(MTRR_PHYS_BASE(6), &MsrReg, &StdHeader);
MsrReg = ((1ULL << CONFIG_CPU_ADDR_BITS) - CACHE_ROM_SIZE) | 0x800ull;
LibAmdMsrWrite(MTRR_PHYS_MASK(6), &MsrReg, &StdHeader);
}
27 changes: 0 additions & 27 deletions src/cpu/amd/pi/00630F01/fixme.c
Expand Up @@ -65,30 +65,3 @@ void amd_initcpuio(void)
PciData = 0x00000003;
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
}

void amd_initmmio(void)
{
UINT64 MsrReg;
AMD_CONFIG_PARAMS StdHeader;

/*
* Set the MMIO Configuration Base Address
* and Bus Range onto MMIO configuration base
* Address MSR register.
*/
MsrReg = CONFIG_MMCONF_BASE_ADDRESS |
(LibAmdBitScanReverse(CONFIG_MMCONF_BUS_NUMBER) << 2) | 1;
LibAmdMsrWrite(MMIO_CONF_BASE, &MsrReg, &StdHeader);

/* Set ROM cache onto WP to decrease post time */
MsrReg = (0x0100000000ull - CACHE_ROM_SIZE) | 5ull;
LibAmdMsrWrite(MTRR_PHYS_BASE(6), &MsrReg, &StdHeader);
MsrReg = ((1ULL << CONFIG_CPU_ADDR_BITS) - CACHE_ROM_SIZE) | 0x800ull;
LibAmdMsrWrite(MTRR_PHYS_MASK(6), &MsrReg, &StdHeader);

if (CONFIG(UDELAY_LAPIC)){
LibAmdMsrRead(0x1B, &MsrReg, &StdHeader);
MsrReg |= 1 << 11;
LibAmdMsrWrite(0x1B, &MsrReg, &StdHeader);
}
}
34 changes: 0 additions & 34 deletions src/cpu/amd/pi/00660F01/fixme.c
Expand Up @@ -64,37 +64,3 @@ void amd_initcpuio(void)
PciData = 0x00000003;
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
}

void amd_initmmio(void)
{
UINT64 MsrReg;
UINT32 PciData;
PCI_ADDR PciAddress;
AMD_CONFIG_PARAMS StdHeader;

/*
* Set the MMIO Configuration Base Address and
* Bus Range onto MMIO configuration base
* Address MSR register.
*/
MsrReg = CONFIG_MMCONF_BASE_ADDRESS |
(LibAmdBitScanReverse(CONFIG_MMCONF_BUS_NUMBER) << 2) | 1;
LibAmdMsrWrite(MMIO_CONF_BASE, &MsrReg, &StdHeader);

/* For serial port */
PciData = 0xFF03FFD5;
PciAddress.AddressValue = MAKE_SBDFO(0, 0, 0x14, 0x3, 0x44);
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);

/* Set ROM cache onto WP to decrease post time */
MsrReg = (0x0100000000ull - CACHE_ROM_SIZE) | 5ull;
LibAmdMsrWrite(MTRR_PHYS_BASE(6), &MsrReg, &StdHeader);
MsrReg = ((1ULL << CONFIG_CPU_ADDR_BITS) - CACHE_ROM_SIZE) | 0x800ull;
LibAmdMsrWrite(MTRR_PHYS_MASK(6), &MsrReg, &StdHeader);

if (CONFIG(UDELAY_LAPIC)) {
LibAmdMsrRead(0x1B, &MsrReg, &StdHeader);
MsrReg |= 1 << 11;
LibAmdMsrWrite(0x1B, &MsrReg, &StdHeader);
}
}
39 changes: 0 additions & 39 deletions src/cpu/amd/pi/00730F01/fixme.c
Expand Up @@ -64,42 +64,3 @@ void amd_initcpuio(void)
PciData = 0x00000003;
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
}

void amd_initmmio(void)
{
UINT64 MsrReg;
UINT32 PciData;
PCI_ADDR PciAddress;
AMD_CONFIG_PARAMS StdHeader;

/*
* Set the MMIO Configuration Base Address and
* Bus Range onto MMIO configuration base
* Address MSR register.
*/
MsrReg = CONFIG_MMCONF_BASE_ADDRESS |
(LibAmdBitScanReverse(CONFIG_MMCONF_BUS_NUMBER) << 2) | 1;
LibAmdMsrWrite(MMIO_CONF_BASE, &MsrReg, &StdHeader);

/* For serial port */
PciData = 0xFF03FFD5;
PciAddress.AddressValue = MAKE_SBDFO(0, 0, 0x14, 0x3, 0x44);
LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);

/* PSP */
//PciData = 0xD;
//PciAddress.AddressValue = MAKE_SBDFO (0, 0, 0x8, 0x0, 0x48);
//LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);

/* Set ROM cache onto WP to decrease post time */
MsrReg = (0x0100000000ull - CACHE_ROM_SIZE) | 5ull;
LibAmdMsrWrite(MTRR_PHYS_BASE(6), &MsrReg, &StdHeader);
MsrReg = ((1ULL << CONFIG_CPU_ADDR_BITS) - CACHE_ROM_SIZE) | 0x800ull;
LibAmdMsrWrite(MTRR_PHYS_MASK(6), &MsrReg, &StdHeader);

if (CONFIG(UDELAY_LAPIC)) {
LibAmdMsrRead(0x1B, &MsrReg, &StdHeader);
MsrReg |= 1 << 11;
LibAmdMsrWrite(0x1B, &MsrReg, &StdHeader);
}
}
8 changes: 8 additions & 0 deletions src/cpu/amd/pi/Kconfig
Expand Up @@ -48,6 +48,14 @@ config DCACHE_RAM_SIZE
hex
default 0x10000

config DCACHE_BSP_STACK_SIZE
hex
default 0x4000

config C_ENV_BOOTBLOCK_SIZE
hex
default 0x8000

endif # CPU_AMD_PI

source "src/cpu/amd/pi/00630F01/Kconfig"
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/intel/car/bootblock.c
Expand Up @@ -12,7 +12,7 @@
*/

#include <bootblock_common.h>
#include <cpu/intel/car/bootblock.h>
#include <arch/bootblock.h>
#include <cpu/x86/bist.h>

static uint32_t saved_bist;
Expand Down
3 changes: 0 additions & 3 deletions src/cpu/intel/car/non-evict/cache_as_ram.S
Expand Up @@ -28,11 +28,8 @@
_cache_as_ram_setup:

bootblock_pre_c_entry:

#if !CONFIG(ROMCC_BOOTBLOCK)
movl $cache_as_ram, %esp /* return address */
jmp check_mtrr /* Check if CPU properly reset */
#endif

cache_as_ram:
post_code(0x20)
Expand Down
13 changes: 0 additions & 13 deletions src/cpu/intel/car/romstage.c
Expand Up @@ -71,19 +71,6 @@ static void romstage_main(unsigned long bist)
/* We do not return here. */
}

#if CONFIG(ROMCC_BOOTBLOCK)
/* This wrapper enables easy transition away from ROMCC_BOOTBLOCK
* keeping changes in cache_as_ram.S easy to manage.
*/
asmlinkage void bootblock_c_entry_bist(uint64_t base_timestamp, uint32_t bist)
{
timestamp_init(base_timestamp);
timestamp_add_now(TS_START_ROMSTAGE);
romstage_main(bist);
}
#endif


/* We don't carry BIST from bootblock in a good location to read from.
* Any error should have been reported in bootblock already.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/intel/fit/fit.ld
Expand Up @@ -12,7 +12,7 @@
*/

SECTIONS {
. = CONFIG_X86_RESET_VECTOR - 0x30; /* 0xffffffc0 */
. = 0xffffffc0;
.fit_pointer (.): {
KEEP(*(.fit_pointer))
}
Expand Down
12 changes: 0 additions & 12 deletions src/cpu/intel/haswell/Kconfig
Expand Up @@ -35,16 +35,4 @@ config IED_REGION_SIZE
config SMM_RESERVED_SIZE
hex
default 0x100000

config RESET_ON_INVALID_RAMSTAGE_CACHE
bool "Reset the system on S3 wake when ramstage cache invalid."
default n
help
The haswell romstage code caches the loaded ramstage program
in SMM space. On S3 wake the romstage will copy over a fresh
ramstage that was cached in the SMM space. This option determines
the action to take when the ramstage cache is invalid. If selected
the system will reset otherwise the ramstage will be reloaded from
cbfs.

endif
3 changes: 1 addition & 2 deletions src/cpu/intel/haswell/bootblock.c
Expand Up @@ -12,7 +12,7 @@
*/

#include <stdint.h>
#include <arch/cpu.h>
#include <arch/bootblock.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
#include <arch/io.h>
Expand All @@ -21,7 +21,6 @@
#include "haswell.h"

#include <southbridge/intel/lynxpoint/pch.h>
#include <cpu/intel/car/bootblock.h>

static void set_flex_ratio_to_tdp_nominal(void)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/intel/haswell/haswell.h
Expand Up @@ -15,7 +15,7 @@
#ifndef _CPU_INTEL_HASWELL_H
#define _CPU_INTEL_HASWELL_H

#include <arch/cpu.h>
#include <stdint.h>

/* Haswell CPU types */
#define HASWELL_FAMILY_MOBILE 0x306c0
Expand Down
1 change: 1 addition & 0 deletions src/cpu/intel/haswell/smmrelocate.c
Expand Up @@ -27,6 +27,7 @@
#include <console/console.h>
#include <northbridge/intel/haswell/haswell.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include <smp/node.h>
#include "haswell.h"

#define MSR_PRMRR_PHYS_BASE 0x1f4
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/intel/microcode/Kconfig
@@ -1,7 +1,7 @@
config MICROCODE_UPDATE_PRE_RAM
bool
depends on SUPPORT_CPU_UCODE_IN_CBFS
default y if !ROMCC_BOOTBLOCK
default y
help
Select this option if you want to update the microcode
during the cache as ram setup.
1 change: 0 additions & 1 deletion src/cpu/intel/microcode/Makefile.inc
@@ -1,5 +1,4 @@
bootblock-$(CONFIG_MICROCODE_UPDATE_PRE_RAM) += microcode_asm.S
romstage-$(CONFIG_MICROCODE_UPDATE_PRE_RAM) += microcode_asm.S

bootblock-$(CONFIG_SUPPORT_CPU_UCODE_IN_CBFS) += microcode.c
ramstage-$(CONFIG_SUPPORT_CPU_UCODE_IN_CBFS) += microcode.c
Expand Down
18 changes: 1 addition & 17 deletions src/cpu/intel/microcode/microcode.c
Expand Up @@ -15,11 +15,7 @@

#include <stdint.h>
#include <stddef.h>
#if !defined(__ROMCC__)
#include <cbfs.h>
#else
#include <arch/cbfs.h>
#endif
#include <arch/cpu.h>
#include <console/console.h>
#include <cpu/x86/msr.h>
Expand Down Expand Up @@ -141,22 +137,11 @@ const void *intel_microcode_find(void)
unsigned int x86_model, x86_family;
msr_t msr;

#ifdef __ROMCC__
struct cbfs_file *microcode_file;

microcode_file = walkcbfs_head((char *) MICROCODE_CBFS_FILE);
if (!microcode_file)
return NULL;

ucode_updates = CBFS_SUBHEADER(microcode_file);
microcode_len = ntohl(microcode_file->len);
#else
ucode_updates = cbfs_boot_map_with_leak(MICROCODE_CBFS_FILE,
CBFS_TYPE_MICROCODE,
&microcode_len);
if (ucode_updates == NULL)
return NULL;
#endif

/* CPUID sets MSR 0x8B if a microcode update has been loaded. */
msr.lo = 0;
Expand Down Expand Up @@ -201,8 +186,7 @@ const void *intel_microcode_find(void)
microcode_len -= update_size;
}

/* ROMCC doesn't like NULL. */
return (void *)0;
return NULL;
}

void intel_update_microcode_from_cbfs(void)
Expand Down
1 change: 1 addition & 0 deletions src/cpu/intel/model_2065x/model_2065x_init.c
Expand Up @@ -30,6 +30,7 @@
#include "chip.h"
#include <cpu/intel/smm_reloc.h>
#include <cpu/intel/common/common.h>
#include <smp/node.h>

/*
* List of supported C-states in this processor
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/intel/model_206ax/bootblock.c
Expand Up @@ -12,11 +12,11 @@
*/

#include <stdint.h>
#include <arch/bootblock.h>
#include <arch/cpu.h>
#include <cpu/x86/msr.h>
#include <arch/io.h>
#include <halt.h>
#include <cpu/intel/car/bootblock.h>

#include "model_206ax.h"

Expand Down
1 change: 0 additions & 1 deletion src/cpu/intel/model_206ax/model_206ax_init.c
Expand Up @@ -26,7 +26,6 @@
#include <cpu/intel/turbo.h>
#include <cpu/x86/cache.h>
#include <cpu/x86/name.h>
#include <pc80/mc146818rtc.h>
#include "model_206ax.h"
#include "chip.h"
#include <cpu/intel/smm_reloc.h>
Expand Down
3 changes: 2 additions & 1 deletion src/cpu/ti/am335x/memlayout.ld
Expand Up @@ -19,7 +19,8 @@ SECTIONS
{
DRAM_START(0x40000000)
BOOTBLOCK(0x402f0400, 20K)
ROMSTAGE(0x402f5400, 90K)
ROMSTAGE(0x402f5400, 88K)
FMAP_CACHE(0x4030b400, 2K)
STACK(0x4030be00, 4K)
RAMSTAGE(0x80200000, 192K)

Expand Down
3 changes: 0 additions & 3 deletions src/cpu/x86/16bit/entry16.inc
Expand Up @@ -29,13 +29,10 @@

#include <arch/rom_segs.h>

#if !CONFIG(ROMCC_BOOTBLOCK) || \
CONFIG(SIPI_VECTOR_IN_ROM)
/* Symbol _start16bit must be aligned to 4kB to start AP CPUs with
* Startup IPI message without RAM.
*/
.align 4096
#endif
.code16
.globl _start16bit
.type _start16bit, @function
Expand Down
26 changes: 23 additions & 3 deletions src/cpu/x86/16bit/entry16.ld
@@ -1,3 +1,23 @@
gdtptr16_offset = gdtptr16 & 0xffff;
nullidt_offset = nullidt & 0xffff;
ap_sipi_vector_in_rom = (_start16bit >> 12) & 0xff;
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

gdtptr16_offset = gdtptr16 & 0xffff;
nullidt_offset = nullidt & 0xffff;

/* Symbol _start16bit must be aligned to 4kB to start AP CPUs with
* Startup IPI message without RAM.
*/
#if CONFIG(SIPI_VECTOR_IN_ROM)
_bogus = ASSERT((_start16bit & 0xfff) == 0, "Symbol _start16bit is not at 4 KiB boundary");
ap_sipi_vector_in_rom = (_start16bit >> 12) & 0xff;
#endif
1 change: 0 additions & 1 deletion src/cpu/x86/Kconfig
Expand Up @@ -77,7 +77,6 @@ config XIP_ROM_SIZE

config SETUP_XIP_CACHE
bool
depends on !ROMCC_BOOTBLOCK
depends on !NO_XIP_EARLY_STAGES
help
Select this option to set up an MTRR to cache XIP stages loaded
Expand Down
1 change: 1 addition & 0 deletions src/cpu/x86/lapic/Makefile.inc
@@ -1,6 +1,7 @@
ramstage-y += lapic.c
ramstage-y += lapic_cpu_init.c
ramstage-$(CONFIG_SMP) += secondary.S
bootblock-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
romstage-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
ramstage-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
postcar-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
Expand Down
1 change: 0 additions & 1 deletion src/cpu/x86/lapic/apic_timer.c
Expand Up @@ -15,7 +15,6 @@
#include <console/console.h>
#include <delay.h>
#include <thread.h>
#include <arch/cpu.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/lapic.h>

Expand Down
1 change: 1 addition & 0 deletions src/cpu/x86/lapic/lapic_cpu_init.c
Expand Up @@ -28,6 +28,7 @@
#include <smp/spinlock.h>
#include <cpu/cpu.h>
#include <cpu/intel/speedstep.h>
#include <smp/node.h>
#include <stdlib.h>
#include <thread.h>

Expand Down
2 changes: 1 addition & 1 deletion src/cpu/x86/mp_init.c
Expand Up @@ -352,7 +352,7 @@ static atomic_t *load_sipi_vector(struct mp_params *mp_params)
sp->msr_count = num_msrs;
/* Provide pointer to microcode patch. */
sp->microcode_ptr = (uint32_t)mp_params->microcode_pointer;
/* Pass on abiility to load microcode in parallel. */
/* Pass on ability to load microcode in parallel. */
if (mp_params->parallel_microcode_load)
sp->microcode_lock = 0;
else
Expand Down
2 changes: 1 addition & 1 deletion src/device/dram/ddr3.c
Expand Up @@ -531,7 +531,7 @@ enum cb_err spd_add_smbios17(const u8 channel, const u8 slot,
if (!mem_info) {
mem_info = cbmem_add(CBMEM_ID_MEMINFO, sizeof(*mem_info));

printk(BIOS_DEBUG, "CBMEM entry for DIMM info: 0x%p\n",
printk(BIOS_DEBUG, "CBMEM entry for DIMM info: %p\n",
mem_info);
if (!mem_info)
return CB_ERR;
Expand Down
2 changes: 1 addition & 1 deletion src/device/dram/ddr4.c
Expand Up @@ -207,7 +207,7 @@ enum cb_err spd_add_smbios17_ddr4(const u8 channel, const u8 slot, const u16 sel
if (!mem_info) {
mem_info = cbmem_add(CBMEM_ID_MEMINFO, sizeof(*mem_info));

printk(BIOS_DEBUG, "CBMEM entry for DIMM info: 0x%p\n", mem_info);
printk(BIOS_DEBUG, "CBMEM entry for DIMM info: %p\n", mem_info);
if (!mem_info)
return CB_ERR;

Expand Down
1 change: 0 additions & 1 deletion src/device/i2c_bus.c
Expand Up @@ -11,7 +11,6 @@
* GNU General Public License for more details.
*/

#include <stdlib.h>
#include <stdint.h>
#include <console/console.h>
#include <device/smbus.h>
Expand Down
1 change: 0 additions & 1 deletion src/device/oprom/realmode/x86.c
Expand Up @@ -21,7 +21,6 @@
#include <device/pci_ids.h>
#include <pc80/i8259.h>
#include <pc80/i8254.h>
#include <stdlib.h>
#include <string.h>
#include <vbe.h>

Expand Down
1 change: 0 additions & 1 deletion src/device/pci_class.c
Expand Up @@ -14,7 +14,6 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <stdlib.h>

typedef struct {
const unsigned char subclass_id;
Expand Down
46 changes: 45 additions & 1 deletion src/device/pciexp_device.c
Expand Up @@ -12,6 +12,7 @@
*/

#include <console/console.h>
#include <commonlib/helpers.h>
#include <delay.h>
#include <device/device.h>
#include <device/pci.h>
Expand Down Expand Up @@ -165,7 +166,7 @@ static void pciexp_configure_ltr(struct device *dev)
cap = pci_find_capability(dev, PCI_CAP_ID_PCIE);

/*
* Check if capibility pointer is valid and
* Check if capability pointer is valid and
* device supports LTR mechanism.
*/
if (!cap || !pciexp_is_ltr_supported(dev, cap)) {
Expand Down Expand Up @@ -408,6 +409,46 @@ static void pciexp_enable_aspm(struct device *root, unsigned int root_cap,
printk(BIOS_INFO, "ASPM: Enabled %s\n", aspm_type_str[apmc]);
}

/*
* Set max payload size of endpoint in accordance with max payload size of root port.
*/
static void pciexp_set_max_payload_size(struct device *root, unsigned int root_cap,
struct device *endp, unsigned int endp_cap)
{
unsigned int endp_max_payload, root_max_payload, max_payload;
u16 endp_devctl, root_devctl;
u32 endp_devcap, root_devcap;

/* Get max payload size supported by endpoint */
endp_devcap = pci_read_config32(endp, endp_cap + PCI_EXP_DEVCAP);
endp_max_payload = endp_devcap & PCI_EXP_DEVCAP_PAYLOAD;

/* Get max payload size supported by root port */
root_devcap = pci_read_config32(root, root_cap + PCI_EXP_DEVCAP);
root_max_payload = root_devcap & PCI_EXP_DEVCAP_PAYLOAD;

/* Set max payload to smaller of the reported device capability. */
max_payload = MIN(endp_max_payload, root_max_payload);
if (max_payload > 5) {
/* Values 6 and 7 are reserved in PCIe 3.0 specs. */
printk(BIOS_ERR, "PCIe: Max_Payload_Size field restricted from %d to 5\n",
max_payload);
max_payload = 5;
}

endp_devctl = pci_read_config16(endp, endp_cap + PCI_EXP_DEVCTL);
endp_devctl &= ~PCI_EXP_DEVCTL_PAYLOAD;
endp_devctl |= max_payload << 5;
pci_write_config16(endp, endp_cap + PCI_EXP_DEVCTL, endp_devctl);

root_devctl = pci_read_config16(root, root_cap + PCI_EXP_DEVCTL);
root_devctl &= ~PCI_EXP_DEVCTL_PAYLOAD;
root_devctl |= max_payload << 5;
pci_write_config16(root, root_cap + PCI_EXP_DEVCTL, root_devctl);

printk(BIOS_INFO, "PCIe: Max_Payload_Size adjusted to %d\n", (1 << (max_payload + 7)));
}

static void pciexp_tune_dev(struct device *dev)
{
struct device *root = dev->bus->dev;
Expand Down Expand Up @@ -436,6 +477,9 @@ static void pciexp_tune_dev(struct device *dev)
/* Check for and enable ASPM */
if (CONFIG(PCIEXP_ASPM))
pciexp_enable_aspm(root, root_cap, dev, cap);

/* Adjust Max_Payload_Size of link ends. */
pciexp_set_max_payload_size(root, root_cap, dev, cap);
}

void pciexp_scan_bus(struct bus *bus, unsigned int min_devfn,
Expand Down
16 changes: 14 additions & 2 deletions src/device/pnp_device.c
Expand Up @@ -12,7 +12,6 @@
*/

#include <console/console.h>
#include <stdlib.h>
#include <stdint.h>
#include <arch/io.h>
#include <device/device.h>
Expand All @@ -32,6 +31,19 @@ void pnp_exit_conf_mode(struct device *dev)
dev->ops->ops_pnp_mode->exit_conf_mode(dev);
}

#if CONFIG(HAVE_ACPI_TABLES)
void pnp_ssdt_enter_conf_mode(struct device *dev, const char *idx, const char *data)
{
if (dev->ops->ops_pnp_mode && dev->ops->ops_pnp_mode->ssdt_enter_conf_mode)
dev->ops->ops_pnp_mode->ssdt_enter_conf_mode(dev, idx, data);
}
void pnp_ssdt_exit_conf_mode(struct device *dev, const char *idx, const char *data)
{
if (dev->ops->ops_pnp_mode && dev->ops->ops_pnp_mode->ssdt_exit_conf_mode)
dev->ops->ops_pnp_mode->ssdt_exit_conf_mode(dev, idx, data);
}
#endif

/* PNP fundamental operations */

void pnp_write_config(struct device *dev, u8 reg, u8 value)
Expand Down Expand Up @@ -370,7 +382,7 @@ void pnp_enable_devices(struct device *base_dev, struct device_operations *ops,
/* Setup the ops and resources on the newly allocated devices. */
for (i = 0; i < functions; i++) {
/* Skip logical devices this Super I/O doesn't have. */
if (info[i].function == -1)
if (info[i].function == PNP_SKIP_FUNCTION)
continue;

path.pnp.device = info[i].function;
Expand Down
4 changes: 3 additions & 1 deletion src/drivers/amd/agesa/Makefile.inc
Expand Up @@ -19,7 +19,9 @@ romstage-y += state_machine.c

ramstage-y += state_machine.c

cpu_incs-y += $(src)/drivers/amd/agesa/cache_as_ram.S
bootblock-y += bootblock.c
bootblock-y += cache_as_ram.S

postcar-y += exit_car.S

romstage-y += def_callouts.c
Expand Down
60 changes: 60 additions & 0 deletions src/drivers/amd/agesa/bootblock.c
@@ -0,0 +1,60 @@
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

#include <bootblock_common.h>
#include <halt.h>
#include <timestamp.h>
#include <amdblocks/amd_pci_mmconf.h>
#include <amdblocks/biosram.h>
#include <arch/bootblock.h>
#include <cpu/amd/msr.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/lapic.h>

#define EARLY_VMTRR_FLASH 6

static void set_early_mtrrs(void)
{
/* Cache the ROM to speed up booting */
set_var_mtrr(EARLY_VMTRR_FLASH, OPTIMAL_CACHE_ROM_BASE,
OPTIMAL_CACHE_ROM_SIZE, MTRR_TYPE_WRPROT);
}

void bootblock_soc_early_init(void)
{
bootblock_early_southbridge_init();
}

asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
{
enable_pci_mmconf();
set_early_mtrrs();

if (CONFIG(UDELAY_LAPIC))
enable_lapic();

bootblock_main_with_basetime(base_timestamp);
}

asmlinkage void ap_bootblock_c_entry(void)
{
enable_pci_mmconf();
set_early_mtrrs();

if (CONFIG(UDELAY_LAPIC))
enable_lapic();

void (*ap_romstage_entry)(void) = get_ap_entry_ptr();
ap_romstage_entry(); /* execution does not return */
halt();
}
14 changes: 12 additions & 2 deletions src/drivers/amd/agesa/cache_as_ram.S
Expand Up @@ -27,9 +27,17 @@

.code32
.globl _cache_as_ram_setup, _cache_as_ram_setup_end
.global bootblock_pre_c_entry

_cache_as_ram_setup:

/*
* on entry:
* mm0: BIST (ignored)
* mm2_mm1: timestamp at bootblock_protected_mode_entry
*/
bootblock_pre_c_entry:

post_code(0xa0)

AMD_ENABLE_STACK
Expand All @@ -51,8 +59,10 @@ _cache_as_ram_setup:
and $0xfffffff0, %esp
sub $8, %esp

pushl $0 /* tsc[63:32] */
pushl $0 /* tsc[31:0] */
movd %mm2, %eax
pushl %eax /* tsc[63:32] */
movd %mm1, %eax
pushl %eax /* tsc[31:0] */

post_code(0xa2)

Expand Down
33 changes: 11 additions & 22 deletions src/drivers/amd/agesa/romstage.c
Expand Up @@ -11,10 +11,10 @@
* GNU General Public License for more details.
*/

#include <amdblocks/biosram.h>
#include <arch/acpi.h>
#include <arch/cpu.h>
#include <arch/romstage.h>
#include <bootblock_common.h>
#include <cbmem.h>
#include <console/console.h>
#include <halt.h>
Expand All @@ -26,10 +26,7 @@
#include <northbridge/amd/agesa/agesa_helper.h>
#include <northbridge/amd/agesa/state_machine.h>

void __weak platform_once(struct sysinfo *cb)
{
board_BeforeAgesa(cb);
}
void __weak board_BeforeAgesa(struct sysinfo *cb) { }

static void fill_sysinfo(struct sysinfo *cb)
{
Expand All @@ -39,6 +36,11 @@ static void fill_sysinfo(struct sysinfo *cb)
agesa_set_interface(cb);
}

/* APs will enter directly here from bootblock, bypassing verstage
* and potential fallback / normal bootflow detection.
*/
static void ap_romstage_main(void);

static void romstage_main(void)
{
struct postcar_frame pcf;
Expand All @@ -47,24 +49,22 @@ static void romstage_main(void)
u8 initial_apic_id = (u8) (cpuid_ebx(1) >> 24);
int cbmem_initted = 0;

/* Enable PCI MMIO configuration. */
amd_initmmio();

fill_sysinfo(cb);

if (initial_apic_id == 0) {

timestamp_init(timestamp_get());
timestamp_add_now(TS_START_ROMSTAGE);

platform_once(cb);
board_BeforeAgesa(cb);

console_init();
}

printk(BIOS_DEBUG, "APIC %02d: CPU Family_Model = %08x\n",
initial_apic_id, cpuid_eax(1));

set_ap_entry_ptr(ap_romstage_main);

agesa_execute_state(cb, AMD_INIT_RESET);

agesa_execute_state(cb, AMD_INIT_EARLY);
Expand Down Expand Up @@ -104,9 +104,6 @@ static void ap_romstage_main(void)
struct sysinfo romstage_state;
struct sysinfo *cb = &romstage_state;

/* Enable PCI MMIO configuration. */
amd_initmmio();

fill_sysinfo(cb);

agesa_execute_state(cb, AMD_INIT_RESET);
Expand All @@ -117,15 +114,7 @@ static void ap_romstage_main(void)
halt();
}

/* This wrapper enables easy transition away from ROMCC_BOOTBLOCK
* keeping changes in cache_as_ram.S easy to manage.
*/
asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
asmlinkage void car_stage_entry(void)
{
romstage_main();
}

asmlinkage void ap_bootblock_c_entry(void)
{
ap_romstage_main();
}
1 change: 0 additions & 1 deletion src/drivers/amd/agesa/state_machine.c
Expand Up @@ -14,7 +14,6 @@
#include <stdint.h>
#include <string.h>
#include <arch/acpi.h>
#include <arch/cpu.h>
#include <bootstate.h>
#include <cbfs.h>
#include <cbmem.h>
Expand Down
17 changes: 17 additions & 0 deletions src/drivers/analogix/anx7625/Kconfig
@@ -0,0 +1,17 @@
##
## This file is part of the coreboot project.
##
## Copyright 2019 Analogix Semiconductor.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##

config DRIVER_ANALOGIX_ANX7625
bool
@@ -1,7 +1,7 @@
##
## This file is part of the coreboot project.
##
## Copyright 2018 Google LLC
## Copyright 2019 Analogix Semiconductor.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
Expand All @@ -13,12 +13,4 @@
## GNU General Public License for more details.
##

## GPP_F12-F16 indicates mem_id to match specific spd file
SPD_SOURCES = empty_ddr4 # 0b00000

bootblock-y += gpio.c
ramstage-y += gpio.c
romstage-y += gpio.c
verstage-y += gpio.c

ramstage-y += sku.c
ramstage-$(CONFIG_DRIVER_ANALOGIX_ANX7625) += anx7625.c
892 changes: 892 additions & 0 deletions src/drivers/analogix/anx7625/anx7625.c

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions src/drivers/analogix/anx7625/anx7625.h
@@ -0,0 +1,363 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
*
*/


#include <edid.h>
#include <types.h>

#ifndef __ANX7625_H__
#define __ANX7625_H__

#ifndef LOG_TAG
#define LOG_TAG "anx7625dp"
#endif

#define ANX7625_DRV_VERSION "0.1.04"

/* Loading OCM re-trying times */
#define OCM_LOADING_TIME 10

/********* ANX7625 Register **********/
#define ANXI2CSIM
#ifdef ANXI2CSIM
#define TX_P0_ADDR 0x38
#define TX_P1_ADDR 0x3D
#define TX_P2_ADDR 0x39
#define RX_P0_ADDR 0x3F
#define RX_P1_ADDR 0x42
#define RX_P2_ADDR 0x2A
#define TCPC_INTERFACE_ADDR 0x2C
#else
#define TX_P0_ADDR 0x70
#define TX_P1_ADDR 0x7A
#define TX_P2_ADDR 0x72
#define RX_P0_ADDR 0x7e
#define RX_P1_ADDR 0x84
#define RX_P2_ADDR 0x54
#define TCPC_INTERFACE_ADDR 0x58
#endif

#define RSVD_00_ADDR 0x00
#define RSVD_D1_ADDR 0xD1
#define RSVD_60_ADDR 0x60
#define RSVD_39_ADDR 0x39
#define RSVD_7F_ADDR 0x7F

/* anx7625 clock frequency in Hz */
#define XTAL_FRQ (27*1000000)

#define POST_DIVIDER_MIN 1
#define POST_DIVIDER_MAX 16
#define PLL_OUT_FREQ_MIN 520000000UL
#define PLL_OUT_FREQ_MAX 730000000UL
#define PLL_OUT_FREQ_ABS_MIN 300000000UL
#define PLL_OUT_FREQ_ABS_MAX 800000000UL
#define MAX_UNSIGNED_24BIT 16777215UL

/***************************************************************/
/* Register definition of device address 0x58 */

#define PRODUCT_ID_L 0x02
#define PRODUCT_ID_H 0x03

#define INTR_ALERT_1 0xCC
#define INTR_SOFTWARE_INT (1<<3)
#define INTR_RECEIVED_MSG (1<<5)

#define SYSTEM_STSTUS 0x45
#define INTERFACE_CHANGE_INT 0x44
#define HPD_STATUS_CHANGE 0x80
#define HPD_STATUS 0x80

/******** END of I2C Address 0x58 ********/

/***************************************************************/
/* Register definition of device address 0x70 */
#define I2C_ADDR_70_DPTX 0x70

#define SP_TX_LINK_BW_SET_REG 0xA0
#define SP_TX_LANE_COUNT_SET_REG 0xA1

#define M_VID_0 0xC0
#define M_VID_1 0xC1
#define M_VID_2 0xC2
#define N_VID_0 0xC3
#define N_VID_1 0xC4
#define N_VID_2 0xC5

/***************************************************************/
/* Register definition of device address 0x72 */
#define AUX_RST 0x04
#define RST_CTRL2 0x07

#define SP_TX_TOTAL_LINE_STA_L 0x24
#define SP_TX_TOTAL_LINE_STA_H 0x25
#define SP_TX_ACT_LINE_STA_L 0x26
#define SP_TX_ACT_LINE_STA_H 0x27
#define SP_TX_V_F_PORCH_STA 0x28
#define SP_TX_V_SYNC_STA 0x29
#define SP_TX_V_B_PORCH_STA 0x2A
#define SP_TX_TOTAL_PIXEL_STA_L 0x2B
#define SP_TX_TOTAL_PIXEL_STA_H 0x2C
#define SP_TX_ACT_PIXEL_STA_L 0x2D
#define SP_TX_ACT_PIXEL_STA_H 0x2E
#define SP_TX_H_F_PORCH_STA_L 0x2F
#define SP_TX_H_F_PORCH_STA_H 0x30
#define SP_TX_H_SYNC_STA_L 0x31
#define SP_TX_H_SYNC_STA_H 0x32
#define SP_TX_H_B_PORCH_STA_L 0x33
#define SP_TX_H_B_PORCH_STA_H 0x34

#define SP_TX_VID_CTRL 0x84
#define SP_TX_BPC_MASK 0xE0
#define SP_TX_BPC_6 0x00
#define SP_TX_BPC_8 0x20
#define SP_TX_BPC_10 0x40
#define SP_TX_BPC_12 0x60

#define VIDEO_BIT_MATRIX_12 0x4c

#define AUDIO_CHANNEL_STATUS_1 0xd0
#define AUDIO_CHANNEL_STATUS_2 0xd1
#define AUDIO_CHANNEL_STATUS_3 0xd2
#define AUDIO_CHANNEL_STATUS_4 0xd3
#define AUDIO_CHANNEL_STATUS_5 0xd4
#define AUDIO_CHANNEL_STATUS_6 0xd5
#define TDM_SLAVE_MODE 0x10
#define I2S_SLAVE_MODE 0x08

#define AUDIO_CONTROL_REGISTER 0xe6
#define TDM_TIMING_MODE 0x08

#define I2C_ADDR_72_DPTX 0x72

#define VIDEO_CONTROL_0 0x08

#define ACTIVE_LINES_L 0x14
#define ACTIVE_LINES_H 0x15 /* note: bit[7:6] are reserved */
#define VERTICAL_FRONT_PORCH 0x16
#define VERTICAL_SYNC_WIDTH 0x17
#define VERTICAL_BACK_PORCH 0x18

#define HORIZONTAL_TOTAL_PIXELS_L 0x19
#define HORIZONTAL_TOTAL_PIXELS_H 0x1A /* note: bit[7:6] are reserved */
#define HORIZONTAL_ACTIVE_PIXELS_L 0x1B
#define HORIZONTAL_ACTIVE_PIXELS_H 0x1C /* note: bit[7:6] are reserved */
#define HORIZONTAL_FRONT_PORCH_L 0x1D
#define HORIZONTAL_FRONT_PORCH_H 0x1E /* note: bit[7:4] are reserved */
#define HORIZONTAL_SYNC_WIDTH_L 0x1F
#define HORIZONTAL_SYNC_WIDTH_H 0x20 /* note: bit[7:4] are reserved */
#define HORIZONTAL_BACK_PORCH_L 0x21
#define HORIZONTAL_BACK_PORCH_H 0x22 /* note: bit[7:4] are reserved */

/******** END of I2C Address 0x72 *********/
/***************************************************************/
/* Register definition of device address 0x7e */

#define I2C_ADDR_7E_FLASH_CONTROLLER 0x7E

#define XTAL_FRQ_SEL 0x3F
/* bit field positions */
#define XTAL_FRQ_SEL_POS 5
/* bit field values */
#define XTAL_FRQ_19M2 (0 << XTAL_FRQ_SEL_POS)
#define XTAL_FRQ_27M (4 << XTAL_FRQ_SEL_POS)

#define R_DSC_CTRL_0 0x40
#define READ_STATUS_EN 7
#define CLK_1MEG_RB 6 /* 1MHz clock reset; 0=reset, 0=reset release */
#define DSC_BIST_DONE 1 /* bit[5:1]: 1=DSC MBIST pass */
#define DSC_EN 0x01 /* 1=DSC enabled, 0=DSC disabled */

#define OCM_FW_VERSION 0x31
#define OCM_FW_REVERSION 0x32

#define AP_AUX_ADDR_7_0 0x11
#define AP_AUX_ADDR_15_8 0x12
#define AP_AUX_ADDR_19_16 0x13

/* note: bit[0:3] AUX status, bit 4 op_en, bit 5 address only */
#define AP_AUX_CTRL_STATUS 0x14
#define AP_AUX_CTRL_OP_EN 0x10
#define AP_AUX_CTRL_ADDRONLY 0x20

#define AP_AUX_BUFF_START 0x15
#define PIXEL_CLOCK_L 0x25
#define PIXEL_CLOCK_H 0x26

#define AP_AUX_COMMAND 0x27 /* com+len */
/* bit 0&1: 3D video structure */
/* 0x01: frame packing, 0x02:Line alternative, 0x03:Side-by-side(full) */
#define AP_AV_STATUS 0x28
#define AP_VIDEO_CHG (1<<2)
#define AP_AUDIO_CHG (1<<3)
#define AP_MIPI_MUTE (1<<4) /* 1:MIPI input mute, 0: ummute */
#define AP_MIPI_RX_EN (1<<5) /* 1: MIPI RX input in 0: no RX in */
#define AP_DISABLE_PD (1<<6)
#define AP_DISABLE_DISPLAY (1<<7)
/***************************************************************/
/* Register definition of device address 0x84 */
#define MIPI_PHY_CONTROL_3 0x03
#define MIPI_HS_PWD_CLK 7
#define MIPI_HS_RT_CLK 6
#define MIPI_PD_CLK 5
#define MIPI_CLK_RT_MANUAL_PD_EN 4
#define MIPI_CLK_HS_MANUAL_PD_EN 3
#define MIPI_CLK_DET_DET_BYPASS 2
#define MIPI_CLK_MISS_CTRL 1
#define MIPI_PD_LPTX_CH_MANUAL_PD_EN 0

#define MIPI_LANE_CTRL_0 0x05
#define MIPI_TIME_HS_PRPR 0x08

/* After MIPI RX protocol layer received this many video frames, */
/* protocol layer starts to reconstruct video stream from PHY */
#define MIPI_VIDEO_STABLE_CNT 0x0A

#define MIPI_LANE_CTRL_10 0x0F
#define MIPI_DIGITAL_ADJ_1 0x1B

#define MIPI_PLL_M_NUM_23_16 0x1E
#define MIPI_PLL_M_NUM_15_8 0x1F
#define MIPI_PLL_M_NUM_7_0 0x20
#define MIPI_PLL_N_NUM_23_16 0x21
#define MIPI_PLL_N_NUM_15_8 0x22
#define MIPI_PLL_N_NUM_7_0 0x23

#define MIPI_DIGITAL_PLL_6 0x2A
/* bit[7:6]: VCO band control, only effective */
/* when MIPI_PLL_FORCE_BAND_EN (0x84:0x2B[6]) is 1 */
#define MIPI_M_NUM_READY 0x10
#define MIPI_N_NUM_READY 0x08
#define STABLE_INTEGER_CNT_EN 0x04
#define MIPI_PLL_TEST_BIT 0
/* bit[1:0]: test point output select - */
/* 00: VCO power, 01: dvdd_pdt, 10: dvdd, 11: vcox */

#define MIPI_DIGITAL_PLL_7 0x2B
#define MIPI_PLL_FORCE_N_EN 7
#define MIPI_PLL_FORCE_BAND_EN 6

#define MIPI_PLL_VCO_TUNE_REG 4
/* bit[5:4]: VCO metal capacitance - */
/* 00: +20% fast, 01: +10% fast (default), 10: typical, 11: -10% slow */
#define MIPI_PLL_VCO_TUNE_REG_VAL 0x30

#define MIPI_PLL_PLL_LDO_BIT 2
/* bit[3:2]: vco_v2i power - */
/* 00: 1.40V, 01: 1.45V (default), 10: 1.50V, 11: 1.55V */
#define MIPI_PLL_RESET_N 0x02
#define MIPI_FRQ_FORCE_NDET 0

#define MIPI_ALERT_CLR_0 0x2D
#define HS_link_error_clear 7
/* This bit itself is S/C, and it clears 0x84:0x31[7] */

#define MIPI_ALERT_OUT_0 0x31
#define check_sum_err_hs_sync 7
/* This bit is cleared by 0x84:0x2D[7] */

#define MIPI_DIGITAL_PLL_8 0x33
#define MIPI_POST_DIV_VAL 4
/* n means divided by (n+1), n = 0~15 */
#define MIPI_EN_LOCK_FRZ 3
#define MIPI_FRQ_COUNTER_RST 2
#define MIPI_FRQ_SET_REG_8 1
/* bit 0 is reserved */

#define MIPI_DIGITAL_PLL_9 0x34

#define MIPI_DIGITAL_PLL_16 0x3B
#define MIPI_FRQ_FREEZE_NDET 7
#define MIPI_FRQ_REG_SET_ENABLE 6
#define MIPI_REG_FORCE_SEL_EN 5
#define MIPI_REG_SEL_DIV_REG 4
#define MIPI_REG_FORCE_PRE_DIV_EN 3
/* bit 2 is reserved */
#define MIPI_FREF_D_IND 1
#define REF_CLK_27000kHz 1
#define REF_CLK_19200kHz 0
#define MIPI_REG_PLL_PLL_TEST_ENABLE 0

#define MIPI_DIGITAL_PLL_18 0x3D
#define FRQ_COUNT_RB_SEL 7
#define REG_FORCE_POST_DIV_EN 6
#define MIPI_DPI_SELECT 5
#define SELECT_DSI 1
#define SELECT_DPI 0
#define REG_BAUD_DIV_RATIO 0

#define H_BLANK_L 0x3E
/* for DSC only */
#define H_BLANK_H 0x3F
/* for DSC only; note: bit[7:6] are reserved */
#define MIPI_SWAP 0x4A
#define MIPI_SWAP_CH0 7
#define MIPI_SWAP_CH1 6
#define MIPI_SWAP_CH2 5
#define MIPI_SWAP_CH3 4
#define MIPI_SWAP_CLK 3
/* bit[2:0] are reserved */

/******** END of I2C Address 0x84 *********/

/* DPCD regs */
#define DPCD_DPCD_REV 0x00
#define DPCD_MAX_LINK_RATE 0x01
#define DPCD_MAX_LANE_COUNT 0x02

/********* ANX7625 Register End **********/

/***************** Display *****************/
enum AudioFs {
AUDIO_FS_441K = 0x00,
AUDIO_FS_48K = 0x02,
AUDIO_FS_32K = 0x03,
AUDIO_FS_882K = 0x08,
AUDIO_FS_96K = 0x0a,
AUDIO_FS_1764K = 0x0c,
AUDIO_FS_192K = 0x0e
};

enum AudioWdLen {
AUDIO_W_LEN_16_20MAX = 0x02,
AUDIO_W_LEN_18_20MAX = 0x04,
AUDIO_W_LEN_17_20MAX = 0x0c,
AUDIO_W_LEN_19_20MAX = 0x08,
AUDIO_W_LEN_20_20MAX = 0x0a,
AUDIO_W_LEN_20_24MAX = 0x03,
AUDIO_W_LEN_22_24MAX = 0x05,
AUDIO_W_LEN_21_24MAX = 0x0d,
AUDIO_W_LEN_23_24MAX = 0x09,
AUDIO_W_LEN_24_24MAX = 0x0b
};

#define I2S_CH_2 0x01
#define TDM_CH_4 0x03
#define TDM_CH_6 0x05
#define TDM_CH_8 0x07

#define MAX_DPCD_BUFFER_SIZE 16

#define ONE_BLOCK_SIZE 128
#define FOUR_BLOCK_SIZE (128*4)

struct display_timing {
unsigned int pixelclock;
unsigned int hactive;
unsigned int hfront_porch;
unsigned int hback_porch;
unsigned int hsync_len;
unsigned int vactive;
unsigned int vfront_porch;
unsigned int vback_porch;
unsigned int vsync_len;
};

int anx7625_dp_start(uint8_t bus, const struct edid *edid);
int anx7625_dp_get_edid(uint8_t bus, struct edid *out);
int anx7625_init(uint8_t bus);
#endif /* __ANX7625_H__ */
1 change: 0 additions & 1 deletion src/drivers/aspeed/ast2050/Kconfig
@@ -1,5 +1,4 @@
config DRIVERS_ASPEED_AST2050
bool
select DRIVERS_ASPEED_AST_COMMON
select HAVE_VGA_TEXT_FRAMEBUFFER
select MAINBOARD_HAS_NATIVE_VGA_INIT
19 changes: 12 additions & 7 deletions src/drivers/aspeed/ast2050/ast2050.c
Expand Up @@ -11,7 +11,6 @@
* GNU General Public License for more details.
*/

#include <stdlib.h>
#include <arch/io.h>
#include <edid.h>
#include <console/console.h>
Expand Down Expand Up @@ -48,13 +47,19 @@ static void aspeed_ast2050_init(struct device *dev)
outb(0xa6, 0x3d4); outb(0x2f, 0x3d5);
outb(0xa7, 0x3d4); outb(0x3f, 0x3d5);

/* Initialize standard VGA text mode */
vga_io_init();
vga_textmode_init();
printk(BIOS_INFO, "ASpeed VGA text mode initialized\n");
if (CONFIG(VGA_TEXT_FRAMEBUFFER)) {
/* Initialize standard VGA text mode */
vga_io_init();

/* if we don't have console, at least print something... */
vga_line_write(0, "ASpeed VGA text mode initialized");
vga_textmode_init();
printk(BIOS_INFO, "ASpeed VGA text mode initialized\n");

/* if we don't have console, at least print something... */
vga_line_write(0, "ASpeed VGA text mode initialized");
} else if (CONFIG(GENERIC_LINEAR_FRAMEBUFFER)) {
ast_driver_framebuffer_init(&drm_dev, 0);
printk(BIOS_INFO, "ASpeed high resolution framebuffer initialized\n");
}
}

static struct device_operations aspeed_ast2050_ops = {
Expand Down
5 changes: 4 additions & 1 deletion src/drivers/aspeed/common/Kconfig
@@ -1,3 +1,6 @@
config DRIVERS_ASPEED_AST_COMMON
bool
select VGA
select HAVE_LINEAR_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT
select HAVE_VGA_TEXT_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT
select VGA if VGA_TEXT_FRAMEBUFFER
select SOFTWARE_I2C if GENERIC_LINEAR_FRAMEBUFFER
5 changes: 4 additions & 1 deletion src/drivers/aspeed/common/Makefile.inc
@@ -1 +1,4 @@
ramstage-$(CONFIG_DRIVERS_ASPEED_AST_COMMON) += ast_dp501.c ast_main.c ast_post.c
ifeq ($(CONFIG_DRIVERS_ASPEED_AST_COMMON),y)
ramstage-y += ast_dp501.c ast_main.c ast_post.c
ramstage-$(CONFIG_GENERIC_LINEAR_FRAMEBUFFER) += ast_mode.c ast_i2c.c ast_mode_corebootfb.c
endif
13 changes: 6 additions & 7 deletions src/drivers/aspeed/common/ast_dp501.c
Expand Up @@ -147,7 +147,7 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size)
return false;
}

bool ast_launch_m68k(struct drm_device *dev)
static bool ast_launch_m68k(struct drm_device *dev)
{
struct ast_private *ast = dev->dev_private;
u32 i, data, len = 0;
Expand All @@ -161,7 +161,10 @@ bool ast_launch_m68k(struct drm_device *dev)
if (ast->dp501_fw_addr) {
fw_addr = ast->dp501_fw_addr;
len = 32*1024;
} else if (ast->dp501_fw) {
} else {
if (!ast->dp501_fw)
return false;

fw_addr = (u8 *)ast->dp501_fw->data;
len = ast->dp501_fw->size;
}
Expand Down Expand Up @@ -226,11 +229,7 @@ u8 ast_get_dp501_max_clk(struct drm_device *dev)

/* Read Link Capability */
offset = 0xf014;
data = ast_mindwm(ast, boot_address + offset);
linkcap[0] = (data & 0xff000000) >> 24;
linkcap[1] = (data & 0x00ff0000) >> 16;
linkcap[2] = (data & 0x0000ff00) >> 8;
linkcap[3] = (data & 0x000000ff);
*(u32 *)linkcap = ast_mindwm(ast, boot_address + offset);
if (linkcap[2] == 0) {
linkrate = linkcap[0];
linklanes = linkcap[1];
Expand Down
62 changes: 62 additions & 0 deletions src/drivers/aspeed/common/ast_dram_tables.h
Expand Up @@ -159,4 +159,66 @@ static const struct ast_dramstruct ast2100_dram_table_data[] = {
{ 0xffff, 0xffffffff },
};

/*
* AST2500 DRAM settings modules
*/
#define REGTBL_NUM 17
#define REGIDX_010 0
#define REGIDX_014 1
#define REGIDX_018 2
#define REGIDX_020 3
#define REGIDX_024 4
#define REGIDX_02C 5
#define REGIDX_030 6
#define REGIDX_214 7
#define REGIDX_2E0 8
#define REGIDX_2E4 9
#define REGIDX_2E8 10
#define REGIDX_2EC 11
#define REGIDX_2F0 12
#define REGIDX_2F4 13
#define REGIDX_2F8 14
#define REGIDX_RFC 15
#define REGIDX_PLL 16

static const u32 ast2500_ddr3_1600_timing_table[REGTBL_NUM] = {
0x64604D38, /* 0x010 */
0x29690599, /* 0x014 */
0x00000300, /* 0x018 */
0x00000000, /* 0x020 */
0x00000000, /* 0x024 */
0x02181E70, /* 0x02C */
0x00000040, /* 0x030 */
0x00000024, /* 0x214 */
0x02001300, /* 0x2E0 */
0x0E0000A0, /* 0x2E4 */
0x000E001B, /* 0x2E8 */
0x35B8C105, /* 0x2EC */
0x08090408, /* 0x2F0 */
0x9B000800, /* 0x2F4 */
0x0E400A00, /* 0x2F8 */
0x9971452F, /* tRFC */
0x000071C1 /* PLL */
};

static const u32 ast2500_ddr4_1600_timing_table[REGTBL_NUM] = {
0x63604E37, /* 0x010 */
0xE97AFA99, /* 0x014 */
0x00019000, /* 0x018 */
0x08000000, /* 0x020 */
0x00000400, /* 0x024 */
0x00000410, /* 0x02C */
0x00000101, /* 0x030 */
0x00000024, /* 0x214 */
0x03002900, /* 0x2E0 */
0x0E0000A0, /* 0x2E4 */
0x000E001C, /* 0x2E8 */
0x35B8C106, /* 0x2EC */
0x08080607, /* 0x2F0 */
0x9B000900, /* 0x2F4 */
0x0E400A00, /* 0x2F8 */
0x99714545, /* tRFC */
0x000071C1 /* PLL */
};

#endif
119 changes: 117 additions & 2 deletions src/drivers/aspeed/common/ast_drv.h
Expand Up @@ -46,6 +46,7 @@ enum ast_chip {
AST2150,
AST2300,
AST2400,
AST2500,
AST1180,
};

Expand All @@ -62,6 +63,7 @@ enum ast_tx_chip {
#define AST_DRAM_1Gx32 3
#define AST_DRAM_2Gx16 6
#define AST_DRAM_4Gx16 7
#define AST_DRAM_8Gx16 8

struct ast_fbdev;

Expand Down Expand Up @@ -192,6 +194,8 @@ static inline void ast_open_key(struct ast_private *ast)
#define AST_HWC_SIZE (AST_MAX_HWC_WIDTH*AST_MAX_HWC_HEIGHT*2)
#define AST_HWC_SIGNATURE_SIZE 32

#define EINVAL 22 /* Invalid argument */

#define AST_DEFAULT_HWC_NUM 2
/* define for signature structure */
#define AST_HWC_SIGNATURE_CHECKSUM 0x00
Expand All @@ -202,6 +206,99 @@ static inline void ast_open_key(struct ast_private *ast)
#define AST_HWC_SIGNATURE_HOTSPOTX 0x14
#define AST_HWC_SIGNATURE_HOTSPOTY 0x18

/* ast_mode.c stuff */
struct ast_vbios_stdtable {
u8 misc;
u8 seq[4];
u8 crtc[25];
u8 ar[20];
u8 gr[9];
};

struct ast_vbios_enhtable {
u32 ht;
u32 hde;
u32 hfp;
u32 hsync;
u32 vt;
u32 vde;
u32 vfp;
u32 vsync;
u32 dclk_index;
u32 flags;
u32 refresh_rate;
u32 refresh_rate_index;
u32 mode_id;
};

struct ast_vbios_dclk_info {
u8 param1;
u8 param2;
u8 param3;
};

struct ast_vbios_mode_info {
const struct ast_vbios_stdtable *std_table;
const struct ast_vbios_enhtable *enh_table;
};

#define DRM_MODE_FLAG_NVSYNC 1
#define DRM_MODE_FLAG_PVSYNC 2
#define DRM_MODE_FLAG_NHSYNC 4
#define DRM_MODE_FLAG_PHSYNC 8

struct drm_display_mode {
/* Proposed mode values */
u16 vrefresh; /* in Hz */
u32 clock;
u16 hdisplay;
u16 vdisplay;
u32 flags;

/* Actual mode we give to hw */
u16 crtc_hdisplay;
u16 crtc_htotal;
u16 crtc_hblank_start;
u16 crtc_hblank_end;
u16 crtc_hsync_start;
u16 crtc_hsync_end;
u16 crtc_vtotal;
u16 crtc_vsync_start;
u16 crtc_vsync_end;
u16 crtc_vdisplay;
u16 crtc_vblank_start;
u16 crtc_vblank_end;
};

struct drm_format {
u32 cpp[1]; /* Colors per pixel */
};

struct drm_framebuffer {
u32 pitches[1];
struct drm_format *format;
u32 mmio_addr;
};

struct drm_primary {
struct drm_framebuffer *fb;
};

struct drm_crtc {
struct drm_device *dev;
struct drm_primary *primary;
struct drm_display_mode mode;
};

struct drm_connector {
struct drm_device *dev;
};

enum drm_mode_status {
MODE_NOMODE,
MODE_OK
};

#define AST_MM_ALIGN_SHIFT 4
#define AST_MM_ALIGN_MASK ((1 << AST_MM_ALIGN_SHIFT) - 1)

Expand All @@ -215,11 +312,29 @@ void ast_post_gpu(struct drm_device *dev);
u32 ast_mindwm(struct ast_private *ast, u32 r);
void ast_moutdwm(struct ast_private *ast, u32 r, u32 v);
/* ast dp501 */
int ast_load_dp501_microcode(struct drm_device *dev);
void ast_set_dp501_video_output(struct drm_device *dev, u8 mode);
bool ast_launch_m68k(struct drm_device *dev);
bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size);
bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata);
u8 ast_get_dp501_max_clk(struct drm_device *dev);
void ast_init_3rdtx(struct drm_device *dev);
void ast_release_firmware(struct drm_device *dev);

/* ast mode */
int ast_crtc_mode_set(struct drm_crtc *crtc,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
enum drm_mode_status ast_mode_valid(struct drm_connector *connector,
const unsigned int hdisplay,
const unsigned int vdisplay);
void ast_hide_cursor(struct drm_crtc *crtc);
void ast_set_offset_reg(struct drm_crtc *crtc);
void ast_set_start_address_crt1(struct ast_private *ast, u32 offset);

/* ast_mode_corebootfb */
int ast_driver_framebuffer_init(struct drm_device *dev, int flags);
int ast_crtc_do_set_base(struct drm_crtc *crtc);

/* ast i2c */
int ast_software_i2c_read(struct ast_private *ast_priv, uint8_t edid[128]);

#endif
140 changes: 140 additions & 0 deletions src/drivers/aspeed/common/ast_i2c.c
@@ -0,0 +1,140 @@
/*
* Copied from Linux drivers/gpu/drm/ast/ast_mode.c
*
* Copyright 2012 Red Hat Inc.
* Parts based on xf86-video-ast
* Copyright (c) 2005 ASPEED Technology Inc.
* Copyright Dave Airlie <airlied@redhat.com>
* Copyright 2019 9Elements Agency GmbH <patrick.rudolph@9elements.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*/

#include <delay.h>
#include <device/i2c_simple.h>

#include "ast_drv.h"

static struct ast_private *ast;

#define _GET_INDEX_REG(x) ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, (x))
#define ASPEED_BUS 0

static int get_clock(unsigned int bus)
{
uint32_t val, val2, count, pass;

count = 0;
pass = 0;
val = (_GET_INDEX_REG(0x10) >> 4) & 0x01;
do {
val2 = (_GET_INDEX_REG(0x10) >> 4) & 0x01;
if (val == val2) {
pass++;
} else {
pass = 0;
val = (_GET_INDEX_REG(0x10) >> 4) & 0x01;
}
} while ((pass < 5) && (count++ < 0x10000));

return val & 1 ? 1 : 0;
}

static int get_data(unsigned int bus)
{
uint32_t val, val2, count, pass;

count = 0;
pass = 0;
val = (_GET_INDEX_REG(0x20) >> 5) & 0x01;
do {
val2 = (_GET_INDEX_REG(0x20) >> 5) & 0x01;
if (val == val2) {
pass++;
} else {
pass = 0;
val = (_GET_INDEX_REG(0x20) >> 5) & 0x01;
}
} while ((pass < 5) && (count++ < 0x10000));

return val & 1 ? 1 : 0;
}

static void set_clock(unsigned int bus, int clock)
{
int i;
u8 ujcrb7, jtemp;

for (i = 0; i < 0x10000; i++) {
ujcrb7 = ((clock & 0x01) ? 0 : 1);
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, ujcrb7);
jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01);
if (ujcrb7 == jtemp)
break;
}
}

static void set_data(unsigned int bus, int data)
{
int i;
u8 ujcrb7, jtemp;

for (i = 0; i < 0x10000; i++) {
ujcrb7 = ((data & 0x01) ? 0 : 1) << 2;
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, ujcrb7);
jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04);
if (ujcrb7 == jtemp)
break;
}
}

static struct software_i2c_ops ast_ops = {
.set_sda = set_data,
.set_scl = set_clock,
.get_sda = get_data,
.get_scl = get_clock,
};

int ast_software_i2c_read(struct ast_private *ast_priv, uint8_t edid[128])
{
struct software_i2c_ops *backup;
int ret;

backup = software_i2c[ASPEED_BUS];

software_i2c[ASPEED_BUS] = &ast_ops;

ast = ast_priv;

/* Ast POST pulled SDA and SCL low, recover the bus to a known state */
set_clock(ASPEED_BUS, 1);
set_data(ASPEED_BUS, 1);

udelay(100);

/* Need to reset internal EEPROM counter to 0 */
ret = i2c_read_bytes(ASPEED_BUS, 0x50, 0, edid, 128);

software_i2c[ASPEED_BUS] = backup;

return ret;
}
26 changes: 23 additions & 3 deletions src/drivers/aspeed/common/ast_main.c
Expand Up @@ -75,8 +75,10 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
} else {
pci_read_config_dword(ast->dev->pdev, 0x08, &data);
uint8_t revision = data & 0xff;

if (revision >= 0x30) {
if (revision >= 0x40) {
ast->chip = AST2500;
DRM_INFO("AST 2500 detected\n");
} else if (revision >= 0x30) {
ast->chip = AST2400;
DRM_INFO("AST 2400 detected\n");
} else if (revision >= 0x20) {
Expand Down Expand Up @@ -151,6 +153,8 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
ast->support_wide_screen = true;
if (ast->chip == AST2400 && data == 0x100) /* ast1400 */
ast->support_wide_screen = true;
if (ast->chip == AST2500 && data == 0x100) /* ast2510 */
ast->support_wide_screen = true;
}
break;
}
Expand Down Expand Up @@ -241,7 +245,23 @@ static int ast_get_dram_info(struct drm_device *dev)
else
ast->dram_bus_width = 32;

if (ast->chip == AST2300 || ast->chip == AST2400) {
if (ast->chip == AST2500) {
switch (data & 0x03) {
case 0:
ast->dram_type = AST_DRAM_1Gx16;
break;
default:
case 1:
ast->dram_type = AST_DRAM_2Gx16;
break;
case 2:
ast->dram_type = AST_DRAM_4Gx16;
break;
case 3:
ast->dram_type = AST_DRAM_8Gx16;
break;
}
} else if (ast->chip == AST2300 || ast->chip == AST2400) {
switch (data & 0x03) {
case 0:
ast->dram_type = AST_DRAM_512Mx16;
Expand Down
601 changes: 601 additions & 0 deletions src/drivers/aspeed/common/ast_mode.c

Large diffs are not rendered by default.

256 changes: 256 additions & 0 deletions src/drivers/aspeed/common/ast_mode_corebootfb.c
@@ -0,0 +1,256 @@
/*
* Copied from Linux drivers/gpu/drm/ast/ast_mode.c
*
* Copyright 2012 Red Hat Inc.
* Parts based on xf86-video-ast
* Copyright (c) 2005 ASPEED Technology Inc.
* Copyright Dave Airlie <airlied@redhat.com>
* Copyright 2019 9Elements Agency GmbH <patrick.rudolph@9elements.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*/

#include <edid.h>

#include "ast_drv.h"

/*
* Set framebuffer MMIO address, which must fall into BAR0 MMIO window.
*
* Complete reimplementation as the original expects multiple kernel internal
* subsystems to be present.
*/
int ast_crtc_do_set_base(struct drm_crtc *crtc)
{
struct ast_private *ast = crtc->dev->dev_private;
struct drm_framebuffer *fb = crtc->primary->fb;

/* PCI BAR 0 */
struct resource *res = find_resource(crtc->dev->pdev, 0x10);
if (!res) {
printk(BIOS_ERR, "BAR0 resource not found.\n");
return -EIO;
}

if (res->size < fb->pitches[0] * crtc->mode.vdisplay) {
dev_err(dev->pdev, "Framebuffer doesn't fit into BAR0 MMIO window\n");
return -ENOMEM;
}

fb->mmio_addr = (u32)res2mmio(res, 4095, 4095);

ast_set_offset_reg(crtc);
ast_set_start_address_crt1(ast, fb->mmio_addr);

return 0;
}

static void ast_edid_to_drmmode(struct edid *edid, struct drm_display_mode *mode)
{
memset(mode, 0, sizeof(*mode));

mode->hdisplay = edid->mode.ha;
mode->vdisplay = edid->mode.va;
mode->crtc_hdisplay = edid->mode.ha;
mode->crtc_vdisplay = edid->mode.va;

/* EDID clock is in 10kHz, but drm clock is in KHz */
mode->clock = edid->mode.pixel_clock * 10;
mode->vrefresh = edid->mode.refresh;

mode->crtc_hblank_start = edid->mode.ha;
mode->crtc_hblank_end = edid->mode.ha + edid->mode.hbl;
mode->crtc_hsync_start = edid->mode.ha + edid->mode.hso;
mode->crtc_hsync_end = edid->mode.ha + edid->mode.hso + edid->mode.hspw;
mode->crtc_htotal = mode->crtc_hblank_end;

mode->crtc_vblank_start = edid->mode.va;
mode->crtc_vblank_end = edid->mode.va + edid->mode.vbl;
mode->crtc_vsync_start = edid->mode.va + edid->mode.vso;
mode->crtc_vsync_end = edid->mode.va + edid->mode.vso + edid->mode.vspw;
mode->crtc_vtotal = mode->crtc_vblank_end;

mode->flags = 0;
if (edid->mode.phsync == '+')
mode->flags |= DRM_MODE_FLAG_PHSYNC;
else
mode->flags |= DRM_MODE_FLAG_NHSYNC;

if (edid->mode.pvsync == '+')
mode->flags |= DRM_MODE_FLAG_PVSYNC;
else
mode->flags |= DRM_MODE_FLAG_NVSYNC;
}

static int ast_select_mode(struct drm_connector *connector,
struct edid *edid)
{
struct ast_private *ast = connector->dev->dev_private;
bool widescreen;
u8 raw[128];
bool flags = false;

if (ast->tx_chip_type == AST_TX_DP501) {
ast->dp501_maxclk = 0xff;
flags = ast_dp501_read_edid(connector->dev, (u8 *)raw);
if (flags)
ast->dp501_maxclk = ast_get_dp501_max_clk(connector->dev);
else
dev_err(dev->pdev, "I2C transmission error\n");
}

if (!flags)
ast_software_i2c_read(ast, raw);

if (decode_edid(raw, sizeof(raw), edid) != EDID_CONFORMANT) {
dev_err(dev->pdev, "Failed to decode EDID\n");
printk(BIOS_DEBUG, "Assuming VGA for KVM\n");

memset(edid, 0, sizeof(*edid));

edid->mode.pixel_clock = 6411;
edid->mode.refresh = 60;
edid->mode.ha = 1024;
edid->mode.hspw = 4;
edid->mode.hso = 56;
edid->mode.hbl = 264;
edid->mode.phsync = '-';

edid->mode.va = 768;
edid->mode.vspw = 3;
edid->mode.vso = 1;
edid->mode.vbl = 26;
edid->mode.pvsync = '+';
}

printk(BIOS_DEBUG, "AST: Display has %dpx x %dpx\n", edid->mode.ha, edid->mode.va);

widescreen = !!(((edid->mode.ha * 4) % (edid->mode.va * 3)));

while (ast_mode_valid(connector, edid->mode.ha, edid->mode.va) != MODE_OK) {
/* Select a compatible smaller mode */
if (edid->mode.ha > 1920 && widescreen) {
edid->mode.ha = 1920;
edid->mode.va = 1080;
} else if (edid->mode.ha >= 1920 && widescreen) {
edid->mode.ha = 1680;
edid->mode.va = 1050;
} else if (edid->mode.ha >= 1680 && widescreen) {
edid->mode.ha = 1600;
edid->mode.va = 900;
} else if (edid->mode.ha >= 1680 && !widescreen) {
edid->mode.ha = 1600;
edid->mode.va = 1200;
} else if (edid->mode.ha >= 1600 && widescreen) {
edid->mode.ha = 1440;
edid->mode.va = 900;
} else if (edid->mode.ha >= 1440 && widescreen) {
edid->mode.ha = 1360;
edid->mode.va = 768;
} else if (edid->mode.ha >= 1360 && widescreen) {
edid->mode.ha = 1280;
edid->mode.va = 800;
} else if (edid->mode.ha >= 1360 && !widescreen) {
edid->mode.ha = 1280;
edid->mode.va = 1024;
} else if (edid->mode.ha >= 1280) {
edid->mode.ha = 1024;
edid->mode.va = 768;
} else if (edid->mode.ha >= 1024) {
edid->mode.ha = 800;
edid->mode.va = 600;
} else if (edid->mode.ha >= 800) {
edid->mode.ha = 640;
edid->mode.va = 480;
} else {
dev_err(dev->pdev, "No compatible mode found.\n");

return -EIO;
}
};

return 0;
}

int ast_driver_framebuffer_init(struct drm_device *dev, int flags)
{
struct drm_display_mode adjusted_mode;
struct drm_crtc crtc;
struct drm_format format;
struct drm_primary primary;
struct drm_framebuffer fb;
struct drm_connector connector;
struct edid edid;
int ret;

/* Init wrapper structs */
connector.dev = dev;

format.cpp[0] = 4; /* 32 BPP */
fb.format = &format;

primary.fb = &fb;

crtc.dev = dev;
crtc.primary = &primary;

/* Read EDID and find mode */
ret = ast_select_mode(&connector, &edid);
if (ret) {
dev_err(dev->pdev, "Failed to select mode.\n");
return ret;
}

/* Updated edid for set_vbe_mode_info_valid */
edid.x_resolution = edid.mode.ha;
edid.y_resolution = edid.mode.va;
edid.framebuffer_bits_per_pixel = format.cpp[0] * 8;
edid.bytes_per_line = ALIGN_UP(edid.x_resolution * format.cpp[0], 8);

/* Updated framebuffer info for ast_crtc_mode_set */
fb.pitches[0] = edid.bytes_per_line;

printk(BIOS_DEBUG, "Using framebuffer %dpx x %dpx pitch %d @ %d BPP\n",
edid.x_resolution, edid.y_resolution, edid.bytes_per_line,
edid.framebuffer_bits_per_pixel);

/* Convert EDID to AST DRM mode */
ast_edid_to_drmmode(&edid, &crtc.mode);

memcpy(&adjusted_mode, &crtc.mode, sizeof(crtc.mode));

ret = ast_crtc_mode_set(&crtc, &crtc.mode, &adjusted_mode);
if (ret) {
dev_err(dev->pdev, "Failed to set mode.\n");
return ret;
}

ast_hide_cursor(&crtc);

/* Advertise new mode */
set_vbe_mode_info_valid(&edid, fb.mmio_addr);

/* Clear display */
memset((void *)fb.mmio_addr, 0, edid.bytes_per_line * edid.y_resolution);

return 0;
}
518 changes: 453 additions & 65 deletions src/drivers/aspeed/common/ast_post.c

Large diffs are not rendered by default.

191 changes: 115 additions & 76 deletions src/drivers/aspeed/common/ast_tables.h
Expand Up @@ -49,6 +49,7 @@
#define SyncPN (PVSync | NHSync)
#define SyncNP (NVSync | PHSync)
#define SyncNN (NVSync | NHSync)
#define AST2500PreCatchCRT 0x00004000

/* DCLK Index */
#define VCLK25_175 0x00
Expand Down Expand Up @@ -110,80 +111,110 @@ static struct ast_vbios_dclk_info dclk_table[] = {
{0x3b, 0x2c, 0x81}, /* 1A: VCLK118_25 */
};

static const struct ast_vbios_dclk_info dclk_table_ast2500[] = {
{0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */
{0x95, 0x62, 0x03}, /* 01: VCLK28_322 */
{0x67, 0x63, 0x01}, /* 02: VCLK31_5 */
{0x76, 0x63, 0x01}, /* 03: VCLK36 */
{0xEE, 0x67, 0x01}, /* 04: VCLK40 */
{0x82, 0x62, 0x01}, /* 05: VCLK49_5 */
{0xC6, 0x64, 0x01}, /* 06: VCLK50 */
{0x94, 0x62, 0x01}, /* 07: VCLK56_25 */
{0x80, 0x64, 0x00}, /* 08: VCLK65 */
{0x7B, 0x63, 0x00}, /* 09: VCLK75 */
{0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */
{0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */
{0x8E, 0x62, 0x00}, /* 0C: VCLK108 */
{0x85, 0x24, 0x00}, /* 0D: VCLK135 */
{0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */
{0x6A, 0x22, 0x00}, /* 0F: VCLK162 */
{0x4d, 0x4c, 0x80}, /* 10: VCLK154 */
{0x68, 0x6f, 0x80}, /* 11: VCLK83.5 */
{0x28, 0x49, 0x80}, /* 12: VCLK106.5 */
{0x37, 0x49, 0x80}, /* 13: VCLK146.25 */
{0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */
{0x47, 0x6c, 0x80}, /* 15: VCLK71 */
{0x25, 0x65, 0x80}, /* 16: VCLK88.75 */
{0x58, 0x01, 0x42}, /* 17: VCLK119 */
{0x32, 0x67, 0x80}, /* 18: VCLK85_5 */
{0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */
{0x44, 0x20, 0x43}, /* 1A: VCLK118_25 */
};

static struct ast_vbios_stdtable vbios_stdtable[] = {
/* MD_2_3_400 */
{
0x67,
{0x00,0x03,0x00,0x02},
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
0xff},
{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
0x0c,0x00,0x0f,0x08},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
{0x00, 0x03, 0x00, 0x02},
{0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
0xff},
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x0c, 0x00, 0x0f, 0x08},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00,
0xff}
},
/* Mode12/ExtEGATable */
{
0xe3,
{0x01,0x0f,0x00,0x06},
{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,
0xff},
{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
0x01,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff}
{0x01, 0x0f, 0x00, 0x06},
{0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe9, 0x8b, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
0xff},
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x01, 0x00, 0x0f, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
0xff}
},
/* ExtVGATable */
{
0x2f,
{0x01,0x0f,0x00,0x0e},
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
0xff},
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x01,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
0xff}
{0x01, 0x0f, 0x00, 0x0e},
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
0xff},
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x01, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f,
0xff}
},
/* ExtHiCTable */
{
0x2f,
{0x01,0x0f,0x00,0x0e},
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
0xff},
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x01,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff}
{0x01, 0x0f, 0x00, 0x0e},
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
0xff},
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x01, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
0xff}
},
/* ExtTrueCTable */
{
0x2f,
{0x01,0x0f,0x00,0x0e},
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
{0x01, 0x0f, 0x00, 0x0e},
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
0xff},
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x01,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x01, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
0xff}
},
};

static struct ast_vbios_enhtable res_640x480[] = {
static const struct ast_vbios_enhtable res_640x480[] = {
{ 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175, /* 60Hz */
(SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E },
{ 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5, /* 72Hz */
Expand All @@ -196,7 +227,7 @@ static struct ast_vbios_enhtable res_640x480[] = {
(SyncNN | Charx8Dot) , 0xFF, 4, 0x2E },
};

static struct ast_vbios_enhtable res_800x600[] = {
static const struct ast_vbios_enhtable res_800x600[] = {
{1024, 800, 24, 72, 625, 600, 1, 2, VCLK36, /* 56Hz */
(SyncPP | Charx8Dot), 56, 1, 0x30 },
{1056, 800, 40, 128, 628, 600, 1, 4, VCLK40, /* 60Hz */
Expand All @@ -212,7 +243,7 @@ static struct ast_vbios_enhtable res_800x600[] = {
};


static struct ast_vbios_enhtable res_1024x768[] = {
static const struct ast_vbios_enhtable res_1024x768[] = {
{1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65, /* 60Hz */
(SyncNN | Charx8Dot), 60, 1, 0x31 },
{1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75, /* 70Hz */
Expand All @@ -225,7 +256,7 @@ static struct ast_vbios_enhtable res_1024x768[] = {
(SyncPP | Charx8Dot), 0xFF, 4, 0x31 },
};

static struct ast_vbios_enhtable res_1280x1024[] = {
static const struct ast_vbios_enhtable res_1280x1024[] = {
{1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108, /* 60Hz */
(SyncPP | Charx8Dot), 60, 1, 0x32 },
{1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135, /* 75Hz */
Expand All @@ -236,72 +267,80 @@ static struct ast_vbios_enhtable res_1280x1024[] = {
(SyncPP | Charx8Dot), 0xFF, 3, 0x32 },
};

static struct ast_vbios_enhtable res_1600x1200[] = {
static const struct ast_vbios_enhtable res_1600x1200[] = {
{2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */
(SyncPP | Charx8Dot), 60, 1, 0x33 },
{2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */
(SyncPP | Charx8Dot), 0xFF, 1, 0x33 },
};

/* 16:9 */
static struct ast_vbios_enhtable res_1360x768[] = {
{1792, 1360, 64,112, 795, 768, 3, 6, VCLK85_5, /* 60Hz */
static const struct ast_vbios_enhtable res_1360x768[] = {
{1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* 60Hz */
(SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x39 },
{1792, 1360, 64,112, 795, 768, 3, 6, VCLK85_5, /* end */
(SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x39 },
{1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* end */
(SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 0xFF, 1, 0x39 },
};

static struct ast_vbios_enhtable res_1600x900[] = {
{1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x3A },
{2112, 1600, 88,168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */
static const struct ast_vbios_enhtable res_1600x900[] = {
{1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 60, 1, 0x3A },
{2112, 1600, 88, 168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x3A },
{2112, 1600, 88,168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */
{2112, 1600, 88, 168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x3A },
};

static struct ast_vbios_enhtable res_1920x1080[] = {
static const struct ast_vbios_enhtable res_1920x1080[] = {
{2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x38 },
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 60, 1, 0x38 },
{2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x38 },
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 0xFF, 1, 0x38 },
};


/* 16:10 */
static struct ast_vbios_enhtable res_1280x800[] = {
static const struct ast_vbios_enhtable res_1280x800[] = {
{1440, 1280, 48, 32, 823, 800, 3, 6, VCLK71, /* 60Hz RB */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x35 },
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 60, 1, 0x35 },
{1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x35 },
{1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x35 },

};

static struct ast_vbios_enhtable res_1440x900[] = {
static const struct ast_vbios_enhtable res_1440x900[] = {
{1600, 1440, 48, 32, 926, 900, 3, 6, VCLK88_75, /* 60Hz RB */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 },
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 60, 1, 0x36 },
{1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x36 },
{1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x36 },
};

static struct ast_vbios_enhtable res_1680x1050[] = {
static const struct ast_vbios_enhtable res_1680x1050[] = {
{1840, 1680, 48, 32, 1080, 1050, 3, 6, VCLK119, /* 60Hz RB */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 },
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 60, 1, 0x37 },
{2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x37 },
{2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */
(SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x37 },
};

static struct ast_vbios_enhtable res_1920x1200[] = {
static const struct ast_vbios_enhtable res_1920x1200[] = {
{2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB*/
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x34 },
{2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x34 },
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 60, 1, 0x34 },
{2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB */
(SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
AST2500PreCatchCRT), 0xFF, 1, 0x34 },
};

#endif
2 changes: 1 addition & 1 deletion src/drivers/elog/elog.c
Expand Up @@ -329,7 +329,7 @@ static void elog_nv_write(size_t offset, size_t size)

address = rdev_mmap(rdev, offset, size);

elog_debug("%s(address=0x%p offset=0x%08zx size=%zu)\n", __func__,
elog_debug("%s(address=%p offset=0x%08zx size=%zu)\n", __func__,
address, offset, size);

if (address == NULL)
Expand Down
1 change: 0 additions & 1 deletion src/drivers/emulation/qemu/bochs.c
Expand Up @@ -13,7 +13,6 @@

#include <stdint.h>
#include <edid.h>
#include <stdlib.h>
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
Expand Down
1 change: 0 additions & 1 deletion src/drivers/emulation/qemu/cirrus.c
Expand Up @@ -14,7 +14,6 @@

#include <stdint.h>
#include <edid.h>
#include <stdlib.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
Expand Down
6 changes: 6 additions & 0 deletions src/drivers/generic/cbfs-serial/Kconfig
@@ -0,0 +1,6 @@
config DRIVERS_GENERIC_CBFS_SERIAL
bool "Serial number in CBFS"
default n
help
Enable this option to read the board serial number from a
text file located in CBFS.
1 change: 1 addition & 0 deletions src/drivers/generic/cbfs-serial/Makefile.inc
@@ -0,0 +1 @@
ramstage-$(CONFIG_DRIVERS_GENERIC_CBFS_SERIAL) += cbfs-serial.c
50 changes: 50 additions & 0 deletions src/drivers/generic/cbfs-serial/cbfs-serial.c
@@ -0,0 +1,50 @@
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

#include <cbfs.h>
#include <device/device.h>
#include <smbios.h>
#include <string.h>


#define MAX_SERIAL_LENGTH 0x100

const char *smbios_mainboard_serial_number(void)
{
static char serial_number[MAX_SERIAL_LENGTH + 1] = {0};
struct cbfsf file;

if (serial_number[0] != 0)
return serial_number;

if (cbfs_boot_locate(&file, "serial_number", NULL) == 0) {
struct region_device cbfs_region;
size_t serial_len;

cbfs_file_data(&cbfs_region, &file);

serial_len = region_device_sz(&cbfs_region);
if (serial_len <= MAX_SERIAL_LENGTH) {
if (rdev_readat(&cbfs_region, serial_number, 0,
serial_len) == serial_len) {
serial_number[serial_len] = 0;
return serial_number;
}
}
}

strncpy(serial_number, CONFIG_MAINBOARD_SERIAL_NUMBER,
MAX_SERIAL_LENGTH);

return serial_number;
}
1 change: 0 additions & 1 deletion src/drivers/generic/gfx/gfx.c
Expand Up @@ -19,7 +19,6 @@
#include <device/pci.h>
#include <device/pci_ids.h>
#include <stdint.h>
#include <string.h>

#include "chip.h"

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/generic/ioapic/ioapic.c
Expand Up @@ -32,7 +32,7 @@ static void ioapic_init(struct device *dev)
ioapic_base = config->base;
ioapic_id = config->apicid;

printk(BIOS_DEBUG, "IOAPIC: Initializing IOAPIC at 0x%p\n",
printk(BIOS_DEBUG, "IOAPIC: Initializing IOAPIC at %p\n",
ioapic_base);
printk(BIOS_DEBUG, "IOAPIC: Bootstrap Processor Local APIC = 0x%02x\n",
bsp_lapicid);
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/i2c/designware/dw_i2c.c
Expand Up @@ -743,7 +743,7 @@ int dw_i2c_init(unsigned int bus, const struct dw_i2c_bus_config *bcfg)
/* Enable stop detection interrupt */
write32(&regs->intr_mask, INTR_STAT_STOP_DET);

printk(BIOS_INFO, "DW I2C bus %u at 0x%p (%u KHz)\n",
printk(BIOS_INFO, "DW I2C bus %u at %p (%u KHz)\n",
bus, regs, speed / KHz);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/i2c/ptn3460/ptn3460.h
Expand Up @@ -16,7 +16,7 @@
#ifndef _I2C_PTN3460_H_
#define _I2C_PTN3460_H_

#include <stdint.h>
#include <types.h>

#define PTN_EDID_OFF 0x00
#define PTN_EDID_LEN 0x80
Expand Down
1 change: 1 addition & 0 deletions src/drivers/i2c/rt5663/chip.h
Expand Up @@ -15,6 +15,7 @@
* Realtek RT5663 audio codec devicetree bindings
*/

#include <arch/acpi_device.h>
#include <stdint.h>

struct drivers_i2c_rt5663_config {
Expand Down
1 change: 0 additions & 1 deletion src/drivers/i2c/rtd2132/rtd2132.c
Expand Up @@ -11,7 +11,6 @@
* GNU General Public License for more details.
*/

#include <stdlib.h>
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/i2c/tpm/cr50.c
Expand Up @@ -28,6 +28,7 @@
*/

#include <commonlib/endian.h>
#include <commonlib/helpers.h>
#include <string.h>
#include <types.h>
#include <delay.h>
Expand All @@ -36,7 +37,6 @@
#include <endian.h>
#include <timer.h>
#include <security/tpm/tis.h>
#include <stdlib.h>

#include "tpm.h"

Expand Down Expand Up @@ -341,7 +341,7 @@ static int cr50_i2c_tis_recv(struct tpm_chip *chip, uint8_t *buf,
if (cr50_i2c_wait_burststs(chip, mask, &burstcnt, &status) < 0)
goto out_err;

len = min(burstcnt, expected - current);
len = MIN(burstcnt, expected - current);
if (cr50_i2c_read(chip, addr, buf + current, len) != 0) {
printk(BIOS_ERR, "%s: Read failed\n", __func__);
goto out_err;
Expand Down Expand Up @@ -400,7 +400,7 @@ static int cr50_i2c_tis_send(struct tpm_chip *chip, uint8_t *buf, size_t len)

/* Use burstcnt - 1 to account for the address byte
* that is inserted by cr50_i2c_write() */
limit = min(burstcnt - 1, len);
limit = MIN(burstcnt - 1, len);
if (cr50_i2c_write(chip, TPM_DATA_FIFO(chip->vendor.locality),
&buf[sent], limit) != 0) {
printk(BIOS_ERR, "%s: Write failed\n", __func__);
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/i2c/tpm/tis_atmel.c
Expand Up @@ -14,13 +14,13 @@

#include <assert.h>
#include <commonlib/endian.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <delay.h>
#include <device/i2c_simple.h>
#include <endian.h>
#include <lib.h>
#include <security/tpm/tis.h>
#include <stdlib.h>
#include <timer.h>
#include <types.h>

Expand Down Expand Up @@ -99,7 +99,7 @@ int tis_sendrecv(const uint8_t *sendbuf, size_t sbuf_size,
return -1;

/* Determine the number of bytes remaining */
recv_bytes = min(be32_to_cpu(*(uint32_t *)&header->length),
recv_bytes = MIN(be32_to_cpu(*(uint32_t *)&header->length),
max_recv_bytes);

/* Determine if there is additional response data */
Expand Down
5 changes: 1 addition & 4 deletions src/drivers/intel/fsp1_1/Kconfig
Expand Up @@ -15,6 +15,7 @@ config PLATFORM_USES_FSP1_1
bool
select UEFI_2_4_BINDING
select INTEL_GMA_ADD_VBT if RUN_FSP_GOP
select MICROCODE_UPDATE_PRE_RAM
help
Does the code require the Intel Firmware Support Package?

Expand Down Expand Up @@ -82,10 +83,6 @@ config USE_GENERIC_FSP_CAR_INC
The chipset can select this to use a generic cache_as_ram.inc file
that should be good for all FSP based platforms.

config RESET_ON_INVALID_RAMSTAGE_CACHE
bool "Reset the system on S3 wake when ramstage cache invalid."
default n

config SKIP_FSP_CAR
def_bool n
help
Expand Down
23 changes: 8 additions & 15 deletions src/drivers/intel/fsp1_1/fsp_util.c
Expand Up @@ -102,22 +102,22 @@ void print_fsp_info(FSP_INFO_HEADER *fsp_header)
(u8)(fsp_header->ImageRevision & 0xff));
#if CONFIG(DISPLAY_FSP_ENTRY_POINTS)
printk(BIOS_SPEW, "FSP Entry Points:\n");
printk(BIOS_SPEW, " 0x%p: Image Base\n", fsp_base);
printk(BIOS_SPEW, " 0x%p: TempRamInit\n",
printk(BIOS_SPEW, " %p: Image Base\n", fsp_base);
printk(BIOS_SPEW, " %p: TempRamInit\n",
&fsp_base[fsp_header->TempRamInitEntryOffset]);
printk(BIOS_SPEW, " 0x%p: FspInit\n",
printk(BIOS_SPEW, " %p: FspInit\n",
&fsp_base[fsp_header->FspInitEntryOffset]);
if (fsp_header->HeaderRevision >= FSP_HEADER_REVISION_2) {
printk(BIOS_SPEW, " 0x%p: MemoryInit\n",
printk(BIOS_SPEW, " %p: MemoryInit\n",
&fsp_base[fsp_header->FspMemoryInitEntryOffset]);
printk(BIOS_SPEW, " 0x%p: TempRamExit\n",
printk(BIOS_SPEW, " %p: TempRamExit\n",
&fsp_base[fsp_header->TempRamExitEntryOffset]);
printk(BIOS_SPEW, " 0x%p: SiliconInit\n",
printk(BIOS_SPEW, " %p: SiliconInit\n",
&fsp_base[fsp_header->FspSiliconInitEntryOffset]);
}
printk(BIOS_SPEW, " 0x%p: NotifyPhase\n",
printk(BIOS_SPEW, " %p: NotifyPhase\n",
&fsp_base[fsp_header->NotifyPhaseEntryOffset]);
printk(BIOS_SPEW, " 0x%p: Image End\n",
printk(BIOS_SPEW, " %p: Image End\n",
&fsp_base[fsp_header->ImageSize]);
#endif
}
Expand Down Expand Up @@ -280,10 +280,3 @@ void fsp_display_upd_value(const char *name, uint32_t size, uint64_t old,
}
}
}

__attribute__((cdecl)) size_t fsp_write_line(uint8_t *buffer,
size_t number_of_bytes)
{
console_write_line(buffer, number_of_bytes);
return number_of_bytes;
}
2 changes: 1 addition & 1 deletion src/drivers/intel/fsp1_1/hob.c
Expand Up @@ -282,7 +282,7 @@ void print_hob_type_structure(u16 hob_type, void *hob_list_ptr)
* the end of the HOB list
*/
printk(BIOS_DEBUG, "\n=== FSP HOB Data Structure ===\n");
printk(BIOS_DEBUG, "0x%p: hob_list_ptr\n", hob_list_ptr);
printk(BIOS_DEBUG, "%p: hob_list_ptr\n", hob_list_ptr);
do {
EFI_HOB_GENERIC_HEADER *current_header_ptr =
(EFI_HOB_GENERIC_HEADER *)current_hob;
Expand Down
1 change: 0 additions & 1 deletion src/drivers/intel/fsp1_1/include/fsp/car.h
Expand Up @@ -14,7 +14,6 @@
#ifndef FSP1_1_CAR_H
#define FSP1_1_CAR_H

#include <arch/cpu.h>
#include <fsp/api.h>
#include <stdint.h>

Expand Down
3 changes: 2 additions & 1 deletion src/drivers/intel/fsp1_1/include/fsp/ramstage.h
Expand Up @@ -26,14 +26,15 @@ void fsp_load(void);
/* Perform Intel silicon init. */
void intel_silicon_init(void);
void fsp_run_silicon_init(FSP_INFO_HEADER *fsp_info_header, int is_s3_wakeup);
const struct cbmem_entry *fsp_load_logo(UINT32 *logo_ptr, UINT32 *logo_size);
/* Called after the silicon init code has run. */
void soc_after_silicon_init(void);
/* Initialize UPD data before SiliconInit call. */
void soc_silicon_init_params(SILICON_INIT_UPD *params);
void mainboard_silicon_init_params(SILICON_INIT_UPD *params);
void soc_display_silicon_init_params(const SILICON_INIT_UPD *old,
SILICON_INIT_UPD *new);
void load_logo(SILICON_INIT_UPD *params);
const struct cbmem_entry *soc_load_logo(SILICON_INIT_UPD *params);
void load_vbt(uint8_t s3_resume, SILICON_INIT_UPD *params);

#endif /* _INTEL_COMMON_RAMSTAGE_H_ */
1 change: 0 additions & 1 deletion src/drivers/intel/fsp1_1/include/fsp/romstage.h
Expand Up @@ -16,7 +16,6 @@

#include <stddef.h>
#include <stdint.h>
#include <arch/cpu.h>
#include <memory_info.h>
#include <fsp/car.h>
#include <fsp/util.h>
Expand Down
9 changes: 0 additions & 9 deletions src/drivers/intel/fsp1_1/include/fsp/util.h
Expand Up @@ -96,15 +96,6 @@ void *get_first_hob(uint16_t type);
void *get_next_guid_hob(const EFI_GUID *guid, const void *hob_start);
void *get_first_guid_hob(const EFI_GUID *guid);

/*
* Writes number_of_bytes data bytes from buffer to the console.
* The number of bytes actually written to the console is returned.
*
* If number_of_bytes is zero, don't output any data but instead wait until
* the console has output all data, then return 0.
*/
__attribute__((cdecl)) size_t fsp_write_line(uint8_t *buffer,
size_t number_of_bytes);

asmlinkage void chipset_teardown_car_main(void);

Expand Down