Michał Żygowski has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30757
Change subject: [RFC] src/device/smbus: add extended addressing functions
......................................................................
[RFC] src/device/smbus: add extended addressing functions
Found this on one of private repositories I have access to.
Do not have any use case for it yet.
Signed-off-by: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Change-Id: I5dcfc6bf33ef7baaa619f84b2ce0ab8e179a44b3
---
M src/device/smbus_ops.c
M src/include/device/smbus.h
M src/include/device/smbus_def.h
3 files changed, 64 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/57/30757/1
diff --git a/src/device/smbus_ops.c b/src/device/smbus_ops.c
index c91f415..26cd956 100644
--- a/src/device/smbus_ops.c
+++ b/src/device/smbus_ops.c
@@ -90,3 +90,20 @@
return ops_smbus_bus(get_pbus_smbus(dev))->block_write(dev, cmd,
bytes, buffer);
}
+
+int smbus_extended_read_byte(struct device *dev, u16 addr)
+{
+ CHECK_PRESENCE(extended_read_byte);
+
+ return ops_smbus_bus(get_pbus_smbus(dev))->extended_read_byte(dev,
+ addr);
+}
+
+int smbus_extended_write_byte(struct device *dev, u16 addr, u8 val)
+{
+ CHECK_PRESENCE(extended_write_byte);
+
+ return ops_smbus_bus(get_pbus_smbus(dev))->extended_write_byte(dev,
+ addr,
+ val);
+}
\ No newline at end of file
diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h
index de6cf40..cb3f826 100644
--- a/src/include/device/smbus.h
+++ b/src/include/device/smbus.h
@@ -1,3 +1,22 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Sage Electronic Engineering, LLC.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
#ifndef DEVICE_SMBUS_H
#define DEVICE_SMBUS_H
@@ -15,6 +34,8 @@
int (*block_read)(struct device *dev, u8 cmd, u8 bytes, u8 *buffer);
int (*block_write)(struct device *dev, u8 cmd, u8 bytes,
const u8 *buffer);
+ int (*extended_read_byte)(struct device *dev, u16 addr);
+ int (*extended_write_byte)(struct device *dev, u16 addr, u8 value);
};
static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus)
@@ -54,6 +75,10 @@
int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer);
int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer);
+int smbus_extended_read_byte(struct device *dev, u16 addr);
+int smbus_extended_write_byte(struct device *dev, u16 addr, u8 val);
+
+
#if IS_ENABLED(CONFIG_SMBUS_HAS_AUX_CHANNELS)
void smbus_switch_to_channel(uint8_t channel_number);
uint8_t smbus_get_current_channel(void);
diff --git a/src/include/device/smbus_def.h b/src/include/device/smbus_def.h
index 61d7861..cac08cc 100644
--- a/src/include/device/smbus_def.h
+++ b/src/include/device/smbus_def.h
@@ -1,10 +1,31 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Sage Electronic Engineering, LLC.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+
#ifndef DEVICE_SMBUS_DEF_H
#define DEVICE_SMBUS_DEF_H
#include <types.h>
/* Error results are negative success is >= 0 */
-#define SMBUS_ERROR CB_ERR
+#define SMBUS_SUCCESS CB_SUCCESS
+#define SMBUS_ERROR CB_ERR
#define SMBUS_WAIT_UNTIL_READY_TIMEOUT CB_I2C_BUSY
#define SMBUS_WAIT_UNTIL_DONE_TIMEOUT CB_I2C_TIMEOUT
#define SMBUS_WAIT_UNTIL_ACTIVE_TIMEOUT CB_I2C_NO_DEVICE
--
To view, visit https://review.coreboot.org/c/coreboot/+/30757
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5dcfc6bf33ef7baaa619f84b2ce0ab8e179a44b3
Gerrit-Change-Number: 30757
Gerrit-PatchSet: 1
Gerrit-Owner: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-MessageType: newchange
Vassil Kakaradov has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30708
Change subject: `sudo apt-get install -y qemu; qemu-system-x86_64 -bios build/coreboot.rom -serial stdio` -> "qemu-system-x86_64: command not found" `sudo apt-get install -y qemu qemu-kvm; qemu-system-x86_64 -bios build/coreboot.rom -serial stdio` -> "SUCCESS" replaced `sudo apt-get install -y qemu` with `sudo apt-get install -y qemu qemu-kvm` in lesson1.md Change-Id: Ia171562493eede9ddecd5a9389cf721462652596 Signed-off-by: vassil <vassil88(a)gmail.com>
......................................................................
`sudo apt-get install -y qemu; qemu-system-x86_64 -bios build/coreboot.rom -serial stdio` -> "qemu-system-x86_64: command not found"
`sudo apt-get install -y qemu qemu-kvm; qemu-system-x86_64 -bios build/coreboot.rom -serial stdio` -> "SUCCESS"
replaced `sudo apt-get install -y qemu` with `sudo apt-get install -y qemu qemu-kvm` in lesson1.md
Change-Id: Ia171562493eede9ddecd5a9389cf721462652596
Signed-off-by: vassil <vassil88(a)gmail.com>
---
A Documentation/lessons/lesson1_2019-01-07_13.31.35_UTC.md
1 file changed, 168 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/08/30708/1
diff --git a/Documentation/lessons/lesson1_2019-01-07_13.31.35_UTC.md b/Documentation/lessons/lesson1_2019-01-07_13.31.35_UTC.md
new file mode 100644
index 0000000..729e6ae
--- /dev/null
+++ b/Documentation/lessons/lesson1_2019-01-07_13.31.35_UTC.md
@@ -0,0 +1,168 @@
+coreboot lesson 1 - Starting from scratch
+=========================================
+
+From a fresh Ubuntu 16.04 or 18.04 install, here are all the steps required for
+a very basic build:
+
+Download, configure, and build coreboot
+---------------------------------------
+
+### Step 1 - Install tools and libraries needed for coreboot
+ $ sudo apt-get install -y bison build-essential curl flex git gnat-5 libncurses5-dev m4 zlib1g-dev
+
+### Step 2 - Download coreboot source tree
+ $ git clone https://review.coreboot.org/coreboot
+ $ cd coreboot
+
+### Step 3 - Build the coreboot toolchain
+Please note that this can take a significant amount of time
+
+ $ make crossgcc-i386 CPUS=$(nproc)
+
+Also note that you can possibly use your system toolchain, but the results are
+not reproducible, and may have issues, so this is not recommended. See step 5
+to use your system toolchain.
+
+### Step 4 - Build the payload - coreinfo
+ $ make -C payloads/coreinfo olddefconfig
+ $ make -C payloads/coreinfo
+
+### Step 5 - Configure the build
+
+##### Configure your mainboard
+ $ make menuconfig
+ select 'Mainboard' menu
+ Beside 'Mainboard vendor' should be '(Emulation)'
+ Beside 'Mainboard model' should be 'QEMU x86 i440fx/piix4'
+ select < Exit >
+These should be the default selections, so if anything else was set, run
+`make distclean` to remove your old config file and start over.
+
+##### Optionally use your system toolchain (Again, not recommended)
+ select 'General Setup' menu
+ select 'Allow building with any toolchain'
+ select < Exit >
+
+##### Select the payload
+ select 'Payload' menu
+ select 'Add a Payload'
+ choose 'An Elf executable payload'
+ select 'Payload path and filename'
+ enter 'payloads/coreinfo/build/coreinfo.elf'
+ select < Exit >
+ select < Exit >
+ select < Yes >
+
+##### check your configuration (optional step):
+
+ $ make savedefconfig
+ $ cat defconfig
+
+There should only be two lines (or 3 if you're using the system toolchain):
+
+ CONFIG_PAYLOAD_ELF=y
+ CONFIG_PAYLOAD_FILE="payloads/coreinfo/build/coreinfo.elf"
+
+### Step 6 - build coreboot
+ $ make
+
+At the end of the build, you should see:
+
+ Build emulation/qemu-i440fx (QEMU x86 i440fx/piix4)
+
+This means your build was successful. The output from the build is in the build
+directory. build/coreboot.rom is the full rom file.
+
+Test the image using QEMU
+-------------------------
+
+### Step 7 - Install QEMU
+ $ sudo apt-get install -y qemu qemu-kvm
+
+### Step 8 - Run QEMU
+Start QEMU, and point it to the ROM you just built:
+
+ $ qemu-system-x86_64 -bios build/coreboot.rom -serial stdio
+
+You should see the serial output of coreboot in the original console window, and
+a new window will appear running the coreinfo payload.
+
+Summary
+-------
+
+### Step 1 summary - Install tools and libraries needed for coreboot
+You installed the minimum additional requirements for ubuntu to download and
+build coreboot. Ubuntu already has most of the other tools that would be
+required installed by default.
+
+* `build-essential` is the basic tools for doing builds. It comes pre-installed
+on some Ubuntu flavors, and not on others.
+* `git` is needed to download coreboot from the coreboot git repository.
+* `libncurses5-dev` is needed to build the menu for 'make menuconfig'
+* `m4, bison, curl, flex, gnat-5, zlib1g-dev` are needed to build the coreboot
+toolchain.
+
+If you started with a different distribution, you might need to install many
+other items which vary by distribution.
+
+### Step 2 summary - Download coreboot source tree
+This will download a 'read-only' copy of the coreboot tree. This just means
+that if you made changes to the coreboot tree, you couldn't immediately
+contribute them back to the community. To pull a copy of coreboot that would
+allow you to contribute back, you would first need to sign up for an account on
+gerrit.
+
+### Step 3 summary - Build the coreboot toolchain.
+This builds one of the coreboot cross-compiler toolchains for X86 platforms.
+Because of the variability of compilers and the other required tools between
+the various operating systems that coreboot can be built on, coreboot supplies
+and uses its own cross-compiler toolchain to build the binaries that end up as
+part of the coreboot ROM. The toolchain provided by the operating system (the
+'host toolchain') is used to build various tools that will run on the local
+system during the build process.
+
+### Step 4 summary - Build the payload
+To actually do anything useful with coreboot, you need to build a payload to
+include in the rom. The idea behind coreboot is that it does the minimum amount
+possible before passing control of the machine to a payload. There are various
+payloads such as grub or SeaBIOS that are typically used to boot the operating
+system. Instead, we used coreinfo, a small demonstration payload that allows the
+user to look at various things such as memory and the contents of coreboot's
+cbfs - the pieces that make up the coreboot rom.
+
+### Step 5 summary - Configure the build
+This step configures coreboot's build options using the menuconfig interface to
+Kconfig. Kconfig is the same configuration program used by the linux kernel. It
+allows you to enable, disable, and change various values to control the coreboot
+build process, including which mainboard(motherboard) to use, which toolchain to
+use, and how the runtime debug console should be presented and saved.
+Anytime you change mainboards in Kconfig, you should always run `make distclean`
+before running `make menuconfig`. Due to the way that Kconfig works, values will
+be kept from the previous mainboard if you skip the clean step. This leads to a
+hybrid configuration which may or may not work as expected.
+
+### Step 6 summary - Build coreboot
+You may notice that a number of other pieces are downloaded at the beginning of
+the build process. These are the git submodules used in various coreboot builds.
+By default, the _blobs_ submodule is not downloaded. This git submodule may be
+required for other builds for microcode or other binaries. To enable downloading
+this submodule, select the option "Allow use of binary-only repository" in the
+"General Setup" menu of Kconfig
+This attempts to build the coreboot rom. The rom file itself ends up in the
+build directory as 'coreboot.rom'. At the end of the build process, the build
+displayed the contents of the rom file.
+
+### Step 7 summary - Install QEMU
+QEMU is a processor emulator which we can use to show coreboot
+
+### Step 8 summary - Run QEMU
+Here's the command line broken down:
+* `qemu-system-x86_64`
+This starts the QEMU emulator with the i440FX host PCI bridge and PIIX3 PCI to
+ISA bridge.
+* `-bios build/coreboot.rom`
+Use the bios rom image that we just built. If this is left off, the standard
+SeaBIOS image that comes with QEMU is used.
+* `-serial stdio`
+Send the serial output to the console. This allows you to view the coreboot
+debug output.
--
To view, visit https://review.coreboot.org/c/coreboot/+/30708
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ia171562493eede9ddecd5a9389cf721462652596
Gerrit-Change-Number: 30708
Gerrit-PatchSet: 1
Gerrit-Owner: Vassil Kakaradov <vassil88(a)gmail.com>
Gerrit-MessageType: newchange
Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31379
Change subject: libpayload: Draw time_t and suseconds_t into sys/types.h
......................................................................
libpayload: Draw time_t and suseconds_t into sys/types.h
These are not architecture specific and were the only reason to
include `arch/types.h` in `sys/types.h`.
Beware this may break payloads that assume non-standard definitions
in `sys/types.h`.
Change-Id: I00d513a4775b013221df98d3d96c096320663cdd
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M payloads/libpayload/include/arm/arch/types.h
M payloads/libpayload/include/arm64/arch/types.h
M payloads/libpayload/include/mips/arch/types.h
M payloads/libpayload/include/sys/types.h
M payloads/libpayload/include/x86/arch/types.h
5 files changed, 2 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/79/31379/1
diff --git a/payloads/libpayload/include/arm/arch/types.h b/payloads/libpayload/include/arm/arch/types.h
index 1bd815b..641fb0a 100644
--- a/payloads/libpayload/include/arm/arch/types.h
+++ b/payloads/libpayload/include/arm/arch/types.h
@@ -50,9 +50,6 @@
typedef signed long long int64_t;
typedef signed long long s64;
-typedef long time_t;
-typedef long suseconds_t;
-
#ifndef NULL
#define NULL ((void *)0)
#endif
diff --git a/payloads/libpayload/include/arm64/arch/types.h b/payloads/libpayload/include/arm64/arch/types.h
index 1bd815b..641fb0a 100644
--- a/payloads/libpayload/include/arm64/arch/types.h
+++ b/payloads/libpayload/include/arm64/arch/types.h
@@ -50,9 +50,6 @@
typedef signed long long int64_t;
typedef signed long long s64;
-typedef long time_t;
-typedef long suseconds_t;
-
#ifndef NULL
#define NULL ((void *)0)
#endif
diff --git a/payloads/libpayload/include/mips/arch/types.h b/payloads/libpayload/include/mips/arch/types.h
index afa3a37..32537b8 100644
--- a/payloads/libpayload/include/mips/arch/types.h
+++ b/payloads/libpayload/include/mips/arch/types.h
@@ -62,9 +62,6 @@
typedef unsigned long phys_addr_t;
typedef unsigned long phys_size_t;
-typedef long time_t;
-typedef long suseconds_t;
-
#ifndef NULL
#define NULL ((void *)0)
#endif
diff --git a/payloads/libpayload/include/sys/types.h b/payloads/libpayload/include/sys/types.h
index 0ed4975..f7e0598 100644
--- a/payloads/libpayload/include/sys/types.h
+++ b/payloads/libpayload/include/sys/types.h
@@ -30,7 +30,8 @@
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
-#include <arch/types.h>
+typedef long time_t;
+typedef long suseconds_t;
typedef signed long int off_t;
diff --git a/payloads/libpayload/include/x86/arch/types.h b/payloads/libpayload/include/x86/arch/types.h
index 1bd815b..641fb0a 100644
--- a/payloads/libpayload/include/x86/arch/types.h
+++ b/payloads/libpayload/include/x86/arch/types.h
@@ -50,9 +50,6 @@
typedef signed long long int64_t;
typedef signed long long s64;
-typedef long time_t;
-typedef long suseconds_t;
-
#ifndef NULL
#define NULL ((void *)0)
#endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/31379
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I00d513a4775b013221df98d3d96c096320663cdd
Gerrit-Change-Number: 31379
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: newchange