summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2024-06-02 18:07:17 +0200
committerAngel Pons <th3fanbus@gmail.com>2024-11-21 09:25:04 +0000
commit60f388f9845afdf50eb51f5a06f03cd6d72988b1 (patch)
tree61beaa56c4ee41fb96d553c0aad361e035147deb /src
parentcae704d236f6c473f29e2f08ad4ce80628d38e5a (diff)
nb/via/cx700: Implement FSB tuning
This northbridge provides a lot of knobs for fine-grained tuning of the FSB drivers. The programming manual calls this "Host AGTL+ I/O Driving Control". We program the known good values for use with a VIA C7 CPU, and warn about use with different CPUs. The numbers were pulled out of raminit of the original CX700 port. Originally, there was a write to 0x83 as well, to set bit 1 which triggers a soft reset of the CPU. It was amidst a table, so it seems unclear if it was put there intentionally. Change-Id: I24ba6cfaab2ca3069952a6c399a065caea7b49f2 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82769 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/northbridge/via/cx700/romstage.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/northbridge/via/cx700/romstage.c b/src/northbridge/via/cx700/romstage.c
index f4c5584c30..f6999a3bb3 100644
--- a/src/northbridge/via/cx700/romstage.c
+++ b/src/northbridge/via/cx700/romstage.c
@@ -1,10 +1,53 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <stddef.h>
+#include <stdint.h>
+#include <commonlib/bsd/helpers.h>
+#include <device/pci_ops.h>
+#include <static_devices.h>
#include <romstage_common.h>
#include <halt.h>
+static void tune_fsb(void)
+{
+ if (!CONFIG(CPU_VIA_C7)) {
+ printk(BIOS_WARNING,
+ "FSB settings are known for VIA C7 CPUs, P4 compat. is unknown.\n");
+ }
+ static const struct {
+ uint8_t reg;
+ uint8_t val;
+ } fsb_settings[] = {
+ { 0x70, 0x33 },
+ { 0x71, 0x11 },
+ { 0x72, 0x33 },
+ { 0x73, 0x11 },
+ { 0x74, 0x20 },
+ { 0x75, 0x2e },
+ { 0x76, 0x64 },
+ { 0x77, 0x00 },
+ { 0x78, 0x44 },
+ { 0x79, 0xaa },
+ { 0x7a, 0x33 },
+ { 0x7b, 0xaa },
+ { 0x7c, 0x00 },
+ { 0x7e, 0x33 },
+ { 0x7f, 0x33 },
+ { 0x80, 0x44 },
+ { 0x81, 0x44 },
+ { 0x82, 0x44 },
+ };
+ for (size_t i = 0; i < ARRAY_SIZE(fsb_settings); ++i)
+ pci_write_config8(_sdev_host_if, fsb_settings[i].reg, fsb_settings[i].val);
+}
+
void __noreturn romstage_main(void)
{
+ /* Allows access to all northbridge PCI devfn's */
+ pci_write_config8(_sdev_host_ctrl, 0x4f, 0x01);
+
+ tune_fsb();
+
/* Needed for __noreturn */
halt();
}