summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Zeh <werner.zeh@siemens.com>2018-02-14 08:08:24 +0100
committerWerner Zeh <werner.zeh@siemens.com>2018-02-15 07:33:24 +0000
commitf7da8927f6d816679d603d082a496ae893e8daa5 (patch)
tree717deae9b4afd86aded342c99a336f343fa3d9c6
parent2012a2357d9845c832d182d524918e21547fb11c (diff)
downloadcoreboot-f7da8927f6d816679d603d082a496ae893e8daa5.tar.xz
siemens/mc_bdx1: Show mainboard hardware version on console
Show mainboard version in the console log so that one can easily see it. Change-Id: I33bae8b340fce13c0cbe525521828929038b069a Signed-off-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-on: https://review.coreboot.org/23750 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/mainboard/siemens/mc_bdx1/mainboard.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mainboard/siemens/mc_bdx1/mainboard.c b/src/mainboard/siemens/mc_bdx1/mainboard.c
index ea525d4a6c..ebc6d40fdc 100644
--- a/src/mainboard/siemens/mc_bdx1/mainboard.c
+++ b/src/mainboard/siemens/mc_bdx1/mainboard.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 2007-2009 coresystems GmbH
* Copyright (C) 2011 Google Inc.
- * Copyright (C) 2016 Siemens AG
+ * Copyright (C) 2016-2018 Siemens AG
*
* 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
@@ -21,6 +21,7 @@
#include <device/pci_def.h>
#include <device/pci_ops.h>
#include <device/pci_ids.h>
+#include <device/path.h>
#include <console/console.h>
#if IS_ENABLED(CONFIG_VGA_ROM_RUN)
#include <x86emu/x86emu.h>
@@ -38,6 +39,7 @@
#include <bootstate.h>
#include <timer.h>
#include <timestamp.h>
+#include <pca9538.h>
#define MAX_PATH_DEPTH 12
#define MAX_NUM_MAPPINGS 10
@@ -88,6 +90,8 @@
#define SPI_REG_OPMENU_L 0x98
#define SPI_REG_OPMENU_H 0x9c
+/* Define the slave address for the I/O expander. */
+#define PCA9538_SLAVE_ADR 0x71
/*
* mainboard_enable is executed as first thing after enumerate_buses().
* This is the earliest point to add customization.
@@ -143,6 +147,11 @@ static void mainboard_final(void *chip_info)
cmd |= PCI_COMMAND_MASTER;
pci_write_config16(dev, PCI_COMMAND, cmd);
}
+ /* Show the mainboard version well-visible on console. */
+ printk(BIOS_NOTICE, "***************************\n"
+ "* Mainboard version: 0x%02x *\n"
+ "***************************\n",
+ pca9538_read_input());
}
/** \brief This function can decide if a given MAC address is valid or not.
@@ -242,6 +251,23 @@ static void wait_for_legacy_dev(void *unused)
printk(BIOS_NOTICE, "done!\n");
}
+/*
+ * To access the I/O expander PCA9538 we need to know its device structure.
+ * This function will provide it as mainboard code has the knowledge of the
+ * right I2C slave address for the I/O expander.
+ */
+struct device *pca9538_get_dev(void)
+{
+ struct device *dev = NULL;
+ do {
+ dev = dev_find_path(dev, DEVICE_PATH_I2C);
+ if (dev->path.i2c.device == PCA9538_SLAVE_ADR)
+ break;
+ } while (dev);
+ return dev;
+}
+
+
BOOT_STATE_INIT_ENTRY(BS_DEV_ENUMERATE, BS_ON_ENTRY, wait_for_legacy_dev, NULL);
struct chip_operations mainboard_ops = {