summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2016-03-11 20:22:28 -0800
committerStefan Reinauer <stefan.reinauer@coreboot.org>2016-04-19 18:34:18 +0200
commit86ddd732bd82b84724883b1f1579e18790611fe5 (patch)
treee52c4c88ceb7e14fd415031c56997d8c4054116e /src
parent3812597c668b795d4fc85578021e501f2a56f6b9 (diff)
downloadcoreboot-86ddd732bd82b84724883b1f1579e18790611fe5.tar.xz
kbuild: Allow drivers to fit src/drivers/[X]/[Y]/ scheme
Reorder drivers to fit src/drivers/[X]/[Y]/ scheme to make them pluggable. Also, fix up the following driver subdirectories by switching to the src/drivers/[X]/[Y]/ scheme as these are hard requirements for the main change: * drivers/intel * drivers/pc80 * drivers/dec Change-Id: I455d3089a317181d5b99bf658df759ec728a5f6b Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/14047 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/Kconfig2
-rw-r--r--src/drivers/dec/21143/Makefile.inc4
-rw-r--r--src/drivers/dec/Kconfig1
-rw-r--r--src/drivers/dec/Makefile.inc1
-rw-r--r--src/drivers/intel/Kconfig19
-rw-r--r--src/drivers/intel/Makefile.inc6
-rw-r--r--src/drivers/intel/fsp1_0/Makefile.inc3
-rw-r--r--src/drivers/intel/fsp1_1/Makefile.inc4
-rw-r--r--src/drivers/intel/fsp2_0/Makefile.inc17
-rw-r--r--src/drivers/intel/i210/Makefile.inc6
-rw-r--r--src/drivers/intel/wifi/Makefile.inc18
-rw-r--r--src/drivers/pc80/pc/Kconfig (renamed from src/drivers/pc80/Kconfig)11
-rw-r--r--src/drivers/pc80/pc/Makefile.inc12
-rw-r--r--src/drivers/pc80/pc/i8254.c (renamed from src/drivers/pc80/i8254.c)0
-rw-r--r--src/drivers/pc80/pc/i8259.c (renamed from src/drivers/pc80/i8259.c)9
-rw-r--r--src/drivers/pc80/pc/isa-dma.c (renamed from src/drivers/pc80/isa-dma.c)0
-rw-r--r--src/drivers/pc80/pc/keyboard.c (renamed from src/drivers/pc80/keyboard.c)10
-rw-r--r--src/drivers/pc80/pc/ps2_controller.asl (renamed from src/drivers/pc80/ps2_controller.asl)0
-rw-r--r--src/drivers/pc80/pc/spkmodem.c (renamed from src/drivers/pc80/spkmodem.c)34
-rw-r--r--src/drivers/pc80/pc/udelay_io.c (renamed from src/drivers/pc80/udelay_io.c)3
-rw-r--r--src/drivers/pc80/rtc/Kconfig4
-rw-r--r--src/drivers/pc80/rtc/Makefile.inc (renamed from src/drivers/pc80/Makefile.inc)16
-rw-r--r--src/drivers/pc80/rtc/mc146818rtc.c (renamed from src/drivers/pc80/mc146818rtc.c)53
-rw-r--r--src/drivers/pc80/rtc/mc146818rtc_early.c (renamed from src/drivers/pc80/mc146818rtc_early.c)5
-rw-r--r--src/drivers/pc80/tpm/Makefile.inc4
-rw-r--r--src/drivers/pc80/vga/Makefile.inc4
-rw-r--r--src/ec/compal/ene932/acpi/superio.asl2
-rw-r--r--src/include/pc80/mc146818rtc.h2
-rw-r--r--src/mainboard/dmp/vortex86ex/romstage.c2
-rw-r--r--src/mainboard/jetway/nf81-t56n-lf/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/t420/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/t420s/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/t430s/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/t520/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/t530/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/x201/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/x220/acpi/superio.asl2
-rw-r--r--src/mainboard/lenovo/x230/acpi/superio.asl2
-rw-r--r--src/mainboard/packardbell/ms2290/acpi/superio.asl2
-rw-r--r--src/mainboard/purism/librem13/acpi/superio.asl2
-rw-r--r--src/northbridge/via/vx900/Makefile.inc2
41 files changed, 160 insertions, 116 deletions
diff --git a/src/Kconfig b/src/Kconfig
index 0649bf74ec..f9bd661e05 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -432,6 +432,7 @@ source "src/superio/*/Kconfig"
comment "Embedded Controllers"
source "src/ec/acpi/Kconfig"
source "src/ec/*/*/Kconfig"
+# FIXME move to vendorcode
source "src/drivers/intel/fsp1_0/Kconfig"
source "src/southbridge/intel/common/firmware/Kconfig"
@@ -445,6 +446,7 @@ source "src/device/Kconfig"
menu "Generic Drivers"
source "src/drivers/*/Kconfig"
+source "src/drivers/*/*/Kconfig"
endmenu
config RTC
diff --git a/src/drivers/dec/21143/Makefile.inc b/src/drivers/dec/21143/Makefile.inc
index e99dfad6b5..b7382e40e3 100644
--- a/src/drivers/dec/21143/Makefile.inc
+++ b/src/drivers/dec/21143/Makefile.inc
@@ -1 +1,5 @@
+ifeq ($(CONFIG_DRIVERS_DEC_21143),y)
+
ramstage-y += 21143.c
+
+endif
diff --git a/src/drivers/dec/Kconfig b/src/drivers/dec/Kconfig
deleted file mode 100644
index c9dfe6483e..0000000000
--- a/src/drivers/dec/Kconfig
+++ /dev/null
@@ -1 +0,0 @@
-source src/drivers/dec/21143/Kconfig
diff --git a/src/drivers/dec/Makefile.inc b/src/drivers/dec/Makefile.inc
deleted file mode 100644
index 196c424570..0000000000
--- a/src/drivers/dec/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-subdirs-$(CONFIG_DRIVERS_DEC_21143) += 21143
diff --git a/src/drivers/intel/Kconfig b/src/drivers/intel/Kconfig
deleted file mode 100644
index e5525d8a97..0000000000
--- a/src/drivers/intel/Kconfig
+++ /dev/null
@@ -1,19 +0,0 @@
-##
-## 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.
-##
-
-source src/drivers/intel/fsp1_1/Kconfig
-source src/drivers/intel/fsp2_0/Kconfig
-source src/drivers/intel/gma/Kconfig
-source src/drivers/intel/i210/Kconfig
diff --git a/src/drivers/intel/Makefile.inc b/src/drivers/intel/Makefile.inc
deleted file mode 100644
index 67c1163309..0000000000
--- a/src/drivers/intel/Makefile.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-subdirs-y += gma
-subdirs-$(CONFIG_GENERATE_SMBIOS_TABLES) += wifi
-subdirs-$(CONFIG_PLATFORM_USES_FSP1_0) += fsp1_0
-subdirs-$(CONFIG_PLATFORM_USES_FSP1_1) += fsp1_1
-subdirs-$(CONFIG_PLATFORM_USES_FSP2_0) += fsp2_0
-subdirs-$(CONFIG_DRIVER_INTEL_I210) += i210
diff --git a/src/drivers/intel/fsp1_0/Makefile.inc b/src/drivers/intel/fsp1_0/Makefile.inc
index ea8f61e95a..4ff10687aa 100644
--- a/src/drivers/intel/fsp1_0/Makefile.inc
+++ b/src/drivers/intel/fsp1_0/Makefile.inc
@@ -13,6 +13,8 @@
# GNU General Public License for more details.
#
+ifeq ($(CONFIG_PLATFORM_USES_FSP1_0),y)
+
ramstage-y += fsp_util.c hob.c
romstage-y += fsp_util.c hob.c
@@ -44,3 +46,4 @@ mrc.cache-type := mrc_cache
endif
endif
+endif
diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc
index f101cc448a..3f214cb4bf 100644
--- a/src/drivers/intel/fsp1_1/Makefile.inc
+++ b/src/drivers/intel/fsp1_1/Makefile.inc
@@ -14,6 +14,8 @@
# GNU General Public License for more details.
#
+ifeq ($(CONFIG_PLATFORM_USES_FSP1_1),y)
+
verstage-y += car.c
verstage-y += fsp_util.c
verstage-y += verstage.c
@@ -53,3 +55,5 @@ fsp.bin-file := $(call strip_quotes,$(CONFIG_FSP_FILE))
fsp.bin-position := $(CONFIG_FSP_LOC)
fsp.bin-type := fsp
endif
+
+endif
diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc
index 61faefa3b0..3e94f2fffb 100644
--- a/src/drivers/intel/fsp2_0/Makefile.inc
+++ b/src/drivers/intel/fsp2_0/Makefile.inc
@@ -1,3 +1,18 @@
+#
+# 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.
+#
+
+ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y)
+
romstage-y += hand_off_block.c
romstage-y += util.c
romstage-y += memory_init.c
@@ -9,3 +24,5 @@ ramstage-y += silicon_init.c
ramstage-y += util.c
CPPFLAGS_common += -I$(src)/drivers/intel/fsp2_0/include
+
+endif
diff --git a/src/drivers/intel/i210/Makefile.inc b/src/drivers/intel/i210/Makefile.inc
index a1f15de1c1..a69602246b 100644
--- a/src/drivers/intel/i210/Makefile.inc
+++ b/src/drivers/intel/i210/Makefile.inc
@@ -1 +1,5 @@
-ramstage-y += i210.c \ No newline at end of file
+ifeq ($(CONFIG_DRIVER_INTEL_I210),y)
+
+ramstage-y += i210.c
+
+endif
diff --git a/src/drivers/intel/wifi/Makefile.inc b/src/drivers/intel/wifi/Makefile.inc
index 23f5541b4d..1435f8b7f7 100644
--- a/src/drivers/intel/wifi/Makefile.inc
+++ b/src/drivers/intel/wifi/Makefile.inc
@@ -1 +1,19 @@
+#
+# 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.
+#
+
+# really?
+ifeq ($(CONFIG_GENERATE_SMBIOS_TABLES),y)
+
ramstage-$(CONFIG_PCIEXP_PLUGIN_SUPPORT) += wifi.c
+
+endif
diff --git a/src/drivers/pc80/Kconfig b/src/drivers/pc80/pc/Kconfig
index 18c626c7cb..c44cf9144d 100644
--- a/src/drivers/pc80/Kconfig
+++ b/src/drivers/pc80/pc/Kconfig
@@ -1,10 +1,10 @@
# Might be removed (alongside with the PS/2 init code) once payloads
# reliably support PS/2 init themselves.
-if PC80_SYSTEM
config DRIVERS_PS2_KEYBOARD
bool "PS/2 keyboard init"
default n
+ depends on PC80_SYSTEM
help
Enable this option to initialize PS/2 keyboards found connected
to the PS/2 port.
@@ -16,12 +16,3 @@ config DRIVERS_PS2_KEYBOARD
If you know you will only use a payload which does not require
this option, then you can say N here to speed up boot time.
Otherwise say Y.
-
-config DRIVERS_MC146818
- bool
- default y if ARCH_X86
- select RTC
-
-source src/drivers/pc80/tpm/Kconfig
-
-endif
diff --git a/src/drivers/pc80/pc/Makefile.inc b/src/drivers/pc80/pc/Makefile.inc
new file mode 100644
index 0000000000..8c348e323e
--- /dev/null
+++ b/src/drivers/pc80/pc/Makefile.inc
@@ -0,0 +1,12 @@
+ifeq ($(CONFIG_ARCH_X86),y)
+
+ramstage-y += isa-dma.c
+ramstage-y += i8254.c
+ramstage-y += i8259.c
+ramstage-$(CONFIG_UDELAY_IO) += udelay_io.c
+romstage-$(CONFIG_UDELAY_IO) += udelay_io.c
+ramstage-y += keyboard.c
+ramstage-$(CONFIG_SPKMODEM) += spkmodem.c
+romstage-$(CONFIG_SPKMODEM) += spkmodem.c
+
+endif
diff --git a/src/drivers/pc80/i8254.c b/src/drivers/pc80/pc/i8254.c
index 5851ec08a0..5851ec08a0 100644
--- a/src/drivers/pc80/i8254.c
+++ b/src/drivers/pc80/pc/i8254.c
diff --git a/src/drivers/pc80/i8259.c b/src/drivers/pc80/pc/i8259.c
index 1cb49b1206..4261d5bec4 100644
--- a/src/drivers/pc80/i8259.c
+++ b/src/drivers/pc80/pc/i8259.c
@@ -29,7 +29,7 @@ u16 pic_read_irq_mask(void)
printk(BIOS_DEBUG, "8259 PIC: OCW1 IRQ Mask: 0x%x\n", mask);
printk(BIOS_SPEW, "\tEnabled IRQs (0 = Unmasked, 1 = Masked off):\n"
"\t\tMaster\t\tSlave\n");
- for(i = 0; i <= 7; i++) {
+ for (i = 0; i <= 7; i++) {
printk(BIOS_SPEW, "\t\tIRQ%X: %x\t\tIRQ%X: %x\n",
i, (mask >> i) & 1, i + 8, (mask >> (i + 8)) & 1);
}
@@ -53,8 +53,8 @@ void pic_write_irq_mask(u16 mask)
*/
void pic_irq_enable(u8 int_num, u8 mask)
{
- pic_write_irq_mask(pic_read_irq_mask() & ~(mask << int_num));
- pic_read_irq_mask();
+ pic_write_irq_mask(pic_read_irq_mask() & ~(mask << int_num));
+ pic_read_irq_mask();
}
void setup_i8259(void)
@@ -124,7 +124,8 @@ void i8259_configure_irq_trigger(int int_num, int is_level_triggered)
outb((u8)(int_bits >> 8), ELCR2);
#ifdef PARANOID_IRQ_TRIGGERS
- /* Try reading back the new values. This seems like an error but is not ... */
+ /* Try reading back the new values. This seems like an error
+ * but it is not. */
if (inb(ELCR1) != (int_bits & 0xff)) {
printk(BIOS_ERR, "%s: lower order bits are wrong: want 0x%x, got 0x%x\n",
__func__, (int_bits & 0xff), inb(ELCR1));
diff --git a/src/drivers/pc80/isa-dma.c b/src/drivers/pc80/pc/isa-dma.c
index b64f125f3a..b64f125f3a 100644
--- a/src/drivers/pc80/isa-dma.c
+++ b/src/drivers/pc80/pc/isa-dma.c
diff --git a/src/drivers/pc80/keyboard.c b/src/drivers/pc80/pc/keyboard.c
index 56b1fce93b..415dbd1d13 100644
--- a/src/drivers/pc80/keyboard.c
+++ b/src/drivers/pc80/pc/keyboard.c
@@ -67,6 +67,7 @@
static int kbc_input_buffer_empty(void)
{
u32 timeout;
+
for (timeout = KBC_TIMEOUT_IN_MS;
timeout && (inb(KBD_STATUS) & KBD_IBF); timeout--)
mdelay(1);
@@ -80,6 +81,7 @@ static int kbc_input_buffer_empty(void)
static int kbc_output_buffer_full(void)
{
u32 timeout;
+
for (timeout = KBC_TIMEOUT_IN_MS;
timeout && ((inb(KBD_STATUS) & KBD_OBF) == 0); timeout--)
mdelay(1);
@@ -93,6 +95,7 @@ static int kbc_output_buffer_full(void)
static int kbc_cleanup_buffers(void)
{
u32 timeout;
+
for (timeout = KBC_TIMEOUT_IN_MS;
timeout && (inb(KBD_STATUS) & (KBD_OBF | KBD_IBF)); timeout--) {
mdelay(1);
@@ -221,8 +224,10 @@ static u8 send_keyboard(u8 command)
* reset */
if (command == 0xFF) {
u8 retries;
+
for (retries = 9; retries && !kbc_output_buffer_full();
- retries--) ;
+ retries--)
+ ;
}
if (!kbc_output_buffer_full()) {
printk(BIOS_ERR,
@@ -288,7 +293,8 @@ uint8_t pc_keyboard_init(uint8_t probe_aux)
}
/* the reset command takes some time, so wait a little longer */
- for (retries = 9; retries && !kbc_output_buffer_full(); retries--) ;
+ for (retries = 9; retries && !kbc_output_buffer_full(); retries--)
+ ;
if (!kbc_output_buffer_full()) {
printk(BIOS_ERR, "Timeout waiting for keyboard after reset.\n");
diff --git a/src/drivers/pc80/ps2_controller.asl b/src/drivers/pc80/pc/ps2_controller.asl
index a4984cfdb9..a4984cfdb9 100644
--- a/src/drivers/pc80/ps2_controller.asl
+++ b/src/drivers/pc80/pc/ps2_controller.asl
diff --git a/src/drivers/pc80/spkmodem.c b/src/drivers/pc80/pc/spkmodem.c
index fe57e620bc..df66f6fa62 100644
--- a/src/drivers/pc80/spkmodem.c
+++ b/src/drivers/pc80/pc/spkmodem.c
@@ -43,7 +43,7 @@ enum {
PIT_CTRL_SELECT_1 = 0x40,
PIT_CTRL_SELECT_2 = 0x80,
- PIT_CTRL_READLOAD_MASK= 0x30,
+ PIT_CTRL_READLOAD_MASK = 0x30,
PIT_CTRL_COUNTER_LATCH = 0x00,
PIT_CTRL_READLOAD_LSB = 0x10,
PIT_CTRL_READLOAD_MSB = 0x20,
@@ -68,28 +68,28 @@ enum {
static void
-make_tone (uint16_t freq_count, unsigned int duration)
+make_tone(uint16_t freq_count, unsigned int duration)
{
- outb (PIT_CTRL_SELECT_2
+ outb(PIT_CTRL_SELECT_2
| PIT_CTRL_READLOAD_WORD
| PIT_CTRL_SQUAREWAVE_GEN
| PIT_CTRL_COUNT_BINARY, PIT_CTRL);
- outb (freq_count & 0xff, PIT_COUNTER_2);
+ outb(freq_count & 0xff, PIT_COUNTER_2);
- outb ((freq_count >> 8) & 0xff, PIT_COUNTER_2);
+ outb((freq_count >> 8) & 0xff, PIT_COUNTER_2);
- outb (inb (PIT_SPEAKER_PORT)
+ outb(inb(PIT_SPEAKER_PORT)
| PIT_SPK_TMR2 | PIT_SPK_DATA,
PIT_SPEAKER_PORT);
for (; duration; duration--) {
unsigned short counter, previous_counter = 0xffff;
+
while (1) {
- counter = inb (PIT_COUNTER_2);
- counter |= ((uint16_t) inb (PIT_COUNTER_2)) << 8;
- if (counter > previous_counter)
- {
+ counter = inb(PIT_COUNTER_2);
+ counter |= ((uint16_t)inb(PIT_COUNTER_2)) << 8;
+ if (counter > previous_counter) {
previous_counter = counter;
break;
}
@@ -102,20 +102,22 @@ void spkmodem_tx_byte(unsigned char c)
{
int i;
- make_tone (SPEAKER_PIT_FREQUENCY / 200, 4);
+ make_tone(SPEAKER_PIT_FREQUENCY / 200, 4);
for (i = 7; i >= 0; i--) {
if ((c >> i) & 1)
- make_tone (SPEAKER_PIT_FREQUENCY / 2000, 20);
+ make_tone(SPEAKER_PIT_FREQUENCY / 2000, 20);
else
- make_tone (SPEAKER_PIT_FREQUENCY / 4000, 40);
- make_tone (SPEAKER_PIT_FREQUENCY / 1000, 10);
+ make_tone(SPEAKER_PIT_FREQUENCY / 4000, 40);
+ make_tone(SPEAKER_PIT_FREQUENCY / 1000, 10);
}
- make_tone (SPEAKER_PIT_FREQUENCY / 200, 0);
+ make_tone(SPEAKER_PIT_FREQUENCY / 200, 0);
}
void spkmodem_init(void)
{
- /* Some cards need time to come online. Output some message to get it started. */
+ /* Some cards need time to come online.
+ * Output some message to get it started.
+ */
spkmodem_tx_byte('S');
spkmodem_tx_byte('P');
spkmodem_tx_byte('K');
diff --git a/src/drivers/pc80/udelay_io.c b/src/drivers/pc80/pc/udelay_io.c
index 1cdc6739c1..3305e4c3a3 100644
--- a/src/drivers/pc80/udelay_io.c
+++ b/src/drivers/pc80/pc/udelay_io.c
@@ -8,6 +8,7 @@ void init_timer(void)
void udelay(unsigned usecs)
{
int i;
- for(i = 0; i < usecs; i++)
+
+ for (i = 0; i < usecs; i++)
inb(0x80);
}
diff --git a/src/drivers/pc80/rtc/Kconfig b/src/drivers/pc80/rtc/Kconfig
new file mode 100644
index 0000000000..350863e99a
--- /dev/null
+++ b/src/drivers/pc80/rtc/Kconfig
@@ -0,0 +1,4 @@
+config DRIVERS_MC146818
+ bool
+ default y if ARCH_X86
+ depends on PC80_SYSTEM
diff --git a/src/drivers/pc80/Makefile.inc b/src/drivers/pc80/rtc/Makefile.inc
index f468318dd5..d3b3344938 100644
--- a/src/drivers/pc80/Makefile.inc
+++ b/src/drivers/pc80/rtc/Makefile.inc
@@ -1,20 +1,10 @@
ifeq ($(CONFIG_ARCH_X86),y)
-romstage-$(CONFIG_DRIVERS_MC146818) += mc146818rtc.c
-ramstage-$(CONFIG_DRIVERS_MC146818) += mc146818rtc.c
-ramstage-y += isa-dma.c
-ramstage-y += i8254.c
-ramstage-y += i8259.c
-romstage-$(CONFIG_UDELAY_IO) += udelay_io.c
-ramstage-$(CONFIG_UDELAY_IO) += udelay_io.c
-ramstage-y += keyboard.c
-ramstage-$(CONFIG_SPKMODEM) += spkmodem.c
-
romstage-$(CONFIG_DRIVERS_MC146818) += mc146818rtc_early.c
+romstage-$(CONFIG_DRIVERS_MC146818) += mc146818rtc.c
-romstage-$(CONFIG_SPKMODEM) += spkmodem.c
-
-subdirs-y += tpm vga
+ramstage-$(CONFIG_DRIVERS_MC146818) += mc146818rtc_early.c
+ramstage-$(CONFIG_DRIVERS_MC146818) += mc146818rtc.c
cbfs-files-$(CONFIG_HAVE_CMOS_DEFAULT) += cmos.default
cmos.default-file = $(CONFIG_CMOS_DEFAULT_FILE):nvramtool
diff --git a/src/drivers/pc80/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c
index 6c39f812b9..35dad3256a 100644
--- a/src/drivers/pc80/mc146818rtc.c
+++ b/src/drivers/pc80/rtc/mc146818rtc.c
@@ -38,11 +38,11 @@
#if (defined(__PRE_RAM__) && \
IS_ENABLED(CONFIG_HAVE_ROMSTAGE_NVRAM_CBFS_SPINLOCK))
- #define LOCK_NVRAM_CBFS_SPINLOCK spin_lock(romstage_nvram_cbfs_lock());
- #define UNLOCK_NVRAM_CBFS_SPINLOCK spin_unlock(romstage_nvram_cbfs_lock());
+ #define LOCK_NVRAM_CBFS_SPINLOCK() spin_lock(romstage_nvram_cbfs_lock())
+ #define UNLOCK_NVRAM_CBFS_SPINLOCK() spin_unlock(romstage_nvram_cbfs_lock())
#else
- #define LOCK_NVRAM_CBFS_SPINLOCK
- #define UNLOCK_NVRAM_CBFS_SPINLOCK
+ #define LOCK_NVRAM_CBFS_SPINLOCK() { }
+ #define UNLOCK_NVRAM_CBFS_SPINLOCK() { }
#endif
static void cmos_reset_date(void)
@@ -63,11 +63,12 @@ static void cmos_reset_date(void)
static int cmos_checksum_valid(int range_start, int range_end, int cks_loc)
{
+ int i;
+ u16 sum, old_sum;
+
if (IS_ENABLED(CONFIG_STATIC_OPTION_TABLE))
return 1;
- int i;
- u16 sum, old_sum;
sum = 0;
for (i = range_start; i <= range_end; i++)
sum += cmos_read(i);
@@ -80,6 +81,7 @@ static void cmos_set_checksum(int range_start, int range_end, int cks_loc)
{
int i;
u16 sum;
+
sum = 0;
for (i = range_start; i <= range_end; i++)
sum += cmos_read(i);
@@ -155,7 +157,7 @@ void cmos_init(bool invalid)
if (IS_ENABLED(CONFIG_USE_OPTION_TABLE)) {
/* See if there is a LB CMOS checksum error */
checksum_invalid = !cmos_checksum_valid(LB_CKS_RANGE_START,
- LB_CKS_RANGE_END,LB_CKS_LOC);
+ LB_CKS_RANGE_END, LB_CKS_LOC);
if (checksum_invalid)
printk(BIOS_DEBUG, "RTC: coreboot checksum invalid\n");
@@ -180,7 +182,7 @@ static enum cb_err get_cmos_value(unsigned long bit, unsigned long length,
void *vret)
{
unsigned char *ret;
- unsigned long byte,byte_bit;
+ unsigned long byte, byte_bit;
unsigned long i;
unsigned char uchar;
@@ -215,7 +217,7 @@ enum cb_err get_option(void *dest, const char *name)
if (!IS_ENABLED(CONFIG_USE_OPTION_TABLE))
return CB_CMOS_OTABLE_DISABLED;
- LOCK_NVRAM_CBFS_SPINLOCK
+ LOCK_NVRAM_CBFS_SPINLOCK();
/* Figure out how long name is */
namelen = strnlen(name, CMOS_MAX_NAME_LENGTH);
@@ -227,12 +229,12 @@ enum cb_err get_option(void *dest, const char *name)
printk(BIOS_ERR, "RTC: cmos_layout.bin could not be found. "
"Options are disabled\n");
- UNLOCK_NVRAM_CBFS_SPINLOCK
+ UNLOCK_NVRAM_CBFS_SPINLOCK();
return CB_CMOS_LAYOUT_NOT_FOUND;
}
- ce = (struct cmos_entries*)((unsigned char *)ct + ct->header_length);
- for(; ce->tag == LB_TAG_OPTION;
- ce = (struct cmos_entries*)((unsigned char *)ce + ce->size)) {
+ ce = (struct cmos_entries *)((unsigned char *)ct + ct->header_length);
+ for (; ce->tag == LB_TAG_OPTION;
+ ce = (struct cmos_entries *)((unsigned char *)ce + ce->size)) {
if (memcmp(ce->name, name, namelen) == 0) {
found = 1;
break;
@@ -240,19 +242,19 @@ enum cb_err get_option(void *dest, const char *name)
}
if (!found) {
printk(BIOS_DEBUG, "WARNING: No CMOS option '%s'.\n", name);
- UNLOCK_NVRAM_CBFS_SPINLOCK
+ UNLOCK_NVRAM_CBFS_SPINLOCK();
return CB_CMOS_OPTION_NOT_FOUND;
}
if (get_cmos_value(ce->bit, ce->length, dest) != CB_SUCCESS) {
- UNLOCK_NVRAM_CBFS_SPINLOCK
+ UNLOCK_NVRAM_CBFS_SPINLOCK();
return CB_CMOS_ACCESS_ERROR;
}
if (!cmos_checksum_valid(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC)) {
- UNLOCK_NVRAM_CBFS_SPINLOCK
+ UNLOCK_NVRAM_CBFS_SPINLOCK();
return CB_CMOS_CHECKSUM_INVALID;
}
- UNLOCK_NVRAM_CBFS_SPINLOCK
+ UNLOCK_NVRAM_CBFS_SPINLOCK();
return CB_SUCCESS;
}
@@ -260,7 +262,7 @@ static enum cb_err set_cmos_value(unsigned long bit, unsigned long length,
void *vret)
{
unsigned char *ret;
- unsigned long byte,byte_bit;
+ unsigned long byte, byte_bit;
unsigned long i;
unsigned char uchar, mask;
unsigned int chksum_update_needed = 0;
@@ -319,9 +321,9 @@ enum cb_err set_option(const char *name, void *value)
"Options are disabled\n");
return CB_CMOS_LAYOUT_NOT_FOUND;
}
- ce = (struct cmos_entries*)((unsigned char *)ct + ct->header_length);
- for(; ce->tag == LB_TAG_OPTION;
- ce = (struct cmos_entries*)((unsigned char *)ce + ce->size)) {
+ ce = (struct cmos_entries *)((unsigned char *)ct + ct->header_length);
+ for (; ce->tag == LB_TAG_OPTION;
+ ce = (struct cmos_entries *)((unsigned char *)ce + ce->size)) {
if (memcmp(ce->name, name, namelen) == 0) {
found = 1;
break;
@@ -338,11 +340,11 @@ enum cb_err set_option(const char *name, void *value)
/* make sure the string is null terminated */
if (set_cmos_value(ce->bit + ce->length - 8, 8, &(u8[]){0})
!= CB_SUCCESS)
- return (CB_CMOS_ACCESS_ERROR);
+ return CB_CMOS_ACCESS_ERROR;
}
if (set_cmos_value(ce->bit, length, value) != CB_SUCCESS)
- return (CB_CMOS_ACCESS_ERROR);
+ return CB_CMOS_ACCESS_ERROR;
return CB_SUCCESS;
}
@@ -352,7 +354,7 @@ enum cb_err set_option(const char *name, void *value)
* hurts some OSes. Even if we don't set USE_OPTION_TABLE, we need
* to make sure the date is valid.
*/
-void cmos_check_update_date()
+void cmos_check_update_date(void)
{
u8 year, century;
@@ -369,7 +371,8 @@ void cmos_check_update_date()
cmos_reset_date();
}
-int rtc_set(const struct rtc_time *time){
+int rtc_set(const struct rtc_time *time)
+{
cmos_write(bin2bcd(time->sec), RTC_CLK_SECOND);
cmos_write(bin2bcd(time->min), RTC_CLK_MINUTE);
cmos_write(bin2bcd(time->hour), RTC_CLK_HOUR);
diff --git a/src/drivers/pc80/mc146818rtc_early.c b/src/drivers/pc80/rtc/mc146818rtc_early.c
index 3ff5d4fb3e..8bebc4229d 100644
--- a/src/drivers/pc80/mc146818rtc_early.c
+++ b/src/drivers/pc80/rtc/mc146818rtc_early.c
@@ -22,11 +22,11 @@ static int cmos_chksum_valid(void)
#if CONFIG_USE_OPTION_TABLE
unsigned char addr;
u16 sum, old_sum;
+
sum = 0;
/* Compute the cmos checksum */
- for(addr = LB_CKS_RANGE_START; addr <= LB_CKS_RANGE_END; addr++) {
+ for (addr = LB_CKS_RANGE_START; addr <= LB_CKS_RANGE_END; addr++)
sum += cmos_read(addr);
- }
/* Read the stored checksum */
old_sum = cmos_read(LB_CKS_LOC) << 8;
@@ -95,6 +95,7 @@ unsigned read_option_lowlevel(unsigned start, unsigned size, unsigned def)
{
#if CONFIG_USE_OPTION_TABLE
unsigned byte;
+
byte = cmos_read(start/8);
return (byte >> (start & 7U)) & ((1U << size) - 1U);
#else
diff --git a/src/drivers/pc80/tpm/Makefile.inc b/src/drivers/pc80/tpm/Makefile.inc
index 697842fa03..0068ff19a6 100644
--- a/src/drivers/pc80/tpm/Makefile.inc
+++ b/src/drivers/pc80/tpm/Makefile.inc
@@ -1,4 +1,8 @@
+ifeq ($(CONFIG_ARCH_X86),y)
+
verstage-$(CONFIG_LPC_TPM) += tpm.c
romstage-$(CONFIG_LPC_TPM) += tpm.c
ramstage-$(CONFIG_LPC_TPM) += tpm.c
romstage-$(CONFIG_LPC_TPM) += romstage.c
+
+endif
diff --git a/src/drivers/pc80/vga/Makefile.inc b/src/drivers/pc80/vga/Makefile.inc
index d4b726a388..3e31de1ddf 100644
--- a/src/drivers/pc80/vga/Makefile.inc
+++ b/src/drivers/pc80/vga/Makefile.inc
@@ -1,4 +1,8 @@
+ifeq ($(CONFIG_ARCH_X86),y)
+
ramstage-$(CONFIG_VGA) += vga_io.c
ramstage-$(CONFIG_VGA) += vga_palette.c
ramstage-$(CONFIG_VGA) += vga_font_8x16.c
ramstage-$(CONFIG_VGA) += vga.c
+
+endif
diff --git a/src/ec/compal/ene932/acpi/superio.asl b/src/ec/compal/ene932/acpi/superio.asl
index 5474cdc9f5..8eba623417 100644
--- a/src/ec/compal/ene932/acpi/superio.asl
+++ b/src/ec/compal/ene932/acpi/superio.asl
@@ -21,6 +21,6 @@ Device (SIO) {
// Keyboard or AUX port (a.k.a Mouse)
#ifdef SIO_EC_ENABLE_PS2K
- #include <drivers/pc80/ps2_controller.asl>
+ #include <drivers/pc80/pc/ps2_controller.asl>
#endif
}
diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h
index 38f2ad085c..f5630c586b 100644
--- a/src/include/pc80/mc146818rtc.h
+++ b/src/include/pc80/mc146818rtc.h
@@ -179,7 +179,7 @@ enum cb_err get_option(void *dest, const char *name);
unsigned read_option_lowlevel(unsigned start, unsigned size, unsigned def);
#else /* defined(__ROMCC__) */
-#include <drivers/pc80/mc146818rtc_early.c>
+#include <drivers/pc80/rtc/mc146818rtc_early.c>
#endif /* !defined(__ROMCC__) */
#define read_option(name, default) read_option_lowlevel(CMOS_VSTART_ ##name, CMOS_VLEN_ ##name, (default))
diff --git a/src/mainboard/dmp/vortex86ex/romstage.c b/src/mainboard/dmp/vortex86ex/romstage.c
index d84af32684..a6aa59b5dc 100644
--- a/src/mainboard/dmp/vortex86ex/romstage.c
+++ b/src/mainboard/dmp/vortex86ex/romstage.c
@@ -21,7 +21,7 @@
#include <console/console.h>
#include <cpu/x86/cache.h>
#include <halt.h>
-#include "drivers/pc80/i8254.c"
+#include "drivers/pc80/pc/i8254.c"
#include <northbridge/dmp/vortex86ex/northbridge.h>
#include <southbridge/dmp/vortex86ex/southbridge.h>
#include "northbridge/dmp/vortex86ex/raminit.c"
diff --git a/src/mainboard/jetway/nf81-t56n-lf/acpi/superio.asl b/src/mainboard/jetway/nf81-t56n-lf/acpi/superio.asl
index 713a12587b..4f23d99904 100644
--- a/src/mainboard/jetway/nf81-t56n-lf/acpi/superio.asl
+++ b/src/mainboard/jetway/nf81-t56n-lf/acpi/superio.asl
@@ -15,4 +15,4 @@
* GNU General Public License for more details.
*/
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/t420/acpi/superio.asl b/src/mainboard/lenovo/t420/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/t420/acpi/superio.asl
+++ b/src/mainboard/lenovo/t420/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/t420s/acpi/superio.asl b/src/mainboard/lenovo/t420s/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/t420s/acpi/superio.asl
+++ b/src/mainboard/lenovo/t420s/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/t430s/acpi/superio.asl b/src/mainboard/lenovo/t430s/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/t430s/acpi/superio.asl
+++ b/src/mainboard/lenovo/t430s/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/t520/acpi/superio.asl b/src/mainboard/lenovo/t520/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/t520/acpi/superio.asl
+++ b/src/mainboard/lenovo/t520/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/t530/acpi/superio.asl b/src/mainboard/lenovo/t530/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/t530/acpi/superio.asl
+++ b/src/mainboard/lenovo/t530/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/x201/acpi/superio.asl b/src/mainboard/lenovo/x201/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/x201/acpi/superio.asl
+++ b/src/mainboard/lenovo/x201/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/x220/acpi/superio.asl b/src/mainboard/lenovo/x220/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/x220/acpi/superio.asl
+++ b/src/mainboard/lenovo/x220/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/x230/acpi/superio.asl b/src/mainboard/lenovo/x230/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/lenovo/x230/acpi/superio.asl
+++ b/src/mainboard/lenovo/x230/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/packardbell/ms2290/acpi/superio.asl b/src/mainboard/packardbell/ms2290/acpi/superio.asl
index 03b65bc816..f2b35ba9c1 100644
--- a/src/mainboard/packardbell/ms2290/acpi/superio.asl
+++ b/src/mainboard/packardbell/ms2290/acpi/superio.asl
@@ -1 +1 @@
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/purism/librem13/acpi/superio.asl b/src/mainboard/purism/librem13/acpi/superio.asl
index 6b18bb58d5..92c272e4b6 100644
--- a/src/mainboard/purism/librem13/acpi/superio.asl
+++ b/src/mainboard/purism/librem13/acpi/superio.asl
@@ -13,4 +13,4 @@
* GNU General Public License for more details.
*/
-#include <drivers/pc80/ps2_controller.asl>
+#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/northbridge/via/vx900/Makefile.inc b/src/northbridge/via/vx900/Makefile.inc
index 44f0ae01ce..b46f8809d6 100644
--- a/src/northbridge/via/vx900/Makefile.inc
+++ b/src/northbridge/via/vx900/Makefile.inc
@@ -27,7 +27,7 @@ romstage-y += ./../../../southbridge/via/common/early_smbus_is_busy.c
romstage-y += ./../../../southbridge/via/common/early_smbus_print_error.c
romstage-y += ./../../../southbridge/via/common/early_smbus_reset.c
romstage-y += ./../../../southbridge/via/common/early_smbus_wait_until_ready.c
-romstage-y += ./../../../drivers/pc80/udelay_io.c
+romstage-y += ./../../../drivers/pc80/pc/udelay_io.c
ramstage-y += pci_util.c
ramstage-y += pcie.c