Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3353
-gerrit
commit b2280806bcbca6b6df011da8b387be02c5c9bc79
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue May 28 14:26:29 2013 -0500
haswell: allow for disabled hyperthreading
There were assumptions being made in the haswell
MP and SMM code which assumed the APIC id space
was 1:1 w.r.t. cpu number. When hyperthreading is
disabled the APIC ids of the logical processors
are all even. That means the APIC id space is sparse.
Handle this situation.
Change-Id: Ibe79ab156c0a171208a77db8a252aa5b73205d6c
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/cpu/intel/haswell/haswell.h | 3 +++
src/cpu/intel/haswell/mp_init.c | 22 +++++++++++++++++++---
src/cpu/intel/haswell/smmrelocate.c | 32 +++++++++++++++++++++++++++++---
3 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/src/cpu/intel/haswell/haswell.h b/src/cpu/intel/haswell/haswell.h
index c550cfa..4a739a9 100644
--- a/src/cpu/intel/haswell/haswell.h
+++ b/src/cpu/intel/haswell/haswell.h
@@ -175,6 +175,9 @@ int setup_ap_init(struct bus *cpu_bus, int *max_cpus,
/* Returns 0 on success, < 0 on failure. */
int start_aps(struct bus *cpu_bus, int max_cpus);
void release_aps_for_smm_relocation(int do_parallel_relocation);
+/* Determine if HyperThreading is disabled. The variable is not valid until
+ * setup_ap_init() has been called. */
+extern int ht_disabled;
#endif
/* This structure is saved along with the relocated ramstage program in SMM
diff --git a/src/cpu/intel/haswell/mp_init.c b/src/cpu/intel/haswell/mp_init.c
index 357fbb2..1358418 100644
--- a/src/cpu/intel/haswell/mp_init.c
+++ b/src/cpu/intel/haswell/mp_init.c
@@ -80,6 +80,8 @@ static atomic_t num_aps;
static atomic_t num_aps_relocated_smm;
/* Barrier to stop APs from performing SMM relcoation. */
static int smm_relocation_barrier_begin __attribute__ ((aligned (64)));
+/* Determine if hyperthreading is disabled. */
+int ht_disabled;
static inline void mfence(void)
{
@@ -197,6 +199,8 @@ static void asmlinkage ap_init(unsigned int cpu, void *microcode_ptr)
static void setup_default_sipi_vector_params(struct sipi_params *sp)
{
int i;
+ u8 apic_id;
+ u8 apic_id_inc;
sp->gdt = (u32)&gdt;
sp->gdtlimit = (u32)&gdt_end - (u32)&gdt - 1;
@@ -205,9 +209,15 @@ static void setup_default_sipi_vector_params(struct sipi_params *sp)
sp->stack_top = (u32)&_estack;
/* Adjust the stack top to take into account cpu_info. */
sp->stack_top -= sizeof(struct cpu_info);
- /* Default to linear APIC id space. */
- for (i = 0; i < CONFIG_MAX_CPUS; i++)
- sp->apic_to_cpu_num[i] = i;
+
+ /* Default to linear APIC id space if HT is enabled. If it is
+ * disabled the APIC ids increase by 2 as the odd numbered APIC
+ * ids are not present.*/
+ apic_id_inc = (ht_disabled) ? 2 : 1;
+ for (i = 0, apic_id = 0; i < CONFIG_MAX_CPUS; i++) {
+ sp->apic_to_cpu_num[i] = apic_id;
+ apic_id += apic_id_inc;
+ }
}
#define NUM_FIXED_MTRRS 11
@@ -374,6 +384,10 @@ static int allocate_cpu_devices(struct bus *cpu_bus, int *total_hw_threads)
max_cpus = CONFIG_MAX_CPUS;
}
+ /* Determine if hyperthreading is enabled. If not, the APIC id space
+ * is sparse with ids incrementing by 2 instead of 1. */
+ ht_disabled = num_threads == num_cores;
+
for (i = 1; i < max_cpus; i++) {
struct device_path cpu_path;
device_t new;
@@ -381,6 +395,8 @@ static int allocate_cpu_devices(struct bus *cpu_bus, int *total_hw_threads)
/* Build the cpu device path */
cpu_path.type = DEVICE_PATH_APIC;
cpu_path.apic.apic_id = info->cpu->path.apic.apic_id + i;
+ if (ht_disabled)
+ cpu_path.apic.apic_id = cpu_path.apic.apic_id * 2;
/* Allocate the new cpu device structure */
new = alloc_find_dev(cpu_bus, &cpu_path);
diff --git a/src/cpu/intel/haswell/smmrelocate.c b/src/cpu/intel/haswell/smmrelocate.c
index 6caeafa..4fe6489 100644
--- a/src/cpu/intel/haswell/smmrelocate.c
+++ b/src/cpu/intel/haswell/smmrelocate.c
@@ -286,6 +286,22 @@ static void fill_in_relocation_params(device_t dev,
params->uncore_emrr_mask.hi = (1 << (39 - 32)) - 1;
}
+static void adjust_apic_id_map(struct smm_loader_params *smm_params)
+{
+ struct smm_runtime *runtime;
+ int i;
+
+ /* Adjust the APIC id map if HT is disabled. */
+ if (!ht_disabled)
+ return;
+
+ runtime = smm_params->runtime;
+
+ /* The APIC ids increment by 2 when HT is disabled. */
+ for (i = 0; i < CONFIG_MAX_CPUS; i++)
+ runtime->apic_id_to_cpu[i] = runtime->apic_id_to_cpu[i] * 2;
+}
+
static int install_relocation_handler(int num_cpus,
struct smm_relocation_params *relo_params)
{
@@ -305,7 +321,12 @@ static int install_relocation_handler(int num_cpus,
.handler_arg = (void *)relo_params,
};
- return smm_setup_relocation_handler(&smm_params);
+ if (smm_setup_relocation_handler(&smm_params))
+ return -1;
+
+ adjust_apic_id_map(&smm_params);
+
+ return 0;
}
static void setup_ied_area(struct smm_relocation_params *params)
@@ -347,8 +368,13 @@ static int install_permanent_handler(int num_cpus,
printk(BIOS_DEBUG, "Installing SMM handler to 0x%08x\n",
relo_params->smram_base);
- return smm_load_module((void *)relo_params->smram_base,
- relo_params->smram_size, &smm_params);
+ if (smm_load_module((void *)relo_params->smram_base,
+ relo_params->smram_size, &smm_params))
+ return -1;
+
+ adjust_apic_id_map(&smm_params);
+
+ return 0;
}
static int cpu_smm_setup(void)
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3352
-gerrit
commit b3e579a7855edf4cbd4e75ad17ce8c08b64895ec
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon Jun 3 09:46:56 2013 -0500
haswell: fix overflow handling TOUUD
It's possible that the TOUUD can be set to less than
4GiB. When that is the case the size_k variable is
an extremely large value. Instead ensure TOUUD is greater
than 4GiB before adding said resources.
Change-Id: I456633d6210824e60665281538300fd15656b86d
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/northbridge/intel/haswell/northbridge.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/northbridge/intel/haswell/northbridge.c b/src/northbridge/intel/haswell/northbridge.c
index 5c1ab3e..45d967e 100644
--- a/src/northbridge/intel/haswell/northbridge.c
+++ b/src/northbridge/intel/haswell/northbridge.c
@@ -312,6 +312,7 @@ static void mc_report_map_entries(device_t dev, uint64_t *values)
static void mc_add_dram_resources(device_t dev)
{
unsigned long base_k, size_k;
+ unsigned long touud_k;
unsigned long index;
struct resource *resource;
uint64_t mc_values[NUM_MAP_ENTRIES];
@@ -396,8 +397,9 @@ static void mc_add_dram_resources(device_t dev)
/* 4GiB -> TOUUD */
base_k = 4096 * 1024; /* 4GiB */
- size_k = (unsigned long)(mc_values[TOUUD_REG] >> 10) - base_k;
- if (size_k > 0)
+ touud_k = mc_values[TOUUD_REG] >> 10;
+ size_k = touud_k - base_k;
+ if (touud_k > base_k)
ram_resource(dev, index++, base_k, size_k);
/* Reserve everything between A segment and 1MB:
Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3326
-gerrit
commit de083aee374c0a2e03d3fe438190a3ec6a7dd648
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Tue May 28 20:59:50 2013 +0200
AMD Geode LX: Add AES PCI device 0:1.2 to `devicetree.cb`
The AMD Geode LX processor features a security block [1], which is
exposed as PCI device 0:1.2.
Currently some Geode LX boards in the tree mention it in their
`devicetree.cb` and others do not. So add
device pci 1.2 on end # AES
to the boards not having this line to describe all devices.
No functionality is changed, as coreboot was able to discover the AES
security block anyway.
00:01.2 Entertainment encryption device [1010]: Advanced Micro Devices [AMD] Geode LX AES Security Block [1022:2082]
The following command was used to find all Geode LX `devicetree.cb`
files.
$ find src/mainboard -name devicetree.cb | xargs grep -l 'amd/lx'
[1] http://en.wikipedia.org/wiki/AMD_Geode#Geode_LX
Change-Id: Id4565c83ac2c0a3f2994535650bb9f642c0feced
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
src/mainboard/amd/db800/devicetree.cb | 1 +
src/mainboard/amd/norwich/devicetree.cb | 1 +
src/mainboard/artecgroup/dbe61/devicetree.cb | 1 +
src/mainboard/digitallogic/msm800sev/devicetree.cb | 1 +
src/mainboard/iei/pcisa-lx-800-r10/devicetree.cb | 1 +
src/mainboard/pcengines/alix1c/devicetree.cb | 1 +
src/mainboard/pcengines/alix2d/devicetree.cb | 1 +
src/mainboard/traverse/geos/devicetree.cb | 1 +
src/mainboard/winent/pl6064/devicetree.cb | 1 +
9 files changed, 9 insertions(+)
diff --git a/src/mainboard/amd/db800/devicetree.cb b/src/mainboard/amd/db800/devicetree.cb
index 3331a12..db78d7c 100644
--- a/src/mainboard/amd/db800/devicetree.cb
+++ b/src/mainboard/amd/db800/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end # Northbridge
device pci 1.1 on end # Graphics
+ device pci 1.2 on end # AES
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/amd/norwich/devicetree.cb b/src/mainboard/amd/norwich/devicetree.cb
index 93effaa..e4c02b4 100644
--- a/src/mainboard/amd/norwich/devicetree.cb
+++ b/src/mainboard/amd/norwich/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end # Northbridge
device pci 1.1 on end # Graphics
+ device pci 1.2 on end # AES
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/artecgroup/dbe61/devicetree.cb b/src/mainboard/artecgroup/dbe61/devicetree.cb
index d270f3d..d70ffeb 100644
--- a/src/mainboard/artecgroup/dbe61/devicetree.cb
+++ b/src/mainboard/artecgroup/dbe61/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end # Northbridge
device pci 1.1 on end # Graphics
+ device pci 1.2 on end # AES
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/digitallogic/msm800sev/devicetree.cb b/src/mainboard/digitallogic/msm800sev/devicetree.cb
index 839b767..63377ec 100644
--- a/src/mainboard/digitallogic/msm800sev/devicetree.cb
+++ b/src/mainboard/digitallogic/msm800sev/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end
device pci 1.1 on end
+ device pci 1.2 on end
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/iei/pcisa-lx-800-r10/devicetree.cb b/src/mainboard/iei/pcisa-lx-800-r10/devicetree.cb
index a6dba30..b30c169 100644
--- a/src/mainboard/iei/pcisa-lx-800-r10/devicetree.cb
+++ b/src/mainboard/iei/pcisa-lx-800-r10/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end # Northbridge
device pci 1.1 on end # Graphics
+ device pci 1.2 on end # AES
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/pcengines/alix1c/devicetree.cb b/src/mainboard/pcengines/alix1c/devicetree.cb
index 85e967a..e33d277 100644
--- a/src/mainboard/pcengines/alix1c/devicetree.cb
+++ b/src/mainboard/pcengines/alix1c/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end
device pci 1.1 on end
+ device pci 1.2 on end
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/pcengines/alix2d/devicetree.cb b/src/mainboard/pcengines/alix2d/devicetree.cb
index d8aa3bc..2b51908 100644
--- a/src/mainboard/pcengines/alix2d/devicetree.cb
+++ b/src/mainboard/pcengines/alix2d/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end
device pci 1.1 on end
+ device pci 1.2 on end
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/traverse/geos/devicetree.cb b/src/mainboard/traverse/geos/devicetree.cb
index 4a2674e..ee10c78 100644
--- a/src/mainboard/traverse/geos/devicetree.cb
+++ b/src/mainboard/traverse/geos/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end # Northbridge
device pci 1.1 on end # Graphics
+ device pci 1.2 on end # AES
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
diff --git a/src/mainboard/winent/pl6064/devicetree.cb b/src/mainboard/winent/pl6064/devicetree.cb
index f900f78..4b88479 100644
--- a/src/mainboard/winent/pl6064/devicetree.cb
+++ b/src/mainboard/winent/pl6064/devicetree.cb
@@ -2,6 +2,7 @@ chip northbridge/amd/lx
device domain 0 on
device pci 1.0 on end # Northbridge
device pci 1.1 on end # Graphics
+ device pci 1.2 on end # AES
chip southbridge/amd/cs5536
# IRQ 12 and 1 unmasked, Keyboard and Mouse IRQs. OK
# SIRQ Mode = Active(Quiet) mode. Save power....
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 9a83e69d82cf00087e750576c77c667abd2b7842
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 78ea16964ed165da3967270ee7b059e9773526f5
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 1428f396d900f3c86a4c1a9eec43ed66efefb702
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 */
the following patch was just integrated into master:
commit 373a20c335bdd747d7a2553f0e72e2b3a46f86e8
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri May 3 12:17:02 2013 +0200
Intel Lynx Point: LPC: Unify I/O APIC setup
Remove local copies of reading and writing I/O APIC registers by
using already available functions.
This change is similar to
commit db4f875a412e6c41f48a86a79b72465f6cd81635
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue Jan 31 17:24:12 2012 +0200
IOAPIC: Divide setup_ioapic() in two parts.
Reviewed-on: http://review.coreboot.org/300
and
commit e614353194c712a40aa8444a530b2062876eabe3
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue Feb 26 17:24:41 2013 +0200
Unify setting 82801a/b/c/d IOAPIC ID
Reviewed-on: http://review.coreboot.org/2532
and uses `io_apic_read()` and `io_apic_write()` too. Define
`ACPI_EN` in the header file `pch.h`.
As commented by Aaron Durbin, a separate `pch_enable_acpi()` is
not needed: “The existing code path *in this file* is about enabling
the io apic.” [1].
[1] http://review.coreboot.org/#/c/3182/4/src/southbridge/intel/lynxpoint/lpc.c
Change-Id: I6f2559f1d134590f781bd2cb325a9560512285dc
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/3182
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin(a)google.com>
See http://review.coreboot.org/3182 for details.
-gerrit