Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands
......................................................................
drivers/ipmi: Add Supermicro OEM commands
Add a new driver for OEM commands an select if from x11-lga1151-series.
The driver communicates the BIOS version and date to the BMC using OEM
commands. The command should be supported on all X11 series, but might
work with older BMC, too.
Tested on X11SSH-TF:
The BIOS version strings are updated on boot and are visible in the
BMC web UI.
Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f
Signed-off-by: Patrick Rudolph <patrick.rudolph(a)9elements.com>
---
M src/drivers/ipmi/Kconfig
M src/drivers/ipmi/Makefile.inc
M src/drivers/ipmi/ipmi_kcs_ops.c
A src/drivers/ipmi/ipmi_supermicro_oem.h
A src/drivers/ipmi/supermicro_oem.c
M src/mainboard/supermicro/x11-lga1151-series/Kconfig
6 files changed, 121 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/38002/1
diff --git a/src/drivers/ipmi/Kconfig b/src/drivers/ipmi/Kconfig
index 0f7152d..e098bc8 100644
--- a/src/drivers/ipmi/Kconfig
+++ b/src/drivers/ipmi/Kconfig
@@ -8,3 +8,14 @@
depends on IPMI_KCS
help
KCS status and command register IO port address spacing
+
+config DRIVER_SUPERMICRO_IPMI_OEM
+ bool "Supermicro IPMI OEM BMC support"
+ depends on IPMI_KCS
+ default n
+ help
+ Tested on X11SSH only. Different BMCs might have different OEM
+ commands.
+ The following features are implemented:
+ * Communicates the BIOS version to the BMC
+ * Communicates the BIOS date to the BMC
diff --git a/src/drivers/ipmi/Makefile.inc b/src/drivers/ipmi/Makefile.inc
index 9d5b3d4..9fccccf 100644
--- a/src/drivers/ipmi/Makefile.inc
+++ b/src/drivers/ipmi/Makefile.inc
@@ -1,3 +1,4 @@
ramstage-$(CONFIG_IPMI_KCS) += ipmi_kcs.c
ramstage-$(CONFIG_IPMI_KCS) += ipmi_kcs_ops.c
ramstage-$(CONFIG_IPMI_KCS) += ipmi_ops.c
+ramstage-$(CONFIG_DRIVER_SUPERMICRO_IPMI_OEM) += supermicro_oem.c
diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c
index 5cb8995..ba8487f 100644
--- a/src/drivers/ipmi/ipmi_kcs_ops.c
+++ b/src/drivers/ipmi/ipmi_kcs_ops.c
@@ -34,6 +34,7 @@
#include <delay.h>
#include <timer.h>
#include "ipmi_kcs.h"
+#include "ipmi_supermicro_oem.h"
#include "chip.h"
/* 4 bit encoding */
@@ -170,6 +171,12 @@
/* Don't write tables if communication failed */
dev->enabled = 0;
}
+
+ if (!dev->enabled)
+ return;
+
+ if (CONFIG(DRIVER_SUPERMICRO_IPMI_OEM))
+ supermicro_ipmi_oem(dev->path.pnp.port);
}
#if CONFIG(HAVE_ACPI_TABLES)
diff --git a/src/drivers/ipmi/ipmi_supermicro_oem.h b/src/drivers/ipmi/ipmi_supermicro_oem.h
new file mode 100644
index 0000000..742b97d
--- /dev/null
+++ b/src/drivers/ipmi/ipmi_supermicro_oem.h
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+#ifndef __IPMI_SUPERMICRO_OEM_H
+#define __IPMI_SUPERMICRO_OEM_H
+
+void supermicro_ipmi_oem(const uint16_t kcs_port);
+
+#endif /* __IPMI_SUPERMICRO_OEM_H */
diff --git a/src/drivers/ipmi/supermicro_oem.c b/src/drivers/ipmi/supermicro_oem.c
new file mode 100644
index 0000000..ea01fef
--- /dev/null
+++ b/src/drivers/ipmi/supermicro_oem.c
@@ -0,0 +1,81 @@
+/*
+ * 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 <types.h>
+
+#include <console/console.h>
+#include <drivers/ipmi/ipmi_kcs.h>
+#include <string.h>
+#include <build.h>
+#include "ipmi_supermicro_oem.h"
+
+#define IPMI_NETFN_OEM 0x30
+#define IPMI_LUN0_AC_SET_BIOS_VER 0x100
+#define IPMI_LUN0_AC_SET_BIOS_DATE 0x101
+#define IPMI_LUN0_SET_BIOS_STRING 0xac
+
+struct ipmi_oem_set_bios_str {
+ uint16_t ver;
+ char str[16]; // NULL terminated string
+} __packed;
+
+static void set_coreboot_ver(const uint16_t kcs_port)
+{
+ const char *coreboot_ver = COREBOOT_VERSION;
+ struct ipmi_oem_set_bios_str bios_ver;
+ struct ipmi_rsp rsp;
+ int ret;
+ size_t i;
+
+ /* Only 8 charactars are visible in UI. Cut of on first dash */
+ for (i = 0; i < 15; i++) {
+ if (coreboot_ver[i] == '-')
+ break;
+ bios_ver.str[i] = coreboot_ver[i];
+ }
+ bios_ver.str[i] = 0;
+ bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_VER;
+
+ ret = ipmi_kcs_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING,
+ (const unsigned char *) &bios_ver, sizeof(bios_ver),
+ (unsigned char *) &rsp, sizeof(rsp));
+ if (ret < sizeof(rsp) || rsp.completion_code) {
+ printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n",
+ __func__, ret, rsp.completion_code);
+ }
+}
+
+static void set_coreboot_date(const uint16_t kcs_port)
+{
+ struct ipmi_oem_set_bios_str bios_ver;
+ struct ipmi_rsp rsp;
+ int ret;
+
+ strncpy(bios_ver.str, COREBOOT_DMI_DATE, 15);
+ bios_ver.str[15] = 0;
+ bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_DATE;
+
+ ret = ipmi_kcs_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING,
+ (const unsigned char *) &bios_ver, sizeof(bios_ver),
+ (unsigned char *) &rsp, sizeof(rsp));
+ if (ret < sizeof(rsp) || rsp.completion_code) {
+ printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n",
+ __func__, ret, rsp.completion_code);
+ }
+}
+
+void supermicro_ipmi_oem(const uint16_t kcs_port)
+{
+ set_coreboot_ver(kcs_port);
+ set_coreboot_date(kcs_port);
+}
diff --git a/src/mainboard/supermicro/x11-lga1151-series/Kconfig b/src/mainboard/supermicro/x11-lga1151-series/Kconfig
index 5a99f7a..53ae398 100644
--- a/src/mainboard/supermicro/x11-lga1151-series/Kconfig
+++ b/src/mainboard/supermicro/x11-lga1151-series/Kconfig
@@ -12,6 +12,7 @@
select SUPERIO_ASPEED_AST2400
select GENERATE_SMBIOS_TABLES
select IPMI_KCS
+ select DRIVER_SUPERMICRO_IPMI_OEM
select MAINBOARD_NO_FSP_GOP
select SUPERIO_ASPEED_HAS_UART_DELAY_WORKAROUND
select NO_FADT_8042
--
To view, visit https://review.coreboot.org/c/coreboot/+/38002
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f
Gerrit-Change-Number: 38002
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-MessageType: newchange
Sam Lewis has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44389 )
Change subject: Documentation: Add Beaglebone Black documentation
......................................................................
Documentation: Add Beaglebone Black documentation
Change-Id: If1a9808d1f20ee61048182d416f25e9a81c631af
Signed-off-by: Sam Lewis <sam.vr.lewis(a)gmail.com>
---
M Documentation/mainboard/index.md
A Documentation/mainboard/ti/beaglebone-black.md
2 files changed, 134 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/44389/1
diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md
index 3a7dd31..19e2d08 100644
--- a/Documentation/mainboard/index.md
+++ b/Documentation/mainboard/index.md
@@ -158,6 +158,10 @@
- [Lemur Pro](system76/lemp9.md)
+## Texas Instruments
+
+- [Beaglebone Black](ti/beaglebone-black.md)
+
## UP
- [Squared](up/squared/index.md)
diff --git a/Documentation/mainboard/ti/beaglebone-black.md b/Documentation/mainboard/ti/beaglebone-black.md
new file mode 100644
index 0000000..d63b6b5
--- /dev/null
+++ b/Documentation/mainboard/ti/beaglebone-black.md
@@ -0,0 +1,130 @@
+# Beaglebone Black
+This page gives some details about the [BeagleBone Black] coreboot port and
+describes how to build and run it.
+
+The port currently only supports booting coreboot from a micro SD card and has
+some other limitations listed below.
+
+## Supported Boards
+The Beaglebone port supports the following boards:
+
+- Beaglebone Black
+- Beaglebone Black Wireless
+- Beaglebone Pocket (untested, may need tweaking)
+- Beaglebone Blue (untested, may need tweaking)
+- Beaglebone Original (untested, may need tweaking)
+
+## Use Cases
+This port was primarily developed as a learning exercise and there is
+potentially little reason to use it compared to the defacto bootloader choice of
+U-Boot. However, it does have some interesting practical use cases compared to
+U-Boot:
+
+1. Choosing coreboot as a lightweight alternative to U-Boot. In this case,
+ coreboot is used to do the absolute minimum necessary to boot Linux, forgoing
+ some U-Boot features and functionality. Complex boot logic can then instead
+ be moved into Linux where it can be more flexibly and safely executed. This
+ is essentially the LinuxBoot philosophy. U-Boot "Falcon mode" has similar
+ goals to this as well.
+2. Facilitating experimenting with coreboot on real hardware. The Beaglebone
+ Black is widely available at a low pricepoint (~$65) making it a great way to
+ experiment with coreboot on real ARMv7 hardware. It also works well as a
+ development platform as it has exposed pads for JTAG and, due to the way it
+ boots, is effectively impossible to brick.
+
+## Quickstart
+1. Run `make menuconfig` and select _TI_/_Beaglebone Black_ in the _Mainboard_
+ menu.
+2. Add a payload as normal.
+3. Run `make`.
+4. Copy the resulting `build/MLO` file to the micro SD card at offset 128k - ie
+ `dd if=build/MLO of=/dev/sdcard seek=1 bs=128k`.
+
+**NOTE**: By default, the Beaglebone is configured to try to boot first from
+eMMC before booting from SD card. To ensure that the Beaglebone boots from SD,
+either erase the internal eMMC or hold the _S2_ button while powering on (note
+that this has to be while powering on - ie when plugging in the USB or DC barrel
+jack - the boot order doesn't change on reset) to prioritize SD in the boot
+order.
+
+## Serial Console
+By default, coreboot uses UART0 as the serial console. UART0 is available
+through the J1 header on both the Beaglebone Black and Beaglebone Black
+Wireless. The serial runs at 3.3V and 115200 8n1.
+
+The pin mapping is shown below for J1.
+
+ ```eval_rst
+ +----------------------------+------------+
+ | Pin number | Function |
+ +============================+============+
+ | 1 (Closest to barrel jack) | GND |
+ +----------------------------+------------+
+ | 4 | RX |
+ +----------------------------+------------+
+ | 5 | TX |
+ +----------------------------+------------+
+ ```
+
+## Boot Process
+The AM335x contains ROM code to allow booting in a number of different
+configurations. More information about the boot ROM code can be found in the
+AM335x technical reference manual (_SPRUH73Q_) in the _Initialization_ section.
+
+This coreboot port is currently configured to boot in "SD Raw Mode" where the
+boot binary, with header ("Table of Contents" in TI's nomenclature), is placed
+at the offset of 0x20000 (128KB) on the SD card. The boot ROM loads the coreboot
+bootblock stage into SRAM and executes it.
+
+The bootblock and subsequent romstage and ramstage coreboot stages expect that
+the coreboot image, containing the CBFS, is located at 0x20000 on the SD card. All
+stages directly read from the SD card in order to load the next stage in
+sequence.
+
+## Clock Initialization and PMIC
+To simplify the port, the TPS65217C Power Management IC (PMIC) on the Beaglebone
+Black is not configured by coreboot. By default, the PMIC reset values for
+VDD_MPU (1.1V) and VDD_CORE (1.8V) are within the Operating Performance Point
+(OPP) for the MPU PLL configuration set by the boot ROM of 500 MHz.
+
+When using Linux as a payload, the kernel will appropriately scale the core
+voltages for the desired MPU clock frequency as defined in the device tree.
+
+One significant difference because of this to the U-Boot port is that the DCDC1
+rail that powers the DDR3 RAM will be 1.5V by default. The Micron DDR3 supports
+both 1.35V and 1.5V and U-Boot makes use of this by setting it to 1.35V to
+conserve power. Fortunately, Linux is again able to configure this rail but it
+involves adding an entry to the device tree:
+
+```
+&dcdc1_reg {
+ regulator-name = "vdd_ddr3";
+ regulator-min-microvolt = <1350000>;
+ regulator-max-microvolt = <1350000>;
+ regulator-boot-on;
+ regulator-always-on;
+};
+```
+
+If this port was to be extended to work with boards or SoCs with different
+requirements for the MPU clock frequency or different Operating Performance
+Points, then the port may need to be extended to set the core voltages and MPU
+PLL within coreboot, prior to loading a payload. Extending coreboot so that it
+can configure the PMIC would also be necessary if there was a requirement for
+coreboot to run at a different MPU frequency than the 500 MHz set by the boot
+ROM.
+
+# Todo
+- Allow coreboot to run from the Beaglebone Black's internal eMMC. This would
+ require updating the mmc.c driver to support running from both SD and eMMC.
+- Support the boot ROMs "FAT mode" so that the coreboot binary can be placed on
+ a FAT partition.
+- Increase the MMC read speed, it currently takes ~15s to read ~20MB which is a
+ bit slow. To do this, it should be possible to update the MMC driver to:
+ - Increase the supported blocksize (currently is always set to 1)
+ - Support 4-bit data width (currently only supports 1-bit data width)
+- Convert the while loops in the MMC driver to timeout so that coreboot does not
+ hang on a bad SD card or when the SD card is removed during boot.
+
+
+[Beaglebone Black]: https://beagleboard.org/black
\ No newline at end of file
--
To view, visit https://review.coreboot.org/c/coreboot/+/44389
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If1a9808d1f20ee61048182d416f25e9a81c631af
Gerrit-Change-Number: 44389
Gerrit-PatchSet: 1
Gerrit-Owner: Sam Lewis <sam.vr.lewis(a)gmail.com>
Gerrit-MessageType: newchange
Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46724 )
Change subject: libpayload/keyboard: Revise scancode set and translation config
......................................................................
libpayload/keyboard: Revise scancode set and translation config
Some background first: The original XT keyboards used what we call
scancode set #1 today. The PC/AT keyboards introduced scancode set #2,
but for compatibility, its controller translated scancodes back to
set #1 by default. Newer keyboards (maybe all we have to deal with)
also support switching the scancode set.
This means the translation option in the controller and the scancode
set selection in the keyboard have to match. In libpayload, we only
support set #1 scancodes. So we either need the controller's trans-
lation on and set #2 selected in the keyboard, or the controller's
translation off and set #1 selected in the keyboard.
Valid configurations:
* SET #1 + XLATE off
* SET #2 + XLATE on
The Linux kernel leaves the decision to enable or disable the con-
troller's translation to the firmware. We follow that behaviour,
because Linux can be a payload too, and ideally want any payload
to succeed the same with any given coreboot image.
This way, coreboot (or the controller firmware) can decide how to
start best. For instance, if the keyboard is integrated and one
knows for sure that it can switch scancode sets, no translation
should be necessary.
Currently, coreboot leaves the controller's translation at its
default setting, unless DRIVERS_PS2_KEYBOARD is enabled. The latter
enables the translation unconditionally. For QEMU this means that
the option effectively toggles the translation, as QEMU's controller
has it disabled by default. This probably made a lot of earlier
testing inconsistent.
Fixes: commit a95a6bf646 (libpayload/drivers/i8402/kbd: Fix qemu)
The reset introduced there effectively reverted the scancode
selection made before. It's unclear if later changes to the
code where only necessary to work around it.
Change-Id: Iad85af516a7b9f9c0269ff9652ed15ee81700057
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M payloads/libpayload/Kconfig
M payloads/libpayload/drivers/i8042/keyboard.c
2 files changed, 30 insertions(+), 47 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/46724/1
diff --git a/payloads/libpayload/Kconfig b/payloads/libpayload/Kconfig
index b5dc9a3..298a7ad 100644
--- a/payloads/libpayload/Kconfig
+++ b/payloads/libpayload/Kconfig
@@ -367,10 +367,6 @@
default y if ARCH_X86 # uses IO
default n
-config PC_KEYBOARD_AT_TRANSLATED
- bool "AT Translation keyboard device"
- default n
-
config PC_KEYBOARD_LAYOUT_US
bool "English (US) keyboard layout"
depends on PC_KEYBOARD
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index 2dec3a3..aa21b9d 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -313,55 +313,36 @@
.input_type = CONSOLE_INPUT_TYPE_EC,
};
-/* Enable keyboard translated */
-static bool enable_translated(void)
+/**
+ * Get translation state from the controller.
+ *
+ * We want to act on the state left by the firmware, same as
+ * Linux does. If an error occurs, we assume it's enabled by
+ * default, as the OSDev wiki suggests.
+ */
+static bool controller_translates(void)
{
- if (!i8042_cmd(I8042_CMD_RD_CMD_BYTE)) {
- int cmd = i8042_read_data_ps2();
- cmd |= I8042_CMD_BYTE_XLATE;
- if (!i8042_cmd(I8042_CMD_WR_CMD_BYTE)) {
- i8042_write_data(cmd);
- } else {
- printf("ERROR: i8042_cmd WR_CMD failed!\n");
- return false;
- }
- } else {
- printf("ERROR: i8042_cmd RD_CMD failed!\n");
- return false;
- }
- return true;
+ const int ctrl_cfg = i8042_cmd_with_response(I8042_CMD_RD_CMD_BYTE);
+ return ctrl_cfg < 0 || (ctrl_cfg & I8042_CMD_BYTE_XLATE);
}
/* Set scancode set 1 */
-static bool set_scancode_set(void)
+static bool set_scancode_set(const unsigned char set)
{
bool ret;
+
+ if (set < 1 || set > 3)
+ return false;
+
ret = keyboard_cmd(I8042_KBCMD_SET_SCANCODE);
if (!ret) {
printf("ERROR: Keyboard set scancode failed!\n");
return ret;
}
- ret = keyboard_cmd(I8042_SCANCODE_SET_1);
+ ret = keyboard_cmd(set);
if (!ret) {
- printf("ERROR: Keyboard scancode set#1 failed!\n");
- return ret;
- }
-
- /*
- * Set default parameters.
- * Fix for broken QEMU PS/2 make scancodes.
- */
- ret = keyboard_cmd(I8042_KBCMD_SET_DEFAULT);
- if (!ret) {
- printf("ERROR: Keyboard set default params failed!\n");
- return ret;
- }
-
- /* Enable scanning */
- ret = keyboard_cmd(I8042_KBCMD_EN);
- if (!ret) {
- printf("ERROR: Keyboard enable scanning failed!\n");
+ printf("ERROR: Keyboard scancode set#%u failed!\n", set);
return ret;
}
@@ -383,13 +364,19 @@
/* Enable first PS/2 port */
i8042_cmd(I8042_CMD_EN_KB);
- if (CONFIG(LP_PC_KEYBOARD_AT_TRANSLATED)) {
- if (!enable_translated())
- return;
- } else {
- if (!set_scancode_set())
- return;
- }
+ /*
+ * We only support scancode set 1. The controller translation
+ * would translate from set 2 to 1 for us, so we try to configure
+ *
+ * o set 1 if the controller doesn't translate, and
+ * o set 2 if the controller does.
+ */
+ (void)set_scancode_set(controller_translates() ? 2 : 1);
+
+ /* Enable scanning */
+ const bool ret = keyboard_cmd(I8042_KBCMD_EN);
+ if (!ret)
+ printf("ERROR: Keyboard enable scanning failed!\n");
console_add_input_driver(&cons);
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/46724
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Iad85af516a7b9f9c0269ff9652ed15ee81700057
Gerrit-Change-Number: 46724
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: newchange