Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36382 )
Change subject: cpu/x86/mtrr: Add function to set MTRR with CR0.CD set
......................................................................
cpu/x86/mtrr: Add function to set MTRR with CR0.CD set
MTRRs should only be changed when CR0.CD is set. In a CAR environment
this is a rather fragile thing to do. This is why it is best to
implement this in assembly.
Change-Id: I4ff59d35ade125f60ed0002a386f41fd8ad54073
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/cpu/x86/mtrr/Makefile.inc
M src/cpu/x86/mtrr/earlymtrr.c
A src/cpu/x86/mtrr/set_mtrr.S
M src/include/cpu/x86/mtrr.h
4 files changed, 88 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/36382/1
diff --git a/src/cpu/x86/mtrr/Makefile.inc b/src/cpu/x86/mtrr/Makefile.inc
index caa6e9c..4052c52 100644
--- a/src/cpu/x86/mtrr/Makefile.inc
+++ b/src/cpu/x86/mtrr/Makefile.inc
@@ -3,6 +3,9 @@
romstage-y += earlymtrr.c
bootblock-y += earlymtrr.c
+bootblock-y += set_mtrr.S
+verstage-y += set_mtrr.S
+
bootblock-y += debug.c
romstage-y += debug.c
postcar-y += debug.c
diff --git a/src/cpu/x86/mtrr/earlymtrr.c b/src/cpu/x86/mtrr/earlymtrr.c
index 02dfbdc..2f6a64d 100644
--- a/src/cpu/x86/mtrr/earlymtrr.c
+++ b/src/cpu/x86/mtrr/earlymtrr.c
@@ -52,3 +52,17 @@
maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
wrmsr(MTRR_PHYS_MASK(reg), maskm);
}
+
+void set_var_mtrr_uncached(
+ unsigned int reg, unsigned int base, unsigned int size,
+ unsigned int type)
+{
+ /* Bit Bit 32-35 of MTRRphysMask should be set to 1 */
+ /* FIXME: It only support 4G less range */
+ msr_t basem, maskm;
+ basem.lo = base | type;
+ basem.hi = 0;
+ maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
+ maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
+ set_var_mtrr_uncached_asm(reg, basem, maskm);
+}
diff --git a/src/cpu/x86/mtrr/set_mtrr.S b/src/cpu/x86/mtrr/set_mtrr.S
new file mode 100644
index 0000000..43c19f7
--- /dev/null
+++ b/src/cpu/x86/mtrr/set_mtrr.S
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include <cpu/x86/mtrr.h>
+#include <cpu/x86/cache.h>
+#include <cpu/x86/post_code.h>
+.global set_var_mtrr_uncached_asm
+ /* ARG0: mtrr_num
+ * ARG1: mtrr_base.lo
+ * ARG2: mtrr_base.hi
+ * ARG3: mtrr_mask.lo
+ * ARG4: mtrr_mask.hi
+ */
+.code32
+set_var_mtrr_uncached_asm:
+ /* Callee saved registers */
+ pushl %ebp
+ movl %esp, %ebp
+ addl $8, %ebp
+ pushl %ebx
+ pushl %edx
+ pushl %esi
+ pushl %edi
+
+ movl 0(%ebp), %ecx
+ movl 4(%ebp), %ebx
+ movl 8(%ebp), %edx
+ movl 12(%ebp), %esi
+ movl 16(%ebp), %edi
+
+ /* Disable caching before setting MTRR */
+ movl %cr0, %eax
+ orl $CR0_CacheDisable, %eax
+ movl %eax, %cr0
+
+ /* MTRR_PHYS_BASE */
+ imul $2, %ecx, %ecx
+ addl $MTRR_PHYS_BASE(0), %ecx
+ movl %ebx, %eax
+ wrmsr
+ /* MTRR_PHYS_MASK */
+ addl $1, %ecx
+ movl %esi, %eax
+ movl %edi, %edx
+ wrmsr
+
+ /* Enable cache again. */
+ movl %cr0, %eax
+ andl $(~(CR0_CacheDisable | CR0_NoWriteThrough)), %eax
+ movl %eax, %cr0
+
+ /* Restore Callee saved registers */
+ popl %edi
+ popl %esi
+ popl %edx
+ popl %ebx
+ popl %ebp
+ ret
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 29256c8..103388f 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -107,6 +107,10 @@
void set_var_mtrr(unsigned int reg, unsigned int base, unsigned int size,
unsigned int type);
int get_free_var_mtrr(void);
+void set_var_mtrr_uncached(unsigned int reg, unsigned int base,
+ unsigned int size, unsigned int type);
+__attribute__((cdecl)) void set_var_mtrr_uncached_asm(unsigned int reg,
+ msr_t base, msr_t mask);
asmlinkage void display_mtrrs(void);
--
To view, visit https://review.coreboot.org/c/coreboot/+/36382
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I4ff59d35ade125f60ed0002a386f41fd8ad54073
Gerrit-Change-Number: 36382
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange
Mike Banon has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33871
Change subject: src/mainboard/asus/am1i-a: Disable SeaBIOS options not supported by hardware
......................................................................
src/mainboard/asus/am1i-a: Disable SeaBIOS options not supported by hardware
AM1I-A does not have any SAS or NVMe controllers, so it makes sense
to disable the related SeaBIOS options for this motherboard.
This reduces the size of compiled SeaBIOS by 129344-124096 = 5248 bytes.
Signed-off-by: Mike Banon <mikebdp2(a)gmail.com>
Change-Id: I5ddf695f4f349697d08a685fa04c90d3afd723c5
---
M src/mainboard/asus/am1i-a/Kconfig
A src/mainboard/asus/am1i-a/config_seabios
2 files changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/71/33871/1
diff --git a/src/mainboard/asus/am1i-a/Kconfig b/src/mainboard/asus/am1i-a/Kconfig
index d50edbe..6d88992 100644
--- a/src/mainboard/asus/am1i-a/Kconfig
+++ b/src/mainboard/asus/am1i-a/Kconfig
@@ -54,4 +54,8 @@
bool
default n
+config PAYLOAD_CONFIGFILE
+ string
+ default "$(top)/src/mainboard/$(MAINBOARDDIR)/config_seabios" if PAYLOAD_SEABIOS
+
endif # BOARD_ASUS_AM1I_A
diff --git a/src/mainboard/asus/am1i-a/config_seabios b/src/mainboard/asus/am1i-a/config_seabios
new file mode 100644
index 0000000..0ee9cea
--- /dev/null
+++ b/src/mainboard/asus/am1i-a/config_seabios
@@ -0,0 +1,6 @@
+###
+### SeaBIOS custom configuration for ASUS AM1I-A
+###
+# CONFIG_MEGASAS is not set
+# CONFIG_NVME is not set
+#
--
To view, visit https://review.coreboot.org/c/coreboot/+/33871
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5ddf695f4f349697d08a685fa04c90d3afd723c5
Gerrit-Change-Number: 33871
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-MessageType: newchange
Peter Lemenkov has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35900 )
Change subject: mb/*/*/gpio: Remove null-initialized members
......................................................................
mb/*/*/gpio: Remove null-initialized members
Made with this oneliner:
$ find src/mainboard/ -type f -name gpio.c -print -exec sed -i -e '/^\s*.gpio[0-9]\+\s*=\s*\(GPIO_MODE_NATIVE\|GPIO_DIR_OUTPUT\|GPIO_NO_INVERT\|GPIO_LEVEL_LOW\|GPIO_NO_BLINK\|GPIO_RESET_PWROK\)\s*$/d' {} \;
It didn't touch lines with comments.
Change-Id: I2799293585bcfcf41c93a9dbe358cd806f9374f5
Signed-off-by: Peter Lemenkov <lemenkov(a)gmail.com>
---
M src/mainboard/apple/macbook21/gpio.c
M src/mainboard/apple/macbookair4_2/gpio.c
M src/mainboard/asrock/b75pro3-m/gpio.c
M src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/gpio.c
M src/mainboard/asrock/g41c-gs/variants/g41c-gs/gpio.c
M src/mainboard/asrock/g41c-gs/variants/g41m-gs/gpio.c
M src/mainboard/asrock/g41c-gs/variants/g41m-s3/gpio.c
M src/mainboard/asrock/g41c-gs/variants/g41m-vs3-r2/gpio.c
M src/mainboard/asrock/h81m-hds/gpio.c
M src/mainboard/asus/h61m-cs/gpio.c
M src/mainboard/asus/maximus_iv_gene-z/gpio.c
M src/mainboard/asus/p5gc-mx/gpio.c
M src/mainboard/asus/p5qc/gpio.c
M src/mainboard/asus/p5qc/variants/p5ql_pro/gpio.c
M src/mainboard/asus/p5qpl-am/variants/p5g41t-m_lx/gpio.c
M src/mainboard/asus/p5qpl-am/variants/p5qpl-am/gpio.c
M src/mainboard/asus/p8h61-m_lx/gpio.c
M src/mainboard/asus/p8h61-m_pro/gpio.c
M src/mainboard/asus/p8z77-m_pro/gpio.c
M src/mainboard/compulab/intense_pc/gpio.c
M src/mainboard/foxconn/d41s/gpio.c
M src/mainboard/foxconn/g41s-k/gpio.c
M src/mainboard/getac/p470/gpio.c
M src/mainboard/gigabyte/ga-945gcm-s2l/gpio.c
M src/mainboard/gigabyte/ga-b75m-d3h/variants/ga-b75m-d3h/gpio.c
M src/mainboard/gigabyte/ga-b75m-d3h/variants/ga-b75m-d3v/gpio.c
M src/mainboard/gigabyte/ga-g41m-es2l/gpio.c
M src/mainboard/gigabyte/ga-h61m-s2pv/variants/ga-h61m-s2pv/gpio.c
M src/mainboard/gigabyte/ga-h61m-s2pv/variants/ga-h61ma-d3v/gpio.c
M src/mainboard/google/link/gpio.c
M src/mainboard/google/parrot/gpio.c
M src/mainboard/google/stout/gpio.c
M src/mainboard/hp/2570p/gpio.c
M src/mainboard/hp/2760p/gpio.c
M src/mainboard/hp/8460p/gpio.c
M src/mainboard/hp/8470p/gpio.c
M src/mainboard/hp/8770w/gpio.c
M src/mainboard/hp/compaq_8200_elite_sff/gpio.c
M src/mainboard/hp/folio_9470m/gpio.c
M src/mainboard/hp/revolve_810_g1/gpio.c
M src/mainboard/hp/z220_sff_workstation/gpio.c
M src/mainboard/ibase/mb899/gpio.c
M src/mainboard/intel/d510mo/gpio.c
M src/mainboard/intel/d945gclf/gpio.c
M src/mainboard/intel/dcp847ske/gpio.c
M src/mainboard/intel/dg41wv/gpio.c
M src/mainboard/intel/dg43gt/gpio.c
M src/mainboard/kontron/986lcd-m/gpio.c
M src/mainboard/lenovo/l520/gpio.c
M src/mainboard/lenovo/s230u/gpio.c
M src/mainboard/lenovo/t400/variants/r500/gpio.c
M src/mainboard/lenovo/t400/variants/t400/gpio.c
M src/mainboard/lenovo/t420/gpio.c
M src/mainboard/lenovo/t420s/gpio.c
M src/mainboard/lenovo/t430s/variants/t430s/gpio.c
M src/mainboard/lenovo/t430s/variants/t431s/gpio.c
M src/mainboard/lenovo/t520/variants/t520/gpio.c
M src/mainboard/lenovo/t520/variants/w520/gpio.c
M src/mainboard/lenovo/t530/variants/t530/gpio.c
M src/mainboard/lenovo/t530/variants/w530/gpio.c
M src/mainboard/lenovo/t60/gpio.c
M src/mainboard/lenovo/thinkcentre_a58/gpio.c
M src/mainboard/lenovo/x131e/gpio.c
M src/mainboard/lenovo/x1_carbon_gen1/gpio.c
M src/mainboard/lenovo/x200/gpio.c
M src/mainboard/lenovo/x201/gpio.c
M src/mainboard/lenovo/x220/variants/x1/gpio.c
M src/mainboard/lenovo/x220/variants/x220/gpio.c
M src/mainboard/lenovo/x230/gpio.c
M src/mainboard/lenovo/x60/gpio.c
M src/mainboard/msi/ms7707/gpio.c
M src/mainboard/packardbell/ms2290/gpio.c
M src/mainboard/roda/rk886ex/gpio.c
M src/mainboard/roda/rk9/gpio.c
M src/mainboard/roda/rv11/gpio.c
M src/mainboard/samsung/lumpy/gpio.c
M src/mainboard/samsung/stumpy/gpio.c
M src/mainboard/sapphire/pureplatinumh61/gpio.c
M src/mainboard/supermicro/x10slm-f/gpio.c
79 files changed, 0 insertions(+), 4,228 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/35900/1
--
To view, visit https://review.coreboot.org/c/coreboot/+/35900
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I2799293585bcfcf41c93a9dbe358cd806f9374f5
Gerrit-Change-Number: 35900
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Lemenkov <lemenkov(a)gmail.com>
Gerrit-MessageType: newchange