Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4561
-gerrit
commit 933c332472e5883331496cf098a80e159e03de5a
Author: Idwer Vollering <vidwer(a)gmail.com>
Date: Tue Mar 11 15:36:21 2014 +0000
Make POST device configurable.
Change-Id: If92b50ab3888518228d2d3b76f5c50c4aef968dd
Signed-off-by: Idwer Vollering <vidwer(a)gmail.com>
---
src/console/Kconfig | 45 ++++++++++++++++++--------
src/console/post.c | 4 +--
src/cpu/intel/fsp_model_206ax/cache_as_ram.inc | 4 +--
src/include/cpu/x86/post_code.h | 4 +--
4 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/src/console/Kconfig b/src/console/Kconfig
index bb64f29..d77bb9e 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -303,16 +303,6 @@ config NO_POST
bool "Don't show any POST codes"
default n
-
-config CONSOLE_POST
- bool "Show POST codes on the debug console"
- depends on !NO_POST
- default n
- help
- If enabled, coreboot will additionally print POST codes (which are
- usually displayed using a so-called "POST card" ISA/PCI/PCI-E
- device) on the debug console.
-
config CMOS_POST
bool "Store post codes in CMOS for debugging"
depends on !NO_POST && PC80_SYSTEM
@@ -339,15 +329,42 @@ config CMOS_POST_EXTRA
This will enable extra logging of work that happens between post
codes into CMOS for debug. This uses an additional 8 bytes of CMOS.
-config IO_POST
+config POST_IO
+ bool "Show POST codes on the debug console"
+ depends on !NO_POST
+ default n
+ help
+ If enabled, coreboot will additionally print POST codes (which are
+ usually displayed using a so-called "POST card" ISA/PCI/PCI-E
+ device) on the debug console.
+
+config POST_DEVICE
+ bool "Send POST codes to an external device"
+ depends on !NO_POST
+ default y
+
+choice
+ prompt "Device to send POST codes to"
+ depends on POST_DEVICE
+ default POST_DEVICE_NONE
+
+config POST_DEVICE_NONE
+ bool "None"
+config POST_DEVICE_LPC
+ bool "LPC"
+config POST_DEVICE_PCI_PCIE
+ bool "PCI/PCIe"
+endchoice
+
+config POST_IO
bool "Send POST codes to an IO port"
- depends on PC80_SYSTEM
+ depends on PC80_SYSTEM && !NO_POST
default y
help
If enabled, POST codes will be written to an IO port.
-config IO_POST_PORT
- depends on IO_POST
+config POST_IO_PORT
+ depends on POST_IO
hex "IO port for POST codes"
default 0x80
help
diff --git a/src/console/post.c b/src/console/post.c
index 35cc0e8..ef1a3a5 100644
--- a/src/console/post.c
+++ b/src/console/post.c
@@ -161,8 +161,8 @@ void post_code(uint8_t value)
#if CONFIG_CMOS_POST
cmos_post_code(value);
#endif
-#if CONFIG_IO_POST
- outb(value, CONFIG_IO_POST_PORT);
+#if CONFIG_POST_IO
+ outb(value, CONFIG_POST_IO_PORT);
#endif
#endif
mainboard_post(value);
diff --git a/src/cpu/intel/fsp_model_206ax/cache_as_ram.inc b/src/cpu/intel/fsp_model_206ax/cache_as_ram.inc
index 61fb1c2..a269fb9 100644
--- a/src/cpu/intel/fsp_model_206ax/cache_as_ram.inc
+++ b/src/cpu/intel/fsp_model_206ax/cache_as_ram.inc
@@ -251,8 +251,8 @@ halt2:
.Lhlt:
xchg %al, %ah
-#if CONFIG_IO_POST
- outb %al, $CONFIG_IO_POST_PORT
+#if CONFIG_POST_IO
+ outb %al, $CONFIG_POST_IO_PORT
#else
post_code(POST_DEAD_CODE)
#endif
diff --git a/src/include/cpu/x86/post_code.h b/src/include/cpu/x86/post_code.h
index 7465f62..6acfe10 100644
--- a/src/include/cpu/x86/post_code.h
+++ b/src/include/cpu/x86/post_code.h
@@ -2,10 +2,10 @@
#include <console/post_codes.h>
-#if CONFIG_IO_POST
+#if CONFIG_POST_IO
#define post_code(value) \
movb $value, %al; \
- outb %al, $CONFIG_IO_POST_PORT
+ outb %al, $CONFIG_POST_IO_PORT
#else
#define post_code(value)
the following patch was just integrated into master:
commit 62b7ff8b2aafb2e5cd5dcb5488e43a714ca98d23
Author: Chris Douglass <cdouglass.orion(a)gmail.com>
Date: Fri Feb 14 13:51:26 2014 -0500
drivers/spi: Add support for adesto SPI flash parts
Adds support for the following Adesto Technologies
SPI Flash parts.
AT25DF081
AT25DF321
AT25DF641
It has been tested on an Orion VPX7654 board populated
with an AT25DF321A part. The "08" and "64" densities have not
been tested.
These parts are the successors of the Atmel AT26DF line that
was spun out or purchased by Adesto.
In this patch, adesto.c is identical to winbond.c with part
entries for the Adesto parts. The datasheet for the AT25DF parts
includes a "100MHz" programming command in addition to the "85MHz"
command that is currently used but this patch does not add support
for that enhanced programming mode.
Change-Id: If82d075fd9000030480c412c645dcae2c8bb7439
Signed-off-by: Christopher Douglass <cdouglass.orion(a)gmail.com>
See http://review.coreboot.org/5225 for details.
-gerrit
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5379
-gerrit
commit 3772830139f5ea4bc0a1acaeb19cab789c18006b
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon Mar 10 16:13:58 2014 -0500
rmodules: use rmodtool to create rmodules
Start using the rmodtool for generating rmodules.
rmodule_link() has been changed to create 2 rules:
one for the passed in <name>, the other for creating
<name>.rmod which is an ELF file in the format of
an rmodule.
Since the header is not compiled and linked together
with an rmodule there needs to be a way of marking
which symbol is the entry point. __rmodule_entry is
the symbol used for knowing the entry point. There
was a little churn in SMM modules to ensure an
rmodule entry point symbol takes a single argument.
Change-Id: Ie452ed866f6596bf13f137f5b832faa39f48d26e
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
Makefile.inc | 6 +-
src/arch/x86/Makefile.inc | 8 ++-
src/arch/x86/boot/Makefile.inc | 1 -
src/arch/x86/boot/ramstage_module_header.c | 24 -------
src/arch/x86/lib/c_start.S | 2 +
src/cpu/intel/haswell/Makefile.inc | 6 +-
src/cpu/intel/haswell/sipi_header.c | 6 --
src/cpu/intel/haswell/sipi_vector.S | 2 +
src/cpu/intel/haswell/smmrelocate.c | 13 +++-
src/cpu/x86/Makefile.inc | 6 +-
src/cpu/x86/sipi_header.c | 6 --
src/cpu/x86/sipi_vector.S | 2 +
src/cpu/x86/smm/Makefile.inc | 6 +-
src/cpu/x86/smm/smm_module_handler.c | 13 +++-
src/cpu/x86/smm/smm_module_header.c | 24 -------
src/cpu/x86/smm/smm_stub.S | 6 +-
src/include/cpu/x86/smm.h | 12 +++-
src/include/rmodule-defs.h | 24 -------
src/include/rmodule.h | 25 +++-----
src/lib/Makefile.inc | 12 ++--
src/lib/rmodule.c | 86 +++++---------------------
src/lib/rmodule.ld | 66 +++-----------------
src/soc/intel/baytrail/cpu.c | 10 ++-
src/vendorcode/google/chromeos/Makefile.inc | 1 +
src/vendorcode/google/chromeos/vboot_wrapper.c | 9 ++-
25 files changed, 115 insertions(+), 261 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 19ba294..fcd680d 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -252,10 +252,14 @@ build-dirs:
#######################################################################
# Build the tools
CBFSTOOL:=$(obj)/cbfstool
+RMODTOOL:=$(obj)/rmodtool
$(CBFSTOOL): $(objutil)/cbfstool/cbfstool
cp $< $@
+$(RMODTOOL): $(objutil)/cbfstool/rmodtool
+ cp $< $@
+
_WINCHECK=$(shell uname -o 2> /dev/null)
STACK=
ifeq ($(_WINCHECK),Msys)
@@ -390,5 +394,5 @@ crosstools-arm: clean-for-update
crossgcc-clean: clean-for-update
$(MAKE) -C util/crossgcc clean
-tools: $(objutil)/kconfig/conf $(objutil)/cbfstool/cbfstool $(objutil)/nvramtool/nvramtool $(objutil)/romcc/romcc $(objutil)/sconfig/sconfig
+tools: $(objutil)/kconfig/conf $(objutil)/cbfstool/cbfstool $(objutil)/cbfstool/rmodtool $(objutil)/nvramtool/nvramtool $(objutil)/romcc/romcc $(objutil)/sconfig/sconfig
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 4b28697..72bea1e 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -93,7 +93,7 @@ ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD))),)
endif
endif
-$(obj)/coreboot.rom: $(obj)/coreboot.pre $(objcbfs)/coreboot_ram.elf $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES)) $$(INTERMEDIATE) $$(VBOOT_STUB_ELF)
+$(obj)/coreboot.rom: $(obj)/coreboot.pre $(objcbfs)/coreboot_ram.elf $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES)) $$(INTERMEDIATE) $$(VBOOT_STUB)
@printf " CBFS $(subst $(obj)/,,$(@))\n"
cp $(obj)/coreboot.pre $@.tmp
$(CBFSTOOL) $@.tmp add-stage -f $(objcbfs)/coreboot_ram.elf -n $(CONFIG_CBFS_PREFIX)/coreboot_ram -c $(CBFS_COMPRESS_FLAG)
@@ -140,7 +140,7 @@ ifeq ($(CONFIG_INCLUDE_CONFIG_FILE),y)
$(CBFSTOOL) $@.tmp add -f $(obj)/config.tmp -n config -t raw; rm -f $(obj)/config.tmp ; fi
endif
ifeq ($(CONFIG_VBOOT_VERIFY_FIRMWARE),y)
- $(CBFSTOOL) $@.tmp add-stage -f $(VBOOT_STUB_ELF) -n $(CONFIG_CBFS_PREFIX)/vboot -c $(CBFS_COMPRESS_FLAG)
+ $(CBFSTOOL) $@.tmp add-stage -f $(VBOOT_STUB) -n $(CONFIG_CBFS_PREFIX)/vboot -c $(CBFS_COMPRESS_FLAG)
endif
ifeq ($(CONFIG_HAVE_REFCODE_BLOB),y)
$(CBFSTOOL) $@.tmp add-stage -f $(CONFIG_REFCODE_BLOB_FILE) -n $(CONFIG_CBFS_PREFIX)/refcode -c $(CBFS_COMPRESS_FLAG)
@@ -205,6 +205,10 @@ ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y)
$(eval $(call rmodule_link,$(objcbfs)/coreboot_ram.debug, $(objgenerated)/coreboot_ram.o, $(CONFIG_HEAP_SIZE)))
+# The rmodule_link defintion creates an elf file with .rmod extension.
+$(objcbfs)/coreboot_ram.elf: $(objcbfs)/coreboot_ram.debug.rmod
+ cp $< $@
+
else
$(objcbfs)/coreboot_ram.debug: $(objgenerated)/coreboot_ram.o $(src)/arch/x86/coreboot_ram.ld
diff --git a/src/arch/x86/boot/Makefile.inc b/src/arch/x86/boot/Makefile.inc
index 629c644..79c6417 100644
--- a/src/arch/x86/boot/Makefile.inc
+++ b/src/arch/x86/boot/Makefile.inc
@@ -11,7 +11,6 @@ ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += acpi.c
ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += acpigen.c
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S
-ramstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += ramstage_module_header.c
$(obj)/arch/x86/boot/smbios.ramstage.o: $(obj)/build.h
diff --git a/src/arch/x86/boot/ramstage_module_header.c b/src/arch/x86/boot/ramstage_module_header.c
deleted file mode 100644
index b958c16..0000000
--- a/src/arch/x86/boot/ramstage_module_header.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2013 ChromeOS Authors
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <rmodule.h>
-
-extern char _start[];
-
-DEFINE_RMODULE_HEADER(ramstage_module, _start, RMODULE_TYPE_STAGE);
diff --git a/src/arch/x86/lib/c_start.S b/src/arch/x86/lib/c_start.S
index 01ffa7c..faea22d 100644
--- a/src/arch/x86/lib/c_start.S
+++ b/src/arch/x86/lib/c_start.S
@@ -19,6 +19,8 @@ thread_stacks:
.section ".textfirst", "ax", @progbits
.code32
.globl _start
+ .globl __rmodule_entry
+__rmodule_entry:
_start:
cli
lgdt %cs:gdtaddr
diff --git a/src/cpu/intel/haswell/Makefile.inc b/src/cpu/intel/haswell/Makefile.inc
index 60c061d..63c1939 100644
--- a/src/cpu/intel/haswell/Makefile.inc
+++ b/src/cpu/intel/haswell/Makefile.inc
@@ -25,12 +25,12 @@ ramstage-srcs += $(SIPI_BIN)
rmodules-y += sipi_vector.S
rmodules-y += sipi_header.c
-$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules.o $(dir $(SIPI_ELF))sipi_header.rmodules.o
+$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules.o
$(CC) $(LDFLAGS) -nostdlib -r -o $@ $^
-$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_ELF:.elf=.o), 0))
+$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO), 0))
-$(SIPI_BIN): $(SIPI_ELF)
+$(SIPI_BIN): $(SIPI_ELF).rmod
$(OBJCOPY) -O binary $< $@
$(SIPI_BIN).ramstage.o: $(SIPI_BIN)
diff --git a/src/cpu/intel/haswell/sipi_header.c b/src/cpu/intel/haswell/sipi_header.c
deleted file mode 100644
index 846a82d..0000000
--- a/src/cpu/intel/haswell/sipi_header.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <rmodule.h>
-
-
-extern void *ap_start;
-
-DEFINE_RMODULE_HEADER(sipi_vector_header, ap_start, RMODULE_TYPE_SIPI_VECTOR);
diff --git a/src/cpu/intel/haswell/sipi_vector.S b/src/cpu/intel/haswell/sipi_vector.S
index 664a9ee..e0abb7c 100644
--- a/src/cpu/intel/haswell/sipi_vector.S
+++ b/src/cpu/intel/haswell/sipi_vector.S
@@ -58,6 +58,8 @@ apic_to_cpu_num:
.text
.code16
.global ap_start
+.global __rmodule_entry
+__rmodule_entry:
ap_start:
cli
xorl %eax, %eax
diff --git a/src/cpu/intel/haswell/smmrelocate.c b/src/cpu/intel/haswell/smmrelocate.c
index 3f4f45a..dfbcf2e 100644
--- a/src/cpu/intel/haswell/smmrelocate.c
+++ b/src/cpu/intel/haswell/smmrelocate.c
@@ -164,11 +164,18 @@ static int bsp_setup_msr_save_state(struct smm_relocation_params *relo_params)
/* The relocation work is actually performed in SMM context, but the code
* resides in the ramstage module. This occurs by trampolining from the default
* SMRAM entry point to here. */
-static void asmlinkage
-cpu_smm_do_relocation(void *arg, int cpu, const struct smm_runtime *runtime)
+static void asmlinkage cpu_smm_do_relocation(void *arg)
{
msr_t mtrr_cap;
- struct smm_relocation_params *relo_params = arg;
+ struct smm_relocation_params *relo_params;
+ const struct smm_module_params *p;
+ const struct smm_runtime *runtime;
+ int cpu;
+
+ p = arg;
+ runtime = p->runtime;
+ relo_params = p->arg;
+ cpu = p->cpu;
if (cpu >= CONFIG_MAX_CPUS) {
printk(BIOS_CRIT,
diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc
index 277ba48..c0b50c5 100644
--- a/src/cpu/x86/Makefile.inc
+++ b/src/cpu/x86/Makefile.inc
@@ -6,6 +6,7 @@ ramstage-$(CONFIG_PARALLEL_MP) += mp_init.c
ramstage-$(CONFIG_MIRROR_PAYLOAD_TO_RAM_BEFORE_LOADING) += mirror_payload.c
SIPI_ELF=$(obj)/cpu/x86/sipi_vector.elf
+SIPI_RMOD=$(SIPI_ELF).rmod
SIPI_BIN=$(SIPI_ELF:.elf=)
SIPI_DOTO=$(SIPI_ELF:.elf=.o)
@@ -13,14 +14,13 @@ ifeq ($(CONFIG_PARALLEL_MP),y)
ramstage-srcs += $(SIPI_BIN)
endif
rmodules-$(CONFIG_PARALLEL_MP) += sipi_vector.S
-rmodules-$(CONFIG_PARALLEL_MP) += sipi_header.c
-$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules.o $(dir $(SIPI_ELF))sipi_header.rmodules.o
+$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules.o
$(CC) $(LDFLAGS) -nostdlib -r -o $@ $^
$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_ELF:.elf=.o), 0))
-$(SIPI_BIN): $(SIPI_ELF)
+$(SIPI_BIN): $(SIPI_RMOD)
$(OBJCOPY) -O binary $< $@
$(SIPI_BIN).ramstage.o: $(SIPI_BIN)
diff --git a/src/cpu/x86/sipi_header.c b/src/cpu/x86/sipi_header.c
deleted file mode 100644
index 846a82d..0000000
--- a/src/cpu/x86/sipi_header.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <rmodule.h>
-
-
-extern void *ap_start;
-
-DEFINE_RMODULE_HEADER(sipi_vector_header, ap_start, RMODULE_TYPE_SIPI_VECTOR);
diff --git a/src/cpu/x86/sipi_vector.S b/src/cpu/x86/sipi_vector.S
index 52b12d0..c08c391 100644
--- a/src/cpu/x86/sipi_vector.S
+++ b/src/cpu/x86/sipi_vector.S
@@ -58,6 +58,8 @@ ap_count:
.text
.code16
.global ap_start
+.global __rmodule_entry
+__rmodule_entry:
ap_start:
cli
xorl %eax, %eax
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc
index 8dcd130..bb9c11d 100644
--- a/src/cpu/x86/smm/Makefile.inc
+++ b/src/cpu/x86/smm/Makefile.inc
@@ -21,10 +21,8 @@ ramstage-$(CONFIG_BACKUP_DEFAULT_SMM_REGION) += backup_default_smm.c
ifeq ($(CONFIG_SMM_MODULES),y)
smmstub-y += smm_stub.S
-smmstub-y += smm_module_header.c
smm-y += smiutil.c
-smm-y += smm_module_header.c
smm-y += smm_module_handler.c
ramstage-y += smm_module_loader.c
@@ -40,7 +38,7 @@ $(obj)/cpu/x86/smm/smmstub.o: $$(smmstub-objs)
# Link the SMM stub module with a 0-byte heap.
$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smmstub.elf, $(obj)/cpu/x86/smm/smmstub.o, 0))
-$(obj)/cpu/x86/smm/smmstub: $(obj)/cpu/x86/smm/smmstub.elf
+$(obj)/cpu/x86/smm/smmstub: $(obj)/cpu/x86/smm/smmstub.elf.rmod
$(OBJCOPY) -O binary $< $@
$(obj)/cpu/x86/smm/smmstub.ramstage.o: $(obj)/cpu/x86/smm/smmstub
@@ -55,7 +53,7 @@ $(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME)
$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smm.elf, $(obj)/cpu/x86/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE)))
-$(obj)/cpu/x86/smm/smm: $(obj)/cpu/x86/smm/smm.elf
+$(obj)/cpu/x86/smm/smm: $(obj)/cpu/x86/smm/smm.elf.rmod
$(OBJCOPY) -O binary $< $@
$(obj)/cpu/x86/smm/smm.ramstage.o: $(obj)/cpu/x86/smm/smm
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c
index 444e335..79863d8 100644
--- a/src/cpu/x86/smm/smm_module_handler.c
+++ b/src/cpu/x86/smm/smm_module_handler.c
@@ -20,6 +20,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
+#include <rmodule.h>
typedef enum { SMI_LOCKED, SMI_UNLOCKED } smi_semaphore;
@@ -113,8 +114,16 @@ void *smm_get_save_state(int cpu)
return base;
}
-void smm_handler_start(void *arg, int cpu, const struct smm_runtime *runtime)
+void asmlinkage smm_handler_start(void *arg)
{
+ const struct smm_module_params *p;
+ const struct smm_runtime *runtime;
+ int cpu;
+
+ p = arg;
+ runtime = p->runtime;
+ cpu = p->cpu;
+
/* Make sure to set the global runtime. It's OK to race as the value
* will be the same across CPUs as well as multiple SMIs. */
if (smm_runtime == NULL)
@@ -157,6 +166,8 @@ void smm_handler_start(void *arg, int cpu, const struct smm_runtime *runtime)
smi_set_eos();
}
+RMODULE_ENTRY(smm_handler_start);
+
/* Provide a default implementation for all weak handlers so that relocation
* entries in the modules make sense. Without default implementations the
* weak relocations w/o a symbol have a 0 address which is where the modules
diff --git a/src/cpu/x86/smm/smm_module_header.c b/src/cpu/x86/smm/smm_module_header.c
deleted file mode 100644
index 3ee654f..0000000
--- a/src/cpu/x86/smm/smm_module_header.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2013 ChromeOS Authors
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <rmodule.h>
-
-extern char smm_handler_start[];
-
-DEFINE_RMODULE_HEADER(smm_module, smm_handler_start, RMODULE_TYPE_SMM);
diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S
index 07eb5dc..083cb57 100644
--- a/src/cpu/x86/smm/smm_stub.S
+++ b/src/cpu/x86/smm/smm_stub.S
@@ -61,6 +61,8 @@ fallback_stack_top:
.text
.code16
.global smm_handler_start
+.global __rmodule_entry
+__rmodule_entry:
smm_handler_start:
movl $(smm_relocate_gdt), %ebx
data32 lgdt (%ebx)
@@ -132,11 +134,13 @@ smm_trampoline32:
2:
/* Call into the c-based SMM relocation function with the platform
* parameters. Equivalent to:
- * c_handler(c_handler_params, cpu_num, smm_runtime);
+ * struct arg = { c_handler_params, cpu_num, smm_runtime {;
+ * c_handler(&arg)
*/
push $(smm_runtime)
push %ecx
push c_handler_arg
+ push %esp
mov c_handler, %eax
call *%eax
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index 3ab43ff..f63420f 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -517,14 +517,20 @@ struct smm_runtime {
u8 apic_id_to_cpu[CONFIG_MAX_CPUS];
} __attribute__ ((packed));
-typedef void asmlinkage (*smm_handler_t)(void *arg, int cpu,
- const struct smm_runtime *runtime);
+struct smm_module_params {
+ void *arg;
+ int cpu;
+ const struct smm_runtime *runtime;
+};
+
+/* smm_handler_t is called with arg of smm_module_params pointer. */
+typedef void asmlinkage (*smm_handler_t)(void *);
#ifdef __SMM__
/* SMM Runtime helpers. */
/* Entry point for SMM modules. */
-void smm_handler_start(void *arg, int cpu, const struct smm_runtime *runtime);
+void asmlinkage smm_handler_start(void *params);
/* Retrieve SMM save state for a given CPU. WARNING: This does not take into
* account CPUs which are configured to not save their state to RAM. */
diff --git a/src/include/rmodule-defs.h b/src/include/rmodule-defs.h
index ee2d3f7..4139ef3 100644
--- a/src/include/rmodule-defs.h
+++ b/src/include/rmodule-defs.h
@@ -25,30 +25,6 @@
#define RMODULE_MAGIC 0xf8fe
#define RMODULE_VERSION_1 1
-#define FIELD_ENTRY(x_) ((uint32_t)&x_)
-#define RMODULE_HEADER(entry_, type_) \
-{ \
- .magic = RMODULE_MAGIC, \
- .version = RMODULE_VERSION_1, \
- .type = type_, \
- .payload_begin_offset = FIELD_ENTRY(_payload_begin_offset), \
- .payload_end_offset = FIELD_ENTRY(_payload_end_offset), \
- .relocations_begin_offset = \
- FIELD_ENTRY(_relocations_begin_offset), \
- .relocations_end_offset = \
- FIELD_ENTRY(_relocations_end_offset), \
- .module_link_start_address = \
- FIELD_ENTRY(_module_link_start_addr), \
- .module_program_size = FIELD_ENTRY(_module_program_size), \
- .module_entry_point = FIELD_ENTRY(entry_), \
- .parameters_begin = FIELD_ENTRY(_module_params_begin), \
- .parameters_end = FIELD_ENTRY(_module_params_end), \
- .bss_begin = FIELD_ENTRY(_bss), \
- .bss_end = FIELD_ENTRY(_ebss), \
-}
-
-/* Private data structures below should not be used directly. */
-
/* All fields with '_offset' in the name are byte offsets into the flat blob.
* The linker and the linker script takes are of assigning the values. */
struct rmodule_header {
diff --git a/src/include/rmodule.h b/src/include/rmodule.h
index 2147ab0..d229cf8 100644
--- a/src/include/rmodule.h
+++ b/src/include/rmodule.h
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <stddef.h>
+#include <string.h>
#include <rmodule-defs.h>
enum {
@@ -50,11 +51,6 @@ int rmodule_load_alignment(const struct rmodule *m);
int rmodule_calc_region(unsigned int region_alignment, size_t rmodule_size,
size_t *region_size, int *load_offset);
-#define DEFINE_RMODULE_HEADER(name_, entry_, type_) \
- struct rmodule_header name_ \
- __attribute__ ((section (".module_header"))) = \
- RMODULE_HEADER(entry_, type_)
-
/* Support for loading rmodule stages. This API is only available when
* using dynamic cbmem because it uses the dynamic cbmem API to obtain
* the backing store region for the stage. */
@@ -84,17 +80,12 @@ struct rmodule {
void *relocations;
};
-/* These are the symbols assumed that every module contains. The linker script
- * provides these symbols. */
-extern char _relocations_begin_offset[];
-extern char _relocations_end_offset[];
-extern char _payload_end_offset[];
-extern char _payload_begin_offset[];
-extern char _bss[];
-extern char _ebss[];
-extern char _module_program_size[];
-extern char _module_link_start_addr[];
-extern char _module_params_begin[];
-extern char _module_params_end[];
+#if IS_ENABLED(CONFIG_RELOCATABLE_MODULES)
+/* Rmodules have an entry point of named __rmodule_entry. */
+#define RMODULE_ENTRY(entry_) \
+ void __rmodule_entry(void *) __attribute__((alias (STRINGIFY(entry_))))
+#else
+#define RMODULE_ENTRY(entry_)
+#endif
#endif /* RMODULE_H */
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index acd334e..93babd3 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -133,17 +133,21 @@ ramstage-y += rmodule.c
romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld
-RMODULE_LDFLAGS := -nostartfiles -shared -z defs -nostdlib -Bsymbolic -T $(RMODULE_LDSCRIPT)
+RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic -Wl,-T,$(RMODULE_LDSCRIPT)
# rmodule_link_rules is a function that should be called with:
# (1) the object name to link
# (2) the dependencies
# (3) heap size of the relocatable module
-# It will create the necessary Make rules.
+# It will create the necessary Make rules to create a rmodule. The resulting
+# rmdoule is named $(1).rmod
define rmodule_link
-$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions
- $$(LD) $$(RMODULE_LDFLAGS) --defsym=__heap_size=$(strip $(3)) -o $$@ $(strip $(2))
+$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions $$(RMODTOOL)
+ $$(CC) $$(CFLAGS) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME) -Wl,--end-group
$$(NM) -n $$@ > $$(basename $$(a)).map
+
+$(strip $(1)).rmod: $(strip $(1))
+ $$(RMODTOOL) -i $$^ -o $$@
endef
endif
diff --git a/src/lib/rmodule.c b/src/lib/rmodule.c
index 2cb70b8..a73e667 100644
--- a/src/lib/rmodule.c
+++ b/src/lib/rmodule.c
@@ -26,44 +26,6 @@
/* Change this define to get more verbose debugging for module loading. */
#define PK_ADJ_LEVEL BIOS_NEVER
-#if CONFIG_ARCH_X86
-/*
- * On X86, the only relocations currently allowed are R_386_RELATIVE which
- * have '0' for the symbol info in the relocation metadata (in r_info).
- * The reason is that the module is fully linked and just has the relocations'
- * locations.
- */
-typedef struct {
- uint32_t r_offset;
- uint32_t r_info;
-} Elf32_Rel;
-
-#define R_386_RELATIVE 8
-
-#define RELOCTION_ENTRY_SIZE sizeof(Elf32_Rel)
-static inline int rmodule_reloc_offset(const void *reloc)
-{
- const Elf32_Rel *rel = reloc;
- return rel->r_offset;
-}
-
-static inline int rmodule_reloc_valid(const void *reloc)
-{
- const Elf32_Rel *rel = reloc;
- return (rel->r_info == R_386_RELATIVE);
-}
-
-static inline void *remodule_next_reloc(const void *reloc)
-{
- const Elf32_Rel *rel = reloc;
- rel++;
- return (void *)rel;
-}
-
-#else
-#error Arch needs to add relocation information support for RMODULE
-#endif
-
static inline int rmodule_is_loaded(const struct rmodule *module)
{
return module->location != NULL;
@@ -71,7 +33,7 @@ static inline int rmodule_is_loaded(const struct rmodule *module)
/* Calculate a loaded program address based on the blob address. */
static inline void *rmodule_load_addr(const struct rmodule *module,
- uint32_t blob_addr)
+ uintptr_t blob_addr)
{
char *loc = module->location;
return &loc[blob_addr - module->header->module_link_start_address];
@@ -151,13 +113,13 @@ static void rmodule_clear_bss(struct rmodule *module)
memset(begin, 0, size);
}
-static inline int rmodule_number_relocations(const struct rmodule *module)
+static inline size_t rmodule_number_relocations(const struct rmodule *module)
{
- int r;
+ size_t r;
r = module->header->relocations_end_offset;
r -= module->header->relocations_begin_offset;
- r /= RELOCTION_ENTRY_SIZE;
+ r /= sizeof(uintptr_t);
return r;
}
@@ -176,51 +138,33 @@ static void rmodule_copy_payload(const struct rmodule *module)
memcpy(module->location, module->payload, module->payload_size);
}
-static inline uint32_t *rmodule_adjustment_location(const struct rmodule *module,
- const void *reloc)
-{
- int reloc_offset;
-
- /* Don't relocate header field entries -- only program relocations. */
- reloc_offset = rmodule_reloc_offset(reloc);
- if (reloc_offset < module->header->module_link_start_address)
- return NULL;
-
- return rmodule_load_addr(module, reloc_offset);
-}
-
static int rmodule_relocate(const struct rmodule *module)
{
- int num_relocations;
- const void *reloc;
- uint32_t adjustment;
+ size_t num_relocations;
+ const uintptr_t *reloc;
+ uintptr_t adjustment;
/* Each relocation needs to be adjusted relative to the beginning of
* the loaded program. */
- adjustment = (uint32_t)rmodule_load_addr(module, 0);
+ adjustment = (uintptr_t)rmodule_load_addr(module, 0);
reloc = module->relocations;
num_relocations = rmodule_number_relocations(module);
- printk(BIOS_DEBUG, "Processing %d relocs with adjust value of 0x%08x\n",
+ printk(BIOS_DEBUG, "Processing %zu relocs. Offset value of 0x%08x\n",
num_relocations, adjustment);
while (num_relocations > 0) {
- uint32_t *adjust_loc;
-
- if (!rmodule_reloc_valid(reloc))
- return -1;
+ uintptr_t *adjust_loc;
/* If the adjustment location is non-NULL adjust it. */
- adjust_loc = rmodule_adjustment_location(module, reloc);
- if (adjust_loc != NULL) {
- printk(PK_ADJ_LEVEL, "Adjusting %p: 0x%08x -> 0x%08x\n",
+ adjust_loc = rmodule_load_addr(module, *reloc);
+ printk(PK_ADJ_LEVEL, "Adjusting %p: 0x%08x -> 0x%08x\n",
adjust_loc, *adjust_loc,
*adjust_loc + adjustment);
*adjust_loc += adjustment;
- }
- reloc = remodule_next_reloc(reloc);
+ reloc++;
num_relocations--;
}
@@ -232,8 +176,8 @@ int rmodule_load_alignment(const struct rmodule *module)
/* The load alignment is the start of the program's linked address.
* The base address where the program is loaded needs to be a multiple
* of the program's starting link address. That way all data alignment
- * in the program is preserved. */
- return module->header->module_link_start_address;
+ * in the program is preserved. Default to 4KiB. */
+ return 4096;
}
int rmodule_load(void *base, struct rmodule *module)
diff --git a/src/lib/rmodule.ld b/src/lib/rmodule.ld
index 0cdbb2f..9222f3b 100644
--- a/src/lib/rmodule.ld
+++ b/src/lib/rmodule.ld
@@ -1,19 +1,15 @@
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
-OUTPUT_ARCH(i386)
-
/*
* This linker script is used to link rmodules (relocatable modules). It
* links at zero so that relocation fixups are easy when placing the binaries
* anywhere in the address space.
*
* NOTE: The program's loadable sections (text, module_params, and data) are
- * packed into the flat blob using the AT directive. The rmodule loader assumes
- * the entire program resides in one contiguous address space. Therefore,
- * alignment for a given section (if required) needs to be done at the end of
- * the preceeding section. e.g. if the data section should be aligned to an 8
- * byte address the text section should have ALIGN(8) at the end of its section.
- * Otherwise there won't be a consistent mapping between the flat blob and the
- * loaded program.
+ * packed into the flat blob. The rmodule loader assumes the entire program
+ * resides in one contiguous address space. Therefore, alignment for a given
+ * section (if required) needs to be done at the end of the preceeding section.
+ * e.g. if the data section should be aligned to an 8 byte address the text
+ * section should have ALIGN(8) at the end of its section. Otherwise there
+ * won't be a consistent mapping between the flat blob and the loaded program.
*/
BASE_ADDRESS = 0x00000;
@@ -22,21 +18,9 @@ SECTIONS
{
. = BASE_ADDRESS;
- .header : AT (0) {
- *(.module_header);
- . = ALIGN(8);
- }
-
- /* Align the start of the module program to a large enough alignment
- * so that any data in the program with an alignement property is met.
- * Essentially, this alignment is the maximum possible data alignment
- * property a program can have. */
- . = ALIGN(4096);
- _module_link_start_addr = .;
- _payload_begin_offset = LOADADDR(.header) + SIZEOF(.header);
-
- .payload : AT (_payload_begin_offset) {
+ .payload : {
/* C code of the module. */
+ _ram_seg = .;
*(.textfirst);
*(.text);
*(.text.*);
@@ -88,9 +72,6 @@ SECTIONS
. = ALIGN(8);
}
- /* _payload_end marks the end of the module's code and data. */
- _payload_end_offset = LOADADDR(.payload) + SIZEOF(.payload);
-
.bss (NOLOAD) : {
/* C uninitialized data of the module. */
_bss = .;
@@ -107,38 +88,11 @@ SECTIONS
_heap = .;
. = . + __heap_size;
_eheap = .;
+ _eram_seg = .;
}
- /* _module_program_size is the total memory used by the program. */
- _module_program_size = _eheap - _module_link_start_addr;
-
- /* coreboot's ramstage uses the _ram_seg and _eram_seg symbols
- * for determining its load location. Provide those to help it out.
- * It's a nop for any non-ramstage rmodule. */
- _ram_seg = _module_link_start_addr;
- _eram_seg = _module_link_start_addr + _module_program_size;
-
- /* The relocation information is linked on top of the BSS section
- * because the BSS section takes no space on disk. The relocation data
- * resides directly after the data section in the flat binary. */
- .relocations ADDR(.bss) : AT (_payload_end_offset) {
- *(.rel.*);
- }
- _relocations_begin_offset = LOADADDR(.relocations);
- _relocations_end_offset = _relocations_begin_offset +
- SIZEOF(.relocations);
-
/DISCARD/ : {
- /* Drop unnecessary sections. Since these modules are linked
- * as shared objects there are dynamic sections. These sections
- * aren't needed so drop them. */
- *(.comment);
- *(.note);
- *(.note.*);
- *(.dynamic);
- *(.dynsym);
- *(.dynstr);
- *(.gnu.hash);
+ /* Drop unnecessary sections. */
*(.eh_frame);
}
}
diff --git a/src/soc/intel/baytrail/cpu.c b/src/soc/intel/baytrail/cpu.c
index 1226e47..c550531 100644
--- a/src/soc/intel/baytrail/cpu.c
+++ b/src/soc/intel/baytrail/cpu.c
@@ -112,11 +112,17 @@ static void adjust_apic_id_map(struct smm_loader_params *smm_params)
runtime->apic_id_to_cpu[i] = mp_get_apic_id(i);
}
-static void asmlinkage
-cpu_smm_do_relocation(void *arg, int cpu, const struct smm_runtime *runtime)
+static void asmlinkage cpu_smm_do_relocation(void *arg)
{
msr_t smrr;
em64t100_smm_state_save_area_t *smm_state;
+ const struct smm_module_params *p;
+ const struct smm_runtime *runtime;
+ int cpu;
+
+ p = arg;
+ runtime = p->runtime;
+ cpu = p->cpu;
if (cpu >= CONFIG_MAX_CPUS) {
printk(BIOS_CRIT,
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc
index 4fa22ea..a8cebf7 100644
--- a/src/vendorcode/google/chromeos/Makefile.inc
+++ b/src/vendorcode/google/chromeos/Makefile.inc
@@ -50,6 +50,7 @@ VB_INCLUDES += -I$(VB_SOURCE)/firmware/include
INCLUDES += $(VB_INCLUDES)
VBOOT_STUB_ELF = $(obj)/vendorcode/google/chromeos/vbootstub.elf
+VBOOT_STUB = $(VBOOT_STUB_ELF).rmod
VBOOT_STUB_DOTO = $(VBOOT_STUB_ELF:.elf=.o)
# Dependency for the vboot rmodules. Ordering matters.
diff --git a/src/vendorcode/google/chromeos/vboot_wrapper.c b/src/vendorcode/google/chromeos/vboot_wrapper.c
index 66b7cfb..fe3c022 100644
--- a/src/vendorcode/google/chromeos/vboot_wrapper.c
+++ b/src/vendorcode/google/chromeos/vboot_wrapper.c
@@ -24,10 +24,6 @@
#include "vboot_context.h"
#include "vboot_handoff.h"
-static void vboot_wrapper(struct vboot_context *context);
-
-DEFINE_RMODULE_HEADER(vboot_wrapper_header, vboot_wrapper, RMODULE_TYPE_VBOOT);
-
/* Keep a global context pointer around for the callbacks to use. */
static struct vboot_context *gcontext;
@@ -63,12 +59,14 @@ static void parse_component(const struct components *components, int num,
fw->size = (uint32_t)components->entries[num].size;
}
-static void vboot_wrapper(struct vboot_context *context)
+static void vboot_wrapper(void *arg)
{
int i;
VbError_t res;
const struct components *components;
+ struct vboot_context *context;
+ context = arg;
gcontext = context;
VbExDebug("Calling VbInit()\n");
@@ -266,3 +264,4 @@ VbError_t VbExTpmSendReceive(const uint8_t *request, uint32_t request_length,
return VBERROR_SUCCESS;
}
+RMODULE_ENTRY(vboot_wrapper);
the following patch was just integrated into master:
commit 81cada3cbd92ec41d9dd126f525d443c3cbf3111
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Feb 14 00:30:04 2014 -0600
chromeos: provide option to dynamically allocate ram oops buffer
Fixing the location of the ram oops buffer can lead to certain
kernel and boot loaders being confused when there is a ram
reservation low in the address space. Alternatively provide
a mechanism to allocate the ram oops buffer in cbmem. As cbmem
is usually high in the address space it avoids low reservation
confusion.
The patch uncondtionally provides a GOOG9999 ACPI device with
a single memory resource describing the memory region used for
the ramoops region.
BUG=None
BRANCH=baytrail,haswell
TEST=Built and booted with and w/o dynamic ram oops. With
the corresponding kernel change things behave correctly.
Change-Id: Ide2bb4434768c9f9b90e125adae4324cb1d2d073
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
See http://review.coreboot.org/5257 for details.
-gerrit
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4940
-gerrit
commit 1780db4d9ce3fe8c75fa20e009069edb1c12a46c
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon Nov 4 21:45:52 2013 -0600
baytrail: interrupt routing support
This provides the initial support for interrupt routing
in bay trail. It includes both acpi changes and board changes
to ensure the interdependencies are met with the current ASL
code. The PIRQ routing is handled by the mainboard exporting
an irqroute.h header that describes the per device and PIRQ
PCI settings.
There are still a lot of ACPI errors in the kernel with this
change, though.
BUG=chrome-os-partner:23505
BRANCH=None
TEST=Built and booted rambi into kernel.
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Change-Id: Id8a865a24fc8d49743c0b54efdb64aaef52fcd8e
Reviewed-on: https://chromium-review.googlesource.com/175700
Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/mainboard/google/rambi/Makefile.inc | 1 +
src/mainboard/google/rambi/acpi/ec.asl | 57 ++-
src/mainboard/google/rambi/acpi/mainboard.asl | 20 +-
src/mainboard/google/rambi/acpi/platform.asl | 73 ----
src/mainboard/google/rambi/dsdt.asl | 7 +-
src/mainboard/google/rambi/irqroute.c | 22 ++
src/mainboard/google/rambi/irqroute.h | 47 +++
src/soc/intel/baytrail/acpi/cpu.asl | 77 ++++
src/soc/intel/baytrail/acpi/irq_helper.h | 48 +++
src/soc/intel/baytrail/acpi/irqlinks.asl | 493 ++++++++++++++++++++++++++
src/soc/intel/baytrail/acpi/irqroute.asl | 37 ++
src/soc/intel/baytrail/acpi/lpc.asl | 164 +++++++++
src/soc/intel/baytrail/acpi/platform.asl | 73 ++++
src/soc/intel/baytrail/acpi/southcluster.asl | 23 ++
src/soc/intel/baytrail/baytrail/irq.h | 89 +++++
src/soc/intel/baytrail/baytrail/pci_devs.h | 30 +-
src/soc/intel/baytrail/southcluster.c | 20 +-
17 files changed, 1148 insertions(+), 133 deletions(-)
diff --git a/src/mainboard/google/rambi/Makefile.inc b/src/mainboard/google/rambi/Makefile.inc
index 77b2f2c..1b15ad7 100644
--- a/src/mainboard/google/rambi/Makefile.inc
+++ b/src/mainboard/google/rambi/Makefile.inc
@@ -23,5 +23,6 @@ romstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += gpio.c
ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
+ramstage-y += irqroute.c
smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
diff --git a/src/mainboard/google/rambi/acpi/ec.asl b/src/mainboard/google/rambi/acpi/ec.asl
index 9ae5951..9a4cd4a 100644
--- a/src/mainboard/google/rambi/acpi/ec.asl
+++ b/src/mainboard/google/rambi/acpi/ec.asl
@@ -1,37 +1,24 @@
-Device (EC0)
-{
- Name (_HID, EISAID ("PNP0C09"))
- Name (_UID, 1)
- Name (_GPE, 10) // GPIO 10 is SMC_RUNTIME_SCI_N
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
- OperationRegion (ERAM, EmbeddedControl, 0x00, 0xff)
- Field (ERAM, ByteAcc, Lock, Preserve)
- {
- Offset (0x03),
- ACPR, 1, // AC Power (1=present)
- , 2,
- CFAN, 1, // CPU Fan (1=on)
- , 2,
- LIDS, 1, // Lid State (1=open)
- , 1,
- SPTR, 8, // SMBUS Protocol Register
- SSTS, 8, // SMBUS Status Register
- SADR, 8, // SMBUS Address Register
- SCMD, 8, // SMBUS Command Register
- SBFR, 256, // SMBUS Block Buffer
- SCNT, 8, // SMBUS Block Count
+/* mainboard configuration */
+#include <mainboard/google/rambi/ec.h>
- Offset (0x3a),
- ECMD, 8, // EC Command Register
-
- Offset (0x82),
- PECL, 8, // PECI fractional (1/64 Celsius)
- PECH, 8, // PECI integer (Celsius)
- }
-
- Name (_CRS, ResourceTemplate()
- {
- IO (Decode16, 0x62, 0x62, 0, 1)
- IO (Decode16, 0x66, 0x66, 0, 1)
- })
-}
+/* ACPI code for EC functions */
+#include <ec/google/chromeec/acpi/ec.asl>
diff --git a/src/mainboard/google/rambi/acpi/mainboard.asl b/src/mainboard/google/rambi/acpi/mainboard.asl
index 3e0eb33..948d7df 100644
--- a/src/mainboard/google/rambi/acpi/mainboard.asl
+++ b/src/mainboard/google/rambi/acpi/mainboard.asl
@@ -1,7 +1,7 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2011 Google Inc.
+ * Copyright (C) 2012 Google Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -19,10 +19,20 @@
* MA 02110-1301 USA
*/
-Device (PWRB)
+Scope (\_SB)
{
- Name(_HID, EisaId("PNP0C0C"))
+ Device (LID0)
+ {
+ Name(_HID, EisaId("PNP0C0D"))
+ Method(_LID, 0)
+ {
+ Store (\_SB.PCI0.LPCB.EC0.LIDS, \LIDS)
+ Return (\LIDS)
+ }
+ }
- // Wake from deep sleep via GPIO27
- Name(_PRW, Package(){27, 4})
+ Device (PWRB)
+ {
+ Name(_HID, EisaId("PNP0C0C"))
+ }
}
diff --git a/src/mainboard/google/rambi/acpi/platform.asl b/src/mainboard/google/rambi/acpi/platform.asl
deleted file mode 100644
index e069392..0000000
--- a/src/mainboard/google/rambi/acpi/platform.asl
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2007-2009 coresystems GmbH
- * Copyright (C) 2012 Google Inc.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* The APM port can be used for generating software SMIs */
-
-OperationRegion (APMP, SystemIO, 0xb2, 2)
-Field (APMP, ByteAcc, NoLock, Preserve)
-{
- APMC, 8, // APM command
- APMS, 8 // APM status
-}
-
-/* Port 80 POST */
-
-OperationRegion (POST, SystemIO, 0x80, 1)
-Field (POST, ByteAcc, Lock, Preserve)
-{
- DBG0, 8
-}
-
-/* SMI I/O Trap */
-Method(TRAP, 1, Serialized)
-{
- Store (Arg0, SMIF) // SMI Function
- Store (0, TRP0) // Generate trap
- Return (SMIF) // Return value of SMI handler
-}
-
-/* The _PIC method is called by the OS to choose between interrupt
- * routing via the i8259 interrupt controller or the APIC.
- *
- * _PIC is called with a parameter of 0 for i8259 configuration and
- * with a parameter of 1 for Local Apic/IOAPIC configuration.
- */
-
-Method(_PIC, 1)
-{
- // Remember the OS' IRQ routing choice.
- Store(Arg0, PICM)
-}
-
-/* The _PTS method (Prepare To Sleep) is called before the OS is
- * entering a sleep state. The sleep state number is passed in Arg0
- */
-
-Method(_PTS,1)
-{
-}
-
-/* The _WAK method is called on system wakeup */
-
-Method(_WAK,1)
-{
- Return(Package(){0,0})
-}
-
diff --git a/src/mainboard/google/rambi/dsdt.asl b/src/mainboard/google/rambi/dsdt.asl
index 55e44b5..1fbb8eb 100644
--- a/src/mainboard/google/rambi/dsdt.asl
+++ b/src/mainboard/google/rambi/dsdt.asl
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <soc/intel/baytrail/baytrail/iomap.h>
-
#define ENABLE_TPM
DefinitionBlock(
@@ -32,14 +30,15 @@ DefinitionBlock(
)
{
// Some generic macros
- #include "acpi/platform.asl"
+ #include <soc/intel/baytrail/acpi/platform.asl>
+ #include "acpi/mainboard.asl"
// global NVS and variables
#include <soc/intel/baytrail/acpi/globalnvs.asl>
//#include "acpi/thermal.asl"
- //#include <soc/intel/baytrail/acpi/cpu.asl>
+ #include <soc/intel/baytrail/acpi/cpu.asl>
Scope (\_SB) {
Device (PCI0)
diff --git a/src/mainboard/google/rambi/irqroute.c b/src/mainboard/google/rambi/irqroute.c
new file mode 100644
index 0000000..552be8f
--- /dev/null
+++ b/src/mainboard/google/rambi/irqroute.c
@@ -0,0 +1,22 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "irqroute.h"
+
+DEFINE_IRQ_ROUTES;
diff --git a/src/mainboard/google/rambi/irqroute.h b/src/mainboard/google/rambi/irqroute.h
new file mode 100644
index 0000000..20f421b
--- /dev/null
+++ b/src/mainboard/google/rambi/irqroute.h
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <soc/intel/baytrail/baytrail/irq.h>
+#include <soc/intel/baytrail/baytrail/pci_devs.h>
+
+#define PCI_DEV_PIRQ_ROUTES \
+ PCI_DEV_PIRQ_ROUTE(GFX_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SDIO_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SD_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SATA_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(XHCI_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(LPE_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(MMC_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SIO1_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(TXE_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(HDA_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(PCIE_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(EHCI_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SIO2_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(PCU_DEV, A, B, C, D)
+
+#define PIRQ_PIC_ROUTES \
+ PIRQ_PIC(A, DISABLE), \
+ PIRQ_PIC(B, DISABLE), \
+ PIRQ_PIC(C, DISABLE), \
+ PIRQ_PIC(D, DISABLE), \
+ PIRQ_PIC(E, DISABLE), \
+ PIRQ_PIC(F, DISABLE), \
+ PIRQ_PIC(G, DISABLE), \
+ PIRQ_PIC(H, DISABLE)
diff --git a/src/soc/intel/baytrail/acpi/cpu.asl b/src/soc/intel/baytrail/acpi/cpu.asl
new file mode 100644
index 0000000..16f62ba
--- /dev/null
+++ b/src/soc/intel/baytrail/acpi/cpu.asl
@@ -0,0 +1,77 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+/* These devices are created at runtime */
+External (\_PR.CPU0, DeviceObj)
+External (\_PR.CPU1, DeviceObj)
+External (\_PR.CPU2, DeviceObj)
+External (\_PR.CPU3, DeviceObj)
+
+/* Notify OS to re-read CPU tables, assuming ^2 CPU count */
+Method (PNOT)
+{
+ If (LGreaterEqual (\PCNT, 2)) {
+ Notify (\_PR.CPU0, 0x81) // _CST
+ Notify (\_PR.CPU1, 0x81) // _CST
+ }
+ If (LGreaterEqual (\PCNT, 4)) {
+ Notify (\_PR.CPU2, 0x81) // _CST
+ Notify (\_PR.CPU3, 0x81) // _CST
+ }
+}
+
+/* Notify OS to re-read CPU _PPC limit, assuming ^2 CPU count */
+Method (PPCN)
+{
+ If (LGreaterEqual (\PCNT, 2)) {
+ Notify (\_PR.CPU0, 0x80) // _PPC
+ Notify (\_PR.CPU1, 0x80) // _PPC
+ }
+ If (LGreaterEqual (\PCNT, 4)) {
+ Notify (\_PR.CPU2, 0x80) // _PPC
+ Notify (\_PR.CPU3, 0x80) // _PPC
+ }
+}
+
+/* Notify OS to re-read Throttle Limit tables, assuming ^2 CPU count */
+Method (TNOT)
+{
+ If (LGreaterEqual (\PCNT, 2)) {
+ Notify (\_PR.CPU0, 0x82) // _TPC
+ Notify (\_PR.CPU1, 0x82) // _TPC
+ }
+ If (LGreaterEqual (\PCNT, 4)) {
+ Notify (\_PR.CPU2, 0x82) // _TPC
+ Notify (\_PR.CPU3, 0x82) // _TPC
+ }
+}
+
+/* Return a package containing enabled processor entries */
+Method (PPKG)
+{
+ If (LGreaterEqual (\PCNT, 4)) {
+ Return (Package() {\_PR.CPU0, \_PR.CPU1, \_PR.CPU2, \_PR.CPU3})
+ } ElseIf (LGreaterEqual (\PCNT, 2)) {
+ Return (Package() {\_PR.CPU0, \_PR.CPU1})
+ } Else {
+ Return (Package() {\_PR.CPU0})
+ }
+}
diff --git a/src/soc/intel/baytrail/acpi/irq_helper.h b/src/soc/intel/baytrail/acpi/irq_helper.h
new file mode 100644
index 0000000..b19895b
--- /dev/null
+++ b/src/soc/intel/baytrail/acpi/irq_helper.h
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#undef PCI_DEV_PIRQ_ROUTES
+#undef ACPI_DEV_APIC_IRQ
+#undef PCI_DEV_PIRQ_ROUTE
+#undef PIRQ_PIC_ROUTES
+#undef PIRQ_PIC
+
+#if defined(PIC_MODE)
+
+#define ACPI_DEV_APIC_IRQ(dev_, pin_, pin_name_) \
+ Package() { ## dev_ ## ffff, pin_, \_SB.PCI0.LPCB.LNK ## pin_name_, 0 }
+
+#else /* defined(PIC_MODE) */
+
+#define ACPI_DEV_APIC_IRQ(dev_, pin_, pin_name_) \
+ Package() { ## dev_ ## ffff, pin_, 0, PIRQ ## pin_name_ ## _APIC_IRQ }
+
+#endif
+
+#define PCI_DEV_PIRQ_ROUTE(dev_, a_, b_, c_, d_) \
+ ACPI_DEV_APIC_IRQ(dev_, 0, a_), \
+ ACPI_DEV_APIC_IRQ(dev_, 1, b_), \
+ ACPI_DEV_APIC_IRQ(dev_, 2, c_), \
+ ACPI_DEV_APIC_IRQ(dev_, 3, d_)
+
+/* Empty PIRQ_PIC definition. */
+#define PIRQ_PIC(pirq_, pic_irq_)
+
+/* Include the mainboard irq route definition. */
+#include "irqroute.h"
diff --git a/src/soc/intel/baytrail/acpi/irqlinks.asl b/src/soc/intel/baytrail/acpi/irqlinks.asl
new file mode 100644
index 0000000..5fcee45
--- /dev/null
+++ b/src/soc/intel/baytrail/acpi/irqlinks.asl
@@ -0,0 +1,493 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+Device (LNKA)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 1)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTA)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 10, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLA, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLA, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTA
+ ShiftLeft(1, And(PRTA, 0x0f), IRQ0)
+
+ Return (RTLA)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTA)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTA, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
+Device (LNKB)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 2)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTB)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 11, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLB, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLB, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTB
+ ShiftLeft(1, And(PRTB, 0x0f), IRQ0)
+
+ Return (RTLB)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTB)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTB, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
+Device (LNKC)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 3)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTC)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 10, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLC, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLC, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTC
+ ShiftLeft(1, And(PRTC, 0x0f), IRQ0)
+
+ Return (RTLC)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTC)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTC, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
+Device (LNKD)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 4)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTD)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 11, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLD, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLD, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTD
+ ShiftLeft(1, And(PRTD, 0x0f), IRQ0)
+
+ Return (RTLD)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTD)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTD, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
+Device (LNKE)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 5)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTE)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 10, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLE, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLE, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTE
+ ShiftLeft(1, And(PRTE, 0x0f), IRQ0)
+
+ Return (RTLE)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTE)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTE, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
+Device (LNKF)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 6)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTF)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 11, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLF, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLF, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTF
+ ShiftLeft(1, And(PRTF, 0x0f), IRQ0)
+
+ Return (RTLF)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTF)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTF, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
+Device (LNKG)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 7)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTG)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 10, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLG, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLG, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTG
+ ShiftLeft(1, And(PRTG, 0x0f), IRQ0)
+
+ Return (RTLG)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTG)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTG, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
+Device (LNKH)
+{
+ Name (_HID, EISAID("PNP0C0F"))
+ Name (_UID, 8)
+
+ // Disable method
+ Method (_DIS, 0, Serialized)
+ {
+ Store (0x80, PRTH)
+ }
+
+ // Possible Resource Settings for this Link
+ Name (_PRS, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared)
+ { 1, 3, 4, 5, 6, 7, 11, 12, 14, 15 }
+ })
+
+ // Current Resource Settings for this link
+ Method (_CRS, 0, Serialized)
+ {
+ Name (RTLH, ResourceTemplate()
+ {
+ IRQ(Level, ActiveLow, Shared) {}
+ })
+ CreateWordField(RTLH, 1, IRQ0)
+
+ // Clear the WordField
+ Store (Zero, IRQ0)
+
+ // Set the bit from PRTH
+ ShiftLeft(1, And(PRTH, 0x0f), IRQ0)
+
+ Return (RTLH)
+ }
+
+ // Set Resource Setting for this IRQ link
+ Method (_SRS, 1, Serialized)
+ {
+ CreateWordField(Arg0, 1, IRQ0)
+
+ // Which bit is set?
+ FindSetRightBit(IRQ0, Local0)
+
+ Decrement(Local0)
+ Store(Local0, PRTH)
+ }
+
+ // Status
+ Method (_STA, 0, Serialized)
+ {
+ If(And(PRTH, 0x80)) {
+ Return (0x9)
+ } Else {
+ Return (0xb)
+ }
+ }
+}
+
diff --git a/src/soc/intel/baytrail/acpi/irqroute.asl b/src/soc/intel/baytrail/acpi/irqroute.asl
new file mode 100644
index 0000000..23987d7
--- /dev/null
+++ b/src/soc/intel/baytrail/acpi/irqroute.asl
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2013 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+// PCI Interrupt Routing
+Method(_PRT)
+{
+ If (PICM) {
+ Return (Package() {
+ #undef PIC_MODE
+ #include <soc/intel/baytrail/acpi/irq_helper.h>
+ PCI_DEV_PIRQ_ROUTES
+ })
+ } Else {
+ Return (Package() {
+ #define PIC_MODE
+ #include <soc/intel/baytrail/acpi/irq_helper.h>
+ PCI_DEV_PIRQ_ROUTES
+ })
+ }
+}
diff --git a/src/soc/intel/baytrail/acpi/lpc.asl b/src/soc/intel/baytrail/acpi/lpc.asl
new file mode 100644
index 0000000..24fa9c7
--- /dev/null
+++ b/src/soc/intel/baytrail/acpi/lpc.asl
@@ -0,0 +1,164 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2013 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+// Intel LPC Bus Device - 0:1f.0
+
+Device (LPCB)
+{
+ Name(_ADR, 0x001f0000)
+
+ #include "irqlinks.asl"
+
+ #include "acpi/ec.asl"
+
+ Device (DMAC) // DMA Controller
+ {
+ Name(_HID, EISAID("PNP0200"))
+ Name(_CRS, ResourceTemplate()
+ {
+ IO (Decode16, 0x00, 0x00, 0x01, 0x20)
+ IO (Decode16, 0x81, 0x81, 0x01, 0x11)
+ IO (Decode16, 0x93, 0x93, 0x01, 0x0d)
+ IO (Decode16, 0xc0, 0xc0, 0x01, 0x20)
+ DMA (Compatibility, NotBusMaster, Transfer8_16) { 4 }
+ })
+ }
+
+ Device (FWH) // Firmware Hub
+ {
+ Name (_HID, EISAID("INT0800"))
+ Name (_CRS, ResourceTemplate()
+ {
+ Memory32Fixed(ReadOnly, 0xff000000, 0x01000000)
+ })
+ }
+
+ Device (HPET)
+ {
+ Name (_HID, EISAID("PNP0103"))
+ Name (_CID, 0x010CD041)
+
+ Method (_STA, 0) // Device Status
+ {
+ Return (0xf) // Enable and show device
+ }
+
+ Name(_CRS, ResourceTemplate()
+ {
+ Memory32Fixed(ReadOnly, 0xfed00000, 0x400)
+ })
+ }
+
+ Device(PIC) // 8259 Interrupt Controller
+ {
+ Name(_HID,EISAID("PNP0000"))
+ Name(_CRS, ResourceTemplate()
+ {
+ IO (Decode16, 0x20, 0x20, 0x01, 0x02)
+ IO (Decode16, 0x24, 0x24, 0x01, 0x02)
+ IO (Decode16, 0x28, 0x28, 0x01, 0x02)
+ IO (Decode16, 0x2c, 0x2c, 0x01, 0x02)
+ IO (Decode16, 0x30, 0x30, 0x01, 0x02)
+ IO (Decode16, 0x34, 0x34, 0x01, 0x02)
+ IO (Decode16, 0x38, 0x38, 0x01, 0x02)
+ IO (Decode16, 0x3c, 0x3c, 0x01, 0x02)
+ IO (Decode16, 0xa0, 0xa0, 0x01, 0x02)
+ IO (Decode16, 0xa4, 0xa4, 0x01, 0x02)
+ IO (Decode16, 0xa8, 0xa8, 0x01, 0x02)
+ IO (Decode16, 0xac, 0xac, 0x01, 0x02)
+ IO (Decode16, 0xb0, 0xb0, 0x01, 0x02)
+ IO (Decode16, 0xb4, 0xb4, 0x01, 0x02)
+ IO (Decode16, 0xb8, 0xb8, 0x01, 0x02)
+ IO (Decode16, 0xbc, 0xbc, 0x01, 0x02)
+ IO (Decode16, 0x4d0, 0x4d0, 0x01, 0x02)
+ IRQNoFlags () { 2 }
+ })
+ }
+
+ Device(LDRC) // LPC device: Resource consumption
+ {
+ Name (_HID, EISAID("PNP0C02"))
+ Name (_UID, 2)
+
+ Name (RBUF, ResourceTemplate()
+ {
+ IO (Decode16, 0x61, 0x61, 0x1, 0x01) // NMI Status
+ IO (Decode16, 0x63, 0x63, 0x1, 0x01) // CPU Reserved
+ IO (Decode16, 0x65, 0x65, 0x1, 0x01) // CPU Reserved
+ IO (Decode16, 0x67, 0x67, 0x1, 0x01) // CPU Reserved
+ IO (Decode16, 0x80, 0x80, 0x1, 0x01) // Port 80 Post
+ IO (Decode16, 0x92, 0x92, 0x1, 0x01) // CPU Reserved
+ IO (Decode16, 0xb2, 0xb2, 0x1, 0x02) // SWSMI
+ })
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Return (RBUF)
+ }
+ }
+
+ Device (RTC) // Real Time Clock
+ {
+ Name (_HID, EISAID("PNP0B00"))
+ Name (_CRS, ResourceTemplate()
+ {
+ IO (Decode16, 0x70, 0x70, 1, 8)
+// Disable as Windows doesn't like it, and systems don't seem to use it.
+// IRQNoFlags() { 8 }
+ })
+ }
+
+ Device (TIMR) // Intel 8254 timer
+ {
+ Name(_HID, EISAID("PNP0100"))
+ Name(_CRS, ResourceTemplate()
+ {
+ IO (Decode16, 0x40, 0x40, 0x01, 0x04)
+ IO (Decode16, 0x50, 0x50, 0x10, 0x04)
+ IRQNoFlags() {0}
+ })
+ }
+
+#ifdef ENABLE_TPM
+ Device (TPM) // Trusted Platform Module
+ {
+ Name(_HID, EISAID("IFX0102"))
+ Name(_CID, 0x310cd041)
+ Name(_UID, 1)
+
+ Method(_STA, 0)
+ {
+ If (TPMP) {
+ Return (0xf)
+ }
+ Return (0x0)
+ }
+
+ Name(_CRS, ResourceTemplate() {
+ IO (Decode16, 0x2e, 0x2e, 0x01, 0x02)
+ IO (Decode16, 0x6f0, 0x6f0, 0x01, 0x10)
+ Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)
+ IRQ (Edge, Activehigh, Exclusive) { 6 }
+ })
+ }
+#endif
+}
diff --git a/src/soc/intel/baytrail/acpi/platform.asl b/src/soc/intel/baytrail/acpi/platform.asl
new file mode 100644
index 0000000..e069392
--- /dev/null
+++ b/src/soc/intel/baytrail/acpi/platform.asl
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2012 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* The APM port can be used for generating software SMIs */
+
+OperationRegion (APMP, SystemIO, 0xb2, 2)
+Field (APMP, ByteAcc, NoLock, Preserve)
+{
+ APMC, 8, // APM command
+ APMS, 8 // APM status
+}
+
+/* Port 80 POST */
+
+OperationRegion (POST, SystemIO, 0x80, 1)
+Field (POST, ByteAcc, Lock, Preserve)
+{
+ DBG0, 8
+}
+
+/* SMI I/O Trap */
+Method(TRAP, 1, Serialized)
+{
+ Store (Arg0, SMIF) // SMI Function
+ Store (0, TRP0) // Generate trap
+ Return (SMIF) // Return value of SMI handler
+}
+
+/* The _PIC method is called by the OS to choose between interrupt
+ * routing via the i8259 interrupt controller or the APIC.
+ *
+ * _PIC is called with a parameter of 0 for i8259 configuration and
+ * with a parameter of 1 for Local Apic/IOAPIC configuration.
+ */
+
+Method(_PIC, 1)
+{
+ // Remember the OS' IRQ routing choice.
+ Store(Arg0, PICM)
+}
+
+/* The _PTS method (Prepare To Sleep) is called before the OS is
+ * entering a sleep state. The sleep state number is passed in Arg0
+ */
+
+Method(_PTS,1)
+{
+}
+
+/* The _WAK method is called on system wakeup */
+
+Method(_WAK,1)
+{
+ Return(Package(){0,0})
+}
+
diff --git a/src/soc/intel/baytrail/acpi/southcluster.asl b/src/soc/intel/baytrail/acpi/southcluster.asl
index b936fa4..6c20509 100644
--- a/src/soc/intel/baytrail/acpi/southcluster.asl
+++ b/src/soc/intel/baytrail/acpi/southcluster.asl
@@ -19,6 +19,8 @@
* MA 02110-1301 USA
*/
+#include <soc/intel/baytrail/baytrail/iomap.h>
+
Scope(\)
{
// IO-Trap at 0x800. This is the ACPI->SMI communication interface.
@@ -29,6 +31,21 @@ Scope(\)
Offset(0x8),
TRP0, 8 // IO-Trap at 0x808
}
+
+ // Intel Legacy Block
+ OperationRegion(ILBS, SystemMemory, ILB_BASE_ADDRESS, ILB_BASE_SIZE)
+ Field (ILBS, AnyAcc, NoLock, Preserve)
+ {
+ Offset (0x8),
+ PRTA, 8,
+ PRTB, 8,
+ PRTC, 8,
+ PRTD, 8,
+ PRTE, 8,
+ PRTF, 8,
+ PRTG, 8,
+ PRTH, 8,
+ }
}
Name(_HID,EISAID("PNP0A08")) // PCIe
@@ -210,3 +227,9 @@ Method (_OSC, 4)
Return (Arg3)
}
}
+
+// LPC Bridge 0:1f.0
+#include "lpc.asl"
+
+// IRQ routing for each PCI device
+#include "irqroute.asl"
diff --git a/src/soc/intel/baytrail/baytrail/irq.h b/src/soc/intel/baytrail/baytrail/irq.h
new file mode 100644
index 0000000..d037b89
--- /dev/null
+++ b/src/soc/intel/baytrail/baytrail/irq.h
@@ -0,0 +1,89 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _BAYTRAIL_IRQ_H_
+#define _BAYTRAIL_IRQ_H_
+
+#define PIRQA_APIC_IRQ 16
+#define PIRQB_APIC_IRQ 17
+#define PIRQC_APIC_IRQ 18
+#define PIRQD_APIC_IRQ 19
+#define PIRQE_APIC_IRQ 20
+#define PIRQF_APIC_IRQ 21
+#define PIRQG_APIC_IRQ 22
+#define PIRQH_APIC_IRQ 23
+
+#define PIRQ_PIC_IRQDISABLE 0x0
+#define PIRQ_PIC_IRQ3 0x3
+#define PIRQ_PIC_IRQ4 0x4
+#define PIRQ_PIC_IRQ5 0x5
+#define PIRQ_PIC_IRQ6 0x6
+#define PIRQ_PIC_IRQ7 0x7
+#define PIRQ_PIC_IRQ9 0x9
+#define PIRQ_PIC_IRQ10 0xa
+#define PIRQ_PIC_IRQ11 0xb
+#define PIRQ_PIC_IRQ12 0xc
+#define PIRQ_PIC_IRQ14 0xe
+#define PIRQ_PIC_IRQ15 0xf
+
+/* Overloaded term, but these values determine the per device route. */
+#define PIRQA 0
+#define PIRQB 1
+#define PIRQC 2
+#define PIRQD 3
+#define PIRQE 4
+#define PIRQF 5
+#define PIRQG 6
+#define PIRQH 7
+
+/* In each mainbaord directory there should exist a header file irqroute.h that
+ * defines the PCI_DEV_PIRQ_ROUTES and PIRQ_PIC_ROUTES macros which
+ * consist of PCI_DEV_PIRQ_ROUTE and PIRQ_PIC entries. */
+
+#if !defined(__ASSEMBLER__) && !defined(__ACPI__)
+#include <stdint.h>
+
+#define NUM_IR_DEVS 32
+#define NUM_PIRQS 8
+
+struct baytrail_irq_route {
+ /* Per device configuration. */
+ uint16_t pcidev[NUM_IR_DEVS];
+ /* Route path for each internal PIRQx in PIC mode. */
+ uint8_t pic[NUM_PIRQS];
+};
+
+extern const struct baytrail_irq_route global_baytrail_irq_route;
+
+#define DEFINE_IRQ_ROUTES \
+ const struct baytrail_irq_route global_baytrail_irq_route = { \
+ .pcidev = { PCI_DEV_PIRQ_ROUTES, }, \
+ .pic = { PIRQ_PIC_ROUTES, }, \
+ }
+
+#define PCI_DEV_PIRQ_ROUTE(dev_, a_, b_, c_, d_) \
+ [dev_] = ((PIRQ ## d_) << 12) | ((PIRQ ## c_) << 8) | \
+ ((PIRQ ## b_) << 4) | ((PIRQ ## a_) << 0)
+
+#define PIRQ_PIC(pirq_, pic_irq_) \
+ [PIRQ ## pirq_] = PIRQ_PIC_IRQ ## pic_irq_
+
+#endif /* !defined(__ASSEMBLER__) && !defined(__ACPI__) */
+
+#endif /* _BAYTRAIL_IRQ_H_ */
diff --git a/src/soc/intel/baytrail/baytrail/pci_devs.h b/src/soc/intel/baytrail/baytrail/pci_devs.h
index 96e9547..b3fdce2 100644
--- a/src/soc/intel/baytrail/baytrail/pci_devs.h
+++ b/src/soc/intel/baytrail/baytrail/pci_devs.h
@@ -23,27 +23,27 @@
/* All these devices live on bus 0 with the associated device and function */
/* SoC transaction router */
-#define SOC_DEV 0
+#define SOC_DEV 0x0
#define SOC_FUNC 0
# define SOC_DEVID 0x0f00
/* Graphics and Display */
-#define GFX_DEV 2
+#define GFX_DEV 0x2
#define GFX_FUNC 0
# define GFX_DEVID 0x0f31
/* SDIO Port */
-#define SDIO_DEV 17
+#define SDIO_DEV 0x11
#define SDIO_FUNC 0
# define SDIO_DEVID 0x0f15
/* SD Port */
-#define SD_DEV 18
+#define SD_DEV 0x12
#define SD_FUNC 0
# define SD_DEVID 0x0f16
/* SATA */
-#define SATA_DEV 19
+#define SATA_DEV 0x13
#define SATA_FUNC 0
#define IDE1_DEVID 0x0f20
#define IDE2_DEVID 0x0f21
@@ -51,22 +51,22 @@
#define AHCI2_DEVID 0x0f23
/* xHCI */
-#define XHCI_DEV 20
+#define XHCI_DEV 0x14
#define XHCI_FUNC 0
# define XHCI_DEVID 0x0f35
/* LPE Audio */
-#define LPE_DEV 21
+#define LPE_DEV 0x15
#define LPE_FUNC 0
# define LPE_DEVID 0x0f28
/* MMC Port */
-#define MMC_DEV 23
+#define MMC_DEV 0x17
#define MMC_FUNC 0
# define MMC_DEVID 0x0f50
/* Serial IO 1 */
-#define SIO1_DEV 24
+#define SIO1_DEV 0x18
# define SIO_DMA1_DEV SIO1_DEV
# define SIO_DMA1_FUNC 0
# define SIO_DMA1_DEVID 0x0f40
@@ -93,17 +93,17 @@
# define I2C7_DEVID 0x0f47
/* Trusted Execution Engine */
-#define TXE_DEV 26
+#define TXE_DEV 0x1a
#define TXE_FUNC 0
# define TXE_DEVID 0x0f18
/* HD Audio */
-#define HDA_DEV 27
+#define HDA_DEV 0x1b
#define HDA_FUNC 0
# define HDA_DEVID 0x0f04
/* PCIe Ports */
-#define PCIE_DEV 28
+#define PCIE_DEV 0x1c
# define PCIE_PORT1_DEV PCIE_DEV
# define PCIE_PORT1_FUNC 0
# define PCIE_PORT1_DEVID 0x0f48
@@ -118,12 +118,12 @@
# define PCIE_PORT4_DEVID 0x0f4e
/* EHCI */
-#define EHCI_DEV 29
+#define EHCI_DEV 0x1d
#define EHCI_FUNC 0
# define EHCI_DEVID 0x0f34
/* Serial IO 2 */
-#define SIO2_DEV 30
+#define SIO2_DEV 0x1e
# define SIO_DMA2_DEV SIO2_DEV
# define SIO_DMA2_FUNC 0
# define SIO_DMA2_DEVID 0x0f06
@@ -144,7 +144,7 @@
# define SPI_DEVID 0xf0e
/* Platform Controller Unit */
-#define PCU_DEV 31
+#define PCU_DEV 0x1f
# define LPC_DEV PCU_DEV
# define LPC_FUNC 0
# define LPC_DEVID 0x0f1c
diff --git a/src/soc/intel/baytrail/southcluster.c b/src/soc/intel/baytrail/southcluster.c
index f8b4f18..10c0b89 100644
--- a/src/soc/intel/baytrail/southcluster.c
+++ b/src/soc/intel/baytrail/southcluster.c
@@ -27,6 +27,7 @@
#include <romstage_handoff.h>
#include <baytrail/iomap.h>
+#include <baytrail/irq.h>
#include <baytrail/lpc.h>
#include <baytrail/nvs.h>
#include <baytrail/pci_devs.h>
@@ -116,6 +117,23 @@ static void sc_read_resources(device_t dev)
sc_add_io_resources(dev);
}
+static void sc_init(device_t dev)
+{
+ int i;
+ const unsigned long pr_base = ILB_BASE_ADDRESS + 0x08;
+ const unsigned long ir_base = ILB_BASE_ADDRESS + 0x20;
+ const struct baytrail_irq_route *ir = &global_baytrail_irq_route;
+
+ /* Set up the PIRQ PIC routing based on static config. */
+ for (i = 0; i < NUM_PIRQS; i++) {
+ write8(pr_base + i*sizeof(ir->pic[i]), ir->pic[i]);
+ }
+ /* Set up the per device PIRQ routing base on static config. */
+ for (i = 0; i < NUM_IR_DEVS; i++) {
+ write16(ir_base + i*sizeof(ir->pcidev[i]), ir->pcidev[i]);
+ }
+}
+
/*
* Common code for the south cluster devices.
*/
@@ -412,7 +430,7 @@ static struct device_operations device_ops = {
.read_resources = sc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = NULL,
- .init = NULL,
+ .init = sc_init,
.enable = southcluster_enable_dev,
.scan_bus = scan_static_bus,
.ops_pci = &soc_pci_ops,