Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/144
-gerrit
commit bee34194cc0150263618cabd80978272f9816d8e
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Tue May 21 12:35:08 2013 -0500
early_smbus: Add early SMBus implementation for VIA chipsets
Add a common implementation of SMBus functionality for early chipsets. Note
however, that existing via chipsets are not ported to this code. Porting
will require hardware testing to make sure everything is fine.
This code is used in the VIA VX900 branch.
Change-Id: If5ad8cd0942ac02d358a0139967e7d85d395660f
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/southbridge/via/common/early_smbus.c | 176 +++++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
diff --git a/src/southbridge/via/common/early_smbus.c b/src/southbridge/via/common/early_smbus.c
new file mode 100644
index 0000000..262d641
--- /dev/null
+++ b/src/southbridge/via/common/early_smbus.c
@@ -0,0 +1,176 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011-2013 Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
+ *
+ * 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, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file via_early_sambus.c
+ *
+ * This file defines the implementations for the functions defined in
+ * device/early/smbus.h
+ *
+ * These implementations work with most via chipsets. Any VIA port should try
+ * to use these. Makefile.inc needs to be adapted to link against this file
+ * during romstage:
+ * @code
+ * romstage-y += ./../../../southbridge/via/common/early_smbus.c
+ * @endcode
+ *
+ * These functions are marked weak in the event that one or more might need to
+ * be overridden. This may be the case when, for example, a chipset needs a
+ * longer delay for a specific operation.
+ */
+
+#include <device/early_smbus.h>
+
+#include <arch/io.h>
+
+/**
+ * \brief SMBus IO ports in relation to the base IO port
+ */
+#define SMBHSTSTAT(base) (u16)(u32)base + 0x0
+#define SMBSLVSTAT(base) (u16)(u32)base + 0x1
+#define SMBHSTCTL(base) (u16)(u32)base + 0x2
+#define SMBHSTCMD(base) (u16)(u32)base + 0x3
+#define SMBXMITADD(base) (u16)(u32)base + 0x4
+#define SMBHSTDAT0(base) (u16)(u32)base + 0x5
+#define SMBHSTDAT1(base) (u16)(u32)base + 0x6
+#define SMBBLKDAT(base) (u16)(u32)base + 0x7
+#define SMBSLVCTL(base) (u16)(u32)base + 0x8
+#define SMBTRNSADD(base) (u16)(u32)base + 0x9
+#define SMBSLVDATA (base) (u16)(u32)base + 0xa
+
+#define SMBUS_TIMEOUT (100*1000*10)
+
+/**
+ * \brief Brief delay for SMBus transactions
+ */
+void smbus_delay(void)
+{
+ inb(0x80);
+}
+
+/**
+ * \brief Clear the SMBus host status register
+ *
+ * @param smbus_dev The base SMBus IO port
+ */
+__attribute__ ((weak))
+void smbus_reset(u32 smbus_dev)
+{
+ outb(0xdf, SMBHSTSTAT(smbus_dev));
+}
+
+/**
+ * \brief Print an error, should it occur. If no error, just exit.
+ *
+ * @param smbus_dev The base SMBus IO port
+ * @param host_status The data returned on the host status register after
+ * a transaction is processed.
+ * @param loops The number of times a transaction was attempted.
+ * @return 0 if no error occurred
+ * 1 if an error was detected
+ */
+__attribute__ ((weak))
+int smbus_print_error(u32 smbus_dev, u8 host_status, int loops)
+{
+ /* Check if there actually was an error. */
+ if ((host_status == 0x00 || host_status == 0x40 ||
+ host_status == 0x42) && (loops < SMBUS_TIMEOUT))
+ return 0;
+
+ if (loops >= SMBUS_TIMEOUT)
+ printsmbus("SMBus timeout\n");
+ if (host_status & (1 << 4))
+ printsmbus("Interrupt/SMI# was Failed Bus Transaction\n");
+ if (host_status & (1 << 3))
+ printsmbus("Bus error\n");
+ if (host_status & (1 << 2))
+ printsmbus("Device error\n");
+ if (host_status & (1 << 1))
+ printsmbus("Interrupt/SMI# completed successfully\n");
+ if (host_status & (1 << 0))
+ printsmbus("Host busy\n");
+ return 1;
+}
+
+/**
+ * \brief Checks if the SMBus is currently busy with a transaction
+ *
+ * @param smbus_dev The base SMBus IO port
+ */
+__attribute__ ((weak))
+int smbus_is_busy(u32 smbus_dev)
+{
+ /* Check if bit 0 of the status register is 1 (busy) or 0 (ready) */
+ return ((inb(SMBHSTSTAT(smbus_dev)) & (1 << 0)) == 1);
+}
+
+/**
+ * \brief Wait for the SMBus to become ready to process a new transaction.
+ *
+ * @param smbus_dev The base SMBus IO port
+ */
+__attribute__ ((weak))
+int smbus_wait_until_ready(u32 smbus_dev)
+{
+ int loops;
+
+ printsmbus("Waiting until SMBus ready\n");
+
+ /* Loop up to SMBUS_TIMEOUT times, waiting for bit 0 of the
+ * SMBus Host Status register to go to 0, indicating the operation
+ * was completed successfully. I don't remember why I did it this way,
+ * but I think it was because ROMCC was running low on registers */
+ loops = 0;
+ while (smbus_is_busy(smbus_dev) && loops < SMBUS_TIMEOUT)
+ ++loops;
+
+ return smbus_print_error(smbus_dev, inb(SMBHSTSTAT(smbus_dev)), loops);
+}
+
+/**
+ * \brief Read a byte from the SMBus.
+ *
+ * @param smbus_dev The base SMBus IO port
+ * @param addr The address location of the DIMM on the SMBus.
+ * @param offset The offset the data is located at.
+ */
+__attribute__ ((weak))
+u8 smbus_read_byte(u32 smbus_dev, u8 addr, u8 offset)
+{
+ u8 val;
+
+ /* Initialize SMBus sequence */
+ smbus_reset(smbus_dev);
+ /* Clear host data port. */
+ outb(0x00, SMBHSTDAT0(smbus_dev));
+
+ smbus_wait_until_ready(smbus_dev);
+
+ /* Actual addr to reg format. */
+ addr = (addr << 1);
+ addr |= 1; /* read command */
+ outb(addr, SMBXMITADD(smbus_dev));
+ outb(offset, SMBHSTCMD(smbus_dev));
+ /* Start transaction, byte data read. */
+ outb(0x48, SMBHSTCTL(smbus_dev));
+ smbus_wait_until_ready(smbus_dev);
+
+ val = inb(SMBHSTDAT0(smbus_dev));
+ return val;
+}
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3266
-gerrit
commit 09021486f3049203d764ea34dc7dfd182ec09837
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Tue May 21 14:07:41 2013 -0500
spd.h: Add all known SPD_MEMORY_TYPE definitions.
This file was missing some definitions, so add them. Also turn the defines
into an enum. The reason for doing this is that functions can now
explicitly take an spd_memory_type as a parameter:
> int do_something_with_dram(enum spd_memory_type type, ...)
Which is a lot more explicit and readable than:
> int do_something_with_dram(u8 type, ...)
These are used in the VX900 branch.
Change-Id: Ic7871e82c2523a94eac8e07979a8e34e0b459b46
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/include/spd.h | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/include/spd.h b/src/include/spd.h
index e8d35cf..2b07fb1 100644
--- a/src/include/spd.h
+++ b/src/include/spd.h
@@ -108,15 +108,20 @@
/* SPD_MEMORY_TYPE values. */
-#define SPD_MEMORY_TYPE_FPM_DRAM 1
-#define SPD_MEMORY_TYPE_EDO 2
-#define SPD_MEMORY_TYPE_PIPELINED_NIBBLE 3
-#define SPD_MEMORY_TYPE_SDRAM 4
-#define SPD_MEMORY_TYPE_MULTIPLEXED_ROM 5
-#define SPD_MEMORY_TYPE_SGRAM_DDR 6
-#define SPD_MEMORY_TYPE_SDRAM_DDR 7
-#define SPD_MEMORY_TYPE_SDRAM_DDR2 8
-#define SPD_MEMORY_TYPE_SDRAM_DDR3 0xb
+enum spd_memory_type {
+ SPD_MEMORY_TYPE_UNDEFINED = 0x00,
+ SPD_MEMORY_TYPE_FPM_DRAM = 0x01,
+ SPD_MEMORY_TYPE_EDO = 0x02,
+ SPD_MEMORY_TYPE_PIPELINED_NIBBLE = 0x03,
+ SPD_MEMORY_TYPE_SDRAM = 0x04,
+ SPD_MEMORY_TYPE_MULTIPLEXED_ROM = 0x05,
+ SPD_MEMORY_TYPE_SGRAM_DDR = 0x06,
+ SPD_MEMORY_TYPE_SDRAM_DDR = 0x07,
+ SPD_MEMORY_TYPE_SDRAM_DDR2 = 0x08,
+ SPD_MEMORY_TYPE_FBDIMM_DDR2 = 0x09,
+ SPD_MEMORY_TYPE_FB_PROBE_DDR2 = 0x0a,
+ SPD_MEMORY_TYPE_SDRAM_DDR3 = 0x0b,
+};
/* SPD_MODULE_VOLTAGE values. */
#define SPD_VOLTAGE_TTL 0 /* 5.0 Volt/TTL */
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/143
-gerrit
commit fe542a53b938e3f7f3b53bb1c964df9e52e72522
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Tue May 21 12:17:58 2013 -0500
coreboot: Add generic early SMBus API
Early SMBUS code with similar functionality is duplicated for all
southbridges. Add a generic SMBus API (function declarations) designed to
unify the early SMBus structure.
This patch only adds the API. It does not implement any hardware-specific
bits.
Change-Id: I0861b7a3f098115182ae6de9f016dd671c500bad
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/include/device/early_smbus.h | 73 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/src/include/device/early_smbus.h b/src/include/device/early_smbus.h
new file mode 100644
index 0000000..77c9078
--- /dev/null
+++ b/src/include/device/early_smbus.h
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
+ *
+ * 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, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file early_smbus.h
+ *
+ * This file defines a common API for accessing the SMBus during early
+ * initialization. It defines the prototypes for common SMBus functions. The
+ * actual implementations are hardware-dependent.
+ *
+ * The first parameter of all SMBus functions take a u32 value smbus_dev which
+ * represents some information on how to access the device, and is
+ * implementation defined. Usually, it just contains the IO base for the smbus.
+ * To get this argument @ref smbus_get_device() can be used.
+ *
+ * The header only defines the prototypes. Several steps are needed to use
+ * these:
+ *
+ * 1. Include this header
+ * @code{.c}
+ * #include <device/early_smbus.h>
+ * @endcode
+ *
+ * 2. Implement early_smbus.c for the hardware, or find a compatible
+ * implementation.
+ *
+ * 3. Link against the file that implements these functions. In the Makefile.inc
+ * of the chipset, add:
+ * @code
+ * romstage-y += ./path/to/early_smbus.c
+ * @endcode
+ */
+
+#ifndef DEVICE_EARLY_SMBUS_H
+#define DEVICE_EARLY_SMBUS_H
+
+#include <stdint.h>
+
+/**
+ * \brief printk macro for SMBus debugging
+ */
+#if defined(CONFIG_DEBUG_SMBUS_SETUP) && (CONFIG_DEBUG_SMBUS_SETUP)
+#define printsmbus(x, ...) printk(BIOS_DEBUG, x, ##__VA_ARGS__)
+#else
+#define printsmbus(x, ...)
+#endif
+
+u32 smbus_get_device(void);
+void smbus_reset(u32 smbus_dev);
+int smbus_print_error(u32 smbus_dev, u8 host_status, int loops);
+int smbus_is_busy(u32 smbus_dev);
+int smbus_wait_until_ready(u32 smbus_dev);
+u8 smbus_read_byte(u32 smbus_dev, u8 addr, u8 offset);
+
+void smbus_delay(void);
+
+#endif /* DEVICE_EARLY_SMBUS_H */
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1430
-gerrit
commit fe72b9101299ba6ff28cf99ca61a7d1a84f7307e
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Aug 10 03:55:42 2012 -0500
util/inteltool: Extend to read various bits on VIA systems
Reading of configuration bits is implemented via a new featuere called
"quirks". Quirks are device configurations that cannot be accessed
directly. They are implemented as hierarchical configurations in the PCI
or memory address spaces (index/data register pairs). Such configurations
refer to hardware parameters that are board specific. Those parameters
would otherwise be difficult to extract from a system running the
vendor's firmware.
Change-Id: Icbd39eaf7c7da5568732d77dbf2aed135f835754
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
util/inteltool/Makefile | 5 +-
util/inteltool/inteltool.c | 32 ++++++++--
util/inteltool/inteltool.h | 21 ++++++-
util/inteltool/quirks/quirks.c | 115 +++++++++++++++++++++++++++++++++++
util/inteltool/quirks/quirks.h | 37 +++++++++++
util/inteltool/quirks/vx900_quirks.c | 81 ++++++++++++++++++++++++
6 files changed, 282 insertions(+), 9 deletions(-)
diff --git a/util/inteltool/Makefile b/util/inteltool/Makefile
index 2028a4a..e0dfa23 100644
--- a/util/inteltool/Makefile
+++ b/util/inteltool/Makefile
@@ -24,10 +24,11 @@ PROGRAM = inteltool
CC ?= gcc
INSTALL ?= /usr/bin/install
PREFIX ?= /usr/local
-CFLAGS ?= -O2 -g -Wall -W
+CFLAGS ?= -O2 -g -Wall -W -I$(shell pwd)
LDFLAGS += -lpci -lz
-OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o amb.o
+OBJS = inteltool.o cpu.o gpio.o rootcmplx.o powermgt.o memory.o pcie.o amb.o \
+ quirks/quirks.c quirks/vx900_quirks.c
OS_ARCH = $(shell uname)
ifeq ($(OS_ARCH), Darwin)
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c
index 0618f4b..3b6d02d 100644
--- a/util/inteltool/inteltool.c
+++ b/util/inteltool/inteltool.c
@@ -150,6 +150,13 @@ static const struct {
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HM70, "HM70" },
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_NM70, "NM70" },
{ PCI_VENDOR_ID_INTEL, 0x2310, "DH89xxCC" },
+ /*
+ * VIA chips go below this line
+ */
+ /* Host bridges/DRAM controllers (Northbridges) */
+ { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VX900, "VX900"},
+ /* Southbridges (LPC controllers) */
+ { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VX900_LPC, "VX900" },
};
#ifndef __DARWIN__
@@ -209,6 +216,7 @@ void print_usage(const char *name)
" -P | --pciexpress: dump northbridge PCIEXBAR registers\n\n"
" -M | --msrs: dump CPU MSRs\n"
" -A | --ambs: dump AMB registers\n"
+ " -q | --quirks: dump special configuration bits\n"
" -a | --all: dump all known registers\n"
"\n");
exit(1);
@@ -226,7 +234,7 @@ int main(int argc, char *argv[])
int dump_gpios = 0, dump_mchbar = 0, dump_rcba = 0;
int dump_pmbase = 0, dump_epbar = 0, dump_dmibar = 0;
int dump_pciexbar = 0, dump_coremsrs = 0, dump_ambs = 0;
- int show_gpio_diffs = 0;
+ int show_gpio_diffs = 0, dump_quirks = 0;
static struct option long_options[] = {
{"version", 0, 0, 'v'},
@@ -241,11 +249,12 @@ int main(int argc, char *argv[])
{"pciexpress", 0, 0, 'P'},
{"msrs", 0, 0, 'M'},
{"ambs", 0, 0, 'A'},
+ {"quirks", 0, 0, 'q'},
{"all", 0, 0, 'a'},
{0, 0, 0, 0}
};
- while ((opt = getopt_long(argc, argv, "vh?gGrpmedPMaA",
+ while ((opt = getopt_long(argc, argv, "vh?gGrpmedPMaAq",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'v':
@@ -294,6 +303,9 @@ int main(int argc, char *argv[])
case 'A':
dump_ambs = 1;
break;
+ case 'q':
+ dump_quirks = 1;
+ break;
case 'h':
case '?':
default:
@@ -347,8 +359,9 @@ int main(int argc, char *argv[])
pci_fill_info(sb, PCI_FILL_IDENT|PCI_FILL_BASES|PCI_FILL_SIZES|PCI_FILL_CLASS);
- if (sb->vendor_id != PCI_VENDOR_ID_INTEL) {
- printf("Not an Intel(R) southbridge.\n");
+ if ((sb->vendor_id != PCI_VENDOR_ID_INTEL) &&
+ (sb->vendor_id != PCI_VENDOR_ID_VIA)) {
+ printf("Not a supported southbridge.\n");
exit(1);
}
@@ -360,8 +373,9 @@ int main(int argc, char *argv[])
pci_fill_info(nb, PCI_FILL_IDENT|PCI_FILL_BASES|PCI_FILL_SIZES|PCI_FILL_CLASS);
- if (nb->vendor_id != PCI_VENDOR_ID_INTEL) {
- printf("Not an Intel(R) northbridge.\n");
+ if ((nb->vendor_id != PCI_VENDOR_ID_INTEL) &&
+ (nb->vendor_id != PCI_VENDOR_ID_VIA)) {
+ printf("Not a supported northbridge.\n");
exit(1);
}
@@ -439,6 +453,12 @@ int main(int argc, char *argv[])
if (dump_ambs) {
print_ambs(nb, pacc);
}
+
+ if (dump_quirks) {
+ print_quirks_north(nb, pacc);
+ print_quirks_south(sb, pacc);
+ }
+
/* Clean up */
pci_free_dev(nb);
// pci_free_dev(sb); // TODO: glibc detected "double free or corruption"
diff --git a/util/inteltool/inteltool.h b/util/inteltool/inteltool.h
index 7872a5f..3108b7c 100644
--- a/util/inteltool/inteltool.h
+++ b/util/inteltool/inteltool.h
@@ -3,6 +3,7 @@
*
* Copyright (C) 2008-2010 by coresystems GmbH
* Copyright (C) 2009 Carl-Daniel Hailfinger
+ * Copyright (C) 2013 Alexandru Gagniuc
*
* 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
@@ -18,6 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef _INTELTOOL_H
+#define _INTELTOOL_H
+
#include <stdint.h>
#if defined(__GLIBC__)
@@ -36,7 +40,10 @@
#endif
#define INTELTOOL_VERSION "1.0"
-
+\
+/*==============================================================================
+ * = Intel Section
+ *----------------------------------------------------------------------------*/
/* Tested chipsets: */
#define PCI_VENDOR_ID_INTEL 0x8086
#define PCI_DEVICE_ID_INTEL_ICH 0x2410
@@ -140,6 +147,14 @@
#define PCI_DEVICE_ID_INTEL_CORE_3RD_GEN 0x0154 /* Ivy Bridge */
#define PCI_DEVICE_ID_INTEL_CORE_4TH_GEN 0x0c04 /* Haswell */
+/*==============================================================================
+ *= VIA Section
+ *----------------------------------------------------------------------------*/
+#define PCI_VENDOR_ID_VIA 0x1106
+#define PCI_DEVICE_ID_VIA_VX900 0x0410
+#define PCI_DEVICE_ID_VIA_VX900_SATA 0x9001
+#define PCI_DEVICE_ID_VIA_VX900_LPC 0x8410
+
#define ARRAY_SIZE(a) ((int)(sizeof(a) / sizeof((a)[0])))
#if !defined(__DARWIN__) && !defined(__FreeBSD__)
@@ -170,3 +185,7 @@ int print_epbar(struct pci_dev *nb);
int print_dmibar(struct pci_dev *nb);
int print_pciexbar(struct pci_dev *nb);
int print_ambs(struct pci_dev *nb, struct pci_access *pacc);
+int print_quirks_north(struct pci_dev *nb, struct pci_access *pacc);
+int print_quirks_south(struct pci_dev *sb, struct pci_access *pacc);
+
+#endif /* _INTELTOOL_H */
diff --git a/util/inteltool/quirks/quirks.c b/util/inteltool/quirks/quirks.c
new file mode 100644
index 0000000..dc529c1
--- /dev/null
+++ b/util/inteltool/quirks/quirks.c
@@ -0,0 +1,115 @@
+/*
+ * viatool - dump all registers on a VIA CPU + chipset based system.
+ *
+ * Copyright (C) 2013 Alexandru Gagniuc
+ *
+ * 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; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * 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
+ * a long with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "quirks.h"
+#include <inteltool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+extern struct quirk_list vx900_sb_quirk_list;
+
+struct quirk_list *sb_quirks[] = {
+ &vx900_sb_quirk_list,
+ 0,
+};
+
+struct quirk_list *nb_quirks[] = {
+ 0,
+};
+
+int print_quirks(struct pci_dev *sb, struct pci_access *pacc,
+ struct quirk_list **qlists);
+
+int print_quirks_north(struct pci_dev *nb, struct pci_access *pacc)
+{
+ printf("\n====== Northbridge Quirks =======\n\n");
+ return print_quirks(nb, pacc, nb_quirks);
+}
+
+int print_quirks_south(struct pci_dev *sb, struct pci_access *pacc)
+{
+ printf("\n====== Southbridge Quirks =======\n\n");
+ return print_quirks(sb, pacc, sb_quirks);
+}
+
+int print_quirks(struct pci_dev *sb, struct pci_access *pacc,
+ struct quirk_list **qlists)
+{
+ size_t i, j;
+ struct quirk *q;
+ struct quirk_list *qlist;
+ struct pci_dev *dev;
+
+ for (i = 0;; i++) {
+ qlist = qlists[i];
+
+ if (qlist == NULL) {
+ /* OOPS. We've tried all we know, but no quirk */
+ printf("No quirks supported.\n");
+ break;
+ }
+
+ /* Is this the right device ? */
+ if ((qlist->pci_vendor_id != sb->vendor_id) ||
+ qlist->pci_device_id != sb->device_id)
+ continue;
+
+ for (j = 0;; j++) {
+ q = &qlist->dev_quirks[j];
+
+ if (q->pci_device_id == 0)
+ break;
+
+ printf("Probing PCI device %i:%.2x.%i\n",
+ q->pci_bus, q->pci_dev, q->pci_func);
+
+ dev = pci_get_dev(pacc, q->pci_domain, q->pci_bus,
+ q->pci_dev, q->pci_func);
+
+ if (!dev) {
+ perror("Error: no device found\n");
+ continue;
+ }
+
+ pci_fill_info(dev, PCI_FILL_IDENT |
+ PCI_FILL_BASES |
+ PCI_FILL_SIZES | PCI_FILL_CLASS);
+
+ if (dev->device_id != q->pci_device_id) {
+ printf("Expected %.4x:%.4x, got %.4x:%.4x\n",
+ q->pci_vendor_id, q->pci_device_id,
+ dev->vendor_id, dev->device_id);
+ continue;
+ }
+
+ if (!q->quirk_func) {
+ perror("BUG: Quirk missing.\n");
+ continue;
+ }
+
+ q->quirk_func(dev);
+ /* On to next quirk */
+ }
+
+ /* Done. No need to go through the remainder of the list */
+ break;
+ }
+
+ return 0;
+}
diff --git a/util/inteltool/quirks/quirks.h b/util/inteltool/quirks/quirks.h
new file mode 100644
index 0000000..d9b9bbd
--- /dev/null
+++ b/util/inteltool/quirks/quirks.h
@@ -0,0 +1,37 @@
+/*
+ * inteltool - dump all registers on a Intel or VIA CPU + chipset based system.
+ *
+ * Copyright (C) 2013 Alexandru Gagniuc
+ *
+ * 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; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * 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
+ * a long with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <inteltool.h>
+
+struct quirk {
+ int pci_domain;
+ int pci_bus;
+ int pci_dev;
+ int pci_func;
+ int pci_vendor_id;
+ int pci_device_id;
+ int (*quirk_func) (struct pci_dev * dev);
+};
+
+struct quirk_list {
+ int pci_vendor_id;
+ int pci_device_id;
+ /* NULL-terminated list of quirks */
+ struct quirk *dev_quirks;
+};
diff --git a/util/inteltool/quirks/vx900_quirks.c b/util/inteltool/quirks/vx900_quirks.c
new file mode 100644
index 0000000..6e73886
--- /dev/null
+++ b/util/inteltool/quirks/vx900_quirks.c
@@ -0,0 +1,81 @@
+/*
+ * viatool - dump all registers on a VIA CPU + chipset based system.
+ *
+ * Copyright (C) 2013 Alexandru Gagniuc
+ *
+ * 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; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * 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
+ * a long with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "quirks.h"
+
+#include <stdio.h>
+
+typedef u8 sata_phy_config[64];
+
+static u32 sata_phy_read32(struct pci_dev *dev, u8 index)
+{
+ /* The SATA PHY control registers are accessed by a funny index/value
+ * scheme. Each byte (0,1,2,3) has its own 4-bit index */
+ index = (index >> 2) & 0xf;
+ u16 i16 = index | (index << 4) | (index << 8) | (index << 12);
+ /* The index */
+ pci_write_word(dev, 0x68, i16);
+ /* The value */
+ return pci_read_long(dev, 0x64);
+}
+
+static void vx900_sata_read_phy_config(struct pci_dev *dev, sata_phy_config cfg)
+{
+ size_t i;
+ u32 *data = (u32 *) cfg;
+ for (i = 0; i < (sizeof(sata_phy_config)) >> 2; i++) {
+ data[i] = sata_phy_read32(dev, i << 2);
+ }
+}
+
+static int quirk_vx900_sata(struct pci_dev *dev)
+{
+ sata_phy_config ephy;
+
+ /* Get all the info in one pass */
+ vx900_sata_read_phy_config(dev, ephy);
+
+ /* Put it on the terminal for the user to read and be done with it */
+ printf("SATA PHY config:\n");
+ unsigned int i;
+ for (i = 0; i < sizeof(sata_phy_config); i++) {
+ if ((i & 0x0f) == 0) {
+ printf("%.2x :", i);
+ }
+ if ((i & 0x0f) == 0x08)
+ printf("| ");
+ printf("%.2x ", ephy[i]);
+ if ((i & 0x0f) == 0x0f) {
+ printf("\n");
+ }
+ }
+ return 0;
+}
+
+static struct quirk vx900_sb_quirks[] = {
+ {0, 0, 0x0f, 0, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VX900_SATA,
+ quirk_vx900_sata},
+ {0, 0, 0, 0, 0, 0, 0},
+};
+
+struct quirk_list vx900_sb_quirk_list = {
+ .pci_vendor_id = PCI_VENDOR_ID_VIA,
+ .pci_device_id = PCI_DEVICE_ID_VIA_VX900_LPC,
+ .dev_quirks = vx900_sb_quirks
+};
the following patch was just integrated into master:
commit 8048e740a334bb7dcf8f23662c73d0ca01e53c7f
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Mon May 13 18:22:23 2013 +0200
include/cpu/amd: Align `CPU_ID_EXT_FEATURES_MSR` with other defines
Probably due to different (character) widths for a tab, sometimes only
one tab was used for aligning the define `CPU_ID_EXT_FEATURES_MSR`. For
the “correct” alignment, that means where a tab is eight characters,
two tabs are necessary. Change it accordingly.
Change-Id: I450a7796dc00b934b5a6bab8642db04a27f69f4b
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/3263
Tested-by: build bot (Jenkins)
Reviewed-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
See http://review.coreboot.org/3263 for details.
-gerrit
the following patch was just integrated into master:
commit 1b22827cf0f190f26dcccec5ae5f36eb4972cde4
Author: Rudolf Marek <r.marek(a)assembler.cz>
Date: Mon May 27 20:39:18 2013 +0200
Asus F2A85-M: Fix the _CRS PCI0 bus info
On Asus F2A85-M, the Linux kernel complains that the _CRS method does
not specify the number of PCI busses.
[FIRMWARE BUG]: ACPI: no secondary bus range in _CRS
Just put there 256. This should be part of re-factoring of the whole
ACPI stuff.
The same change was already done for the AMD Brazos (SB800) boards,
based on commit »Persimmon DSDT: Add secondary bus range to PCI0«
(4733c647) [1].
[1] http://review.coreboot.org/2592
Change-Id: I06f90ec353df9198a20b2165741ea0fe94071266
Signed-off-by: Rudolf Marek <r.marek(a)assembler.cz>
Reviewed-on: http://review.coreboot.org/3320
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth(a)se-eng.com>
Reviewed-by: David Hubbard <david.c.hubbard+coreboot(a)gmail.com>
See http://review.coreboot.org/3320 for details.
-gerrit
the following patch was just integrated into master:
commit 01c095ff4c7ab8cf53f608395824f4e01bef1a42
Author: Christian Gmeiner <christian.gmeiner(a)gmail.com>
Date: Wed May 29 20:30:18 2013 +0000
AMD Geode CS5536: downgrade BIOS_ERR
There is no need to use everywhere BIOS_ERR.
Change-Id: If33d72919109244a7c3bd96674a4e386c8d1a19e
Signed-off-by: Christian Gmeiner <christian.gmeiner(a)gmail.com>
Reviewed-on: http://review.coreboot.org/3307
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Denis Carikli <GNUtoo(a)no-log.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
See http://review.coreboot.org/3307 for details.
-gerrit