Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34632 )
Change subject: Documentation: Add guidelines for new mainboard ports
......................................................................
Documentation: Add guidelines for new mainboard ports
This is WIP and partly copied from https://www.coreboot.org/Motherboard_Porting_Guide
It also list what should be documented for new mainboard ports.
Change-Id: I134dbf2341696ba0dd33c3d52bf787b8eaabbdab
Signed-off-by: Patrick Rudolph <siro(a)das-labor.org>
---
M Documentation/getting_started/index.md
A Documentation/getting_started/new_mainboard_ports.md
M Documentation/getting_started/writing_documentation.md
3 files changed, 95 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/34632/1
diff --git a/Documentation/getting_started/index.md b/Documentation/getting_started/index.md
index 52d873e..7821ee1 100644
--- a/Documentation/getting_started/index.md
+++ b/Documentation/getting_started/index.md
@@ -7,3 +7,4 @@
* [Gerrit Guidelines](gerrit_guidelines.md)
* [Documentation License](license.md)
* [Writing Documentation](writing_documentation.md)
+* [Adding new mainboards](new_mainboard_ports.md)
diff --git a/Documentation/getting_started/new_mainboard_ports.md b/Documentation/getting_started/new_mainboard_ports.md
new file mode 100644
index 0000000..cb7cd9b
--- /dev/null
+++ b/Documentation/getting_started/new_mainboard_ports.md
@@ -0,0 +1,91 @@
+# Adding new mainboards
+
+Mainboard code is placed under `src/mainboards`. It glues the HW components
+together by selecting appropiate northbridge, southbridge, on-board HW and
+drivers.
+
+It provides the devicetree.cb, configures GPIOs, audio codecs, a static ACPI
+board desciption and allows the romstage code to retrieve the SPD for
+DRAM training.
+
+## Starting a new port from scratch
+
+1. Identify your platform
+ Try to find out as much as possible about the current hardware.
+ Dump information with existing tools:
+ * lspci
+ * lsusb
+ * superiotool
+ * inteltool
+ * ectool
+ * dmidecode
+ * acpidump
+
+ Have a look at the mainboard schematics to see how those components are
+ connected.
+2. Find a similar existing board
+ It a good idea to find a similar board and use it as reference. You should
+ then provide a proper GPIO configuration and devicetree.cb.
+3. Find a similar SuperIo or BMC
+ To debug coreboot you should get the serial console working first. If your
+ board has a SuperIO or BMC try to find a compatible one.
+ Some boards have UART hardware on the SoC, makeing external components
+ obsolete.
+4. Start with a minimal bootable configuration. That is:
+ * serial is working
+ * SPD reading/DRAM is working
+ * A payload that is able to boot an operating system
+5. Be able to recover from a bad flash. You should use external flashing as
+ it's likely that you will brick your platform on the first attempts.
+ Make sure to backup the original firmware (if any).
+
+## Code submission
+
+Here's a checklist for new mainboard ports:
+
+1. Try to not duplicate code, use variants scheme instead.
+2. Split changes logical into top level directories:
+ `src/mainboard` , `src/northbridge`, `src/ec`, ...
+3. Provide good documentation, see point 4
+4. In the commit message describe as much as possible or point to the
+ documentation, satisfying the following questions:
+ * Where's the flash IC located?
+ * Can you flash incircuit?
+ * Are there pinheaders for flashing?
+ * Is the flash hardware write-protected?
+ * Which flash IC is usually equipped?
+ * If the board features an BMC, can it be used for developing and
+ debugging?
+ * What was tested and is working?
+ * What was tested and isn't working?
+ * What wasn't tested (due to lack of testing equipment)?
+ * Are blobs necessary?
+ * How can the board be debugged?
+ * Are there serial, EHCI debug, xHCI debug or BMC connections?
+ * Does it have a SuperIO?
+
+ In addition please descibe:
+ * How to retrieve blobs, like dumping them from vendor firmware
+
+ See [Writing Documentation] for more details.
+
+5. What you should **not** document:
+ * Steps or instructions how to flash the board
+ * Steps or instructions how to use a specific application for flashing
+ * Please do not provide pictures of the whole board or it's backplate
+ connectors
+6. Recommand a flashing method as descibed in [Flashing tutorial]
+7. If you are working at/for a hardware vendor, please provide free board
+ schematics as well.
+8. Provide a picture of the flash IC or flash connector.
+ * The picture should be less than 800pc in width and compressed with
+ 70% compression to reduce size.
+ * You must own the Copyright
+ * Try to cut of uninteresting parts of the image, like tables, cables, ...
+
+Once done submit your board to Gerrit. Please follow the [Gerrit Guidelines] as
+well.
+
+[Writing Documentation]: writing_documentation.md
+[Flashing tutorial]: ../flash_tutorial/index.md
+[Gerrit Guidelines]: gerrit_guidelines.md
diff --git a/Documentation/getting_started/writing_documentation.md b/Documentation/getting_started/writing_documentation.md
index fb942a4..0b820fc 100644
--- a/Documentation/getting_started/writing_documentation.md
+++ b/Documentation/getting_started/writing_documentation.md
@@ -49,6 +49,8 @@
the current theme doesn't allow bigger images.
12. Shouldn't cover implementation details; for details, the code is the
reference.
+13. New mainboard ports should also add documentation. See
+ [Adding new mainboards] for more details.
## Referencing markdown documents
@@ -122,3 +124,4 @@
[Markdown Guide]: https://www.markdownguide.org/
[Gerrit Guidelines]: gerrit_guidelines.md
[review.coreboot.org]: https://review.coreboot.org
+[Adding new mainboards]: new_mainboard_ports.md
--
To view, visit https://review.coreboot.org/c/coreboot/+/34632
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I134dbf2341696ba0dd33c3d52bf787b8eaabbdab
Gerrit-Change-Number: 34632
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34360 )
Change subject: cpu/intel/speedstep: Add comment to clarify define
......................................................................
cpu/intel/speedstep: Add comment to clarify define
Add a comment to clarify that the define must match the define in
southbridge headers.
Change-Id: Ie0e97b170c81e3bca38975d6a3fe9a368c70e622
Signed-off-by: Patrick Rudolph <patrick.rudolph(a)9elements.com>
---
M src/include/cpu/intel/speedstep.h
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/34360/1
diff --git a/src/include/cpu/intel/speedstep.h b/src/include/cpu/intel/speedstep.h
index 05d83ed..660e5ae 100644
--- a/src/include/cpu/intel/speedstep.h
+++ b/src/include/cpu/intel/speedstep.h
@@ -25,6 +25,7 @@
/* MWAIT coordination I/O base address. This must match
* the \_PR_.CP00 PM base address.
+ * PMB0_BASE - 0x10 should match PMBASE for legacy C-state emulation.
*/
#define PMB0_BASE 0x510
--
To view, visit https://review.coreboot.org/c/coreboot/+/34360
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie0e97b170c81e3bca38975d6a3fe9a368c70e622
Gerrit-Change-Number: 34360
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-MessageType: newchange
Name of user not set #1002476 has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35847 )
Change subject: coreinfo/coreinfo.c: Provide information of time format
......................................................................
coreinfo/coreinfo.c: Provide information of time format
Specify Coordinated Universal Time (UTC) time format while print date and time
in the coreinfo payload.
Change-Id: I359cef7697daf5d92d2c9fb58bf75c5b1345e982
Signed-off-by: Sourabh Kashyap <sourabhka(a)hcl.com>
---
M payloads/coreinfo/coreinfo.c
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/35847/1
diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c
index 53985b2..ea4d424 100644
--- a/payloads/coreinfo/coreinfo.c
+++ b/payloads/coreinfo/coreinfo.c
@@ -124,8 +124,10 @@
rtc_read_clock(&tm);
- mvwprintw(menuwin, 1, 57, "%02d/%02d/%04d - %02d:%02d:%02d",
- tm.tm_mon + 1, tm.tm_mday, 1900 + tm.tm_year, tm.tm_hour,
+ mvwprintw(menuwin, 1, 53, "%02d/%02d/%04d", tm.tm_mon + 1,
+ tm.tm_mday, 1900 + tm.tm_year);
+ mvwprintw(menuwin, 1, 63, " - UTC ");
+ mvwprintw(menuwin, 1, 70, "%02d:%02d:%02d", tm.tm_hour,
tm.tm_min, tm.tm_sec);
}
#endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/35847
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I359cef7697daf5d92d2c9fb58bf75c5b1345e982
Gerrit-Change-Number: 35847
Gerrit-PatchSet: 1
Gerrit-Owner: Name of user not set #1002476
Gerrit-MessageType: newchange
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36407 )
Change subject: soc/intel/(fsp_)baytrail: Initialize SPI before console init
......................................................................
soc/intel/(fsp_)baytrail: Initialize SPI before console init
This makes the spi flash console function during romstage. It was
tested with the FSP baytrail codepath but it's a safe assumption that
the same fix also applies for the google mrc.bin codepath.
Tested on Intel Minnowboard Turbot.
Change-Id: If6ef0eeea902ab76d398d0218ee943e482f69b43
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/soc/intel/baytrail/romstage/romstage.c
M src/soc/intel/fsp_baytrail/romstage/romstage.c
2 files changed, 5 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/36407/1
diff --git a/src/soc/intel/baytrail/romstage/romstage.c b/src/soc/intel/baytrail/romstage/romstage.c
index 7c129e2..e06c39e 100644
--- a/src/soc/intel/baytrail/romstage/romstage.c
+++ b/src/soc/intel/baytrail/romstage/romstage.c
@@ -165,10 +165,10 @@
if (CONFIG(ENABLE_BUILTIN_COM1))
byt_config_com1_and_enable();
- console_init();
-
spi_init();
+ console_init();
+
set_max_freq();
punit_init();
diff --git a/src/soc/intel/fsp_baytrail/romstage/romstage.c b/src/soc/intel/fsp_baytrail/romstage/romstage.c
index f347591..78aa9fc 100644
--- a/src/soc/intel/fsp_baytrail/romstage/romstage.c
+++ b/src/soc/intel/fsp_baytrail/romstage/romstage.c
@@ -171,9 +171,11 @@
byt_config_com1_and_enable();
post_code(0x43);
- console_init();
spi_init();
+
+ console_init();
+
baytrail_rtc_init();
/* Call into mainboard. */
--
To view, visit https://review.coreboot.org/c/coreboot/+/36407
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If6ef0eeea902ab76d398d0218ee943e482f69b43
Gerrit-Change-Number: 36407
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange
Xiang Wang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36944 )
Change subject: arch/riscv: Fix cpu capabilities detection function
......................................................................
arch/riscv: Fix cpu capabilities detection function
On some platforms, misa may not be implemented. On such a platform,
reading misa will get zero. At this time, soc is required to
implement a non-standard method to detect the soc function.
This modification add interfaces for non-standard function.
The MXL field of misa is always at the highest two bits, whether it
is a 32-bit 64-bit or a 128-bit machine. Therefore, this modification
fixes the use of a fixed offset to detect the machine length.
Change-Id: Id24f77bf21ef0c7c300faa477d67294d093eeecc
Signed-off-by: Xiang Wang <merle(a)hardenedlinux.org>
---
M src/arch/riscv/Makefile.inc
A src/arch/riscv/cpu.c
M src/arch/riscv/include/arch/cpu.h
3 files changed, 87 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/36944/1
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index 0038523..0679be73 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -60,6 +60,7 @@
bootblock-y += trap_util.S
bootblock-y += trap_handler.c
bootblock-y += fp_asm.S
+bootblock-y += cpu.c
bootblock-y += misaligned.c
bootblock-y += sbi.c
bootblock-y += mcall.c
@@ -100,6 +101,7 @@
romstage-y += boot.c
romstage-y += romstage.c
romstage-y += misc.c
+romstage-y += cpu.c
romstage-$(ARCH_RISCV_PMP) += pmp.c
romstage-y += smp.c
romstage-y += \
@@ -137,6 +139,7 @@
ramstage-y += trap_util.S
ramstage-y += trap_handler.c
ramstage-y += fp_asm.S
+ramstage-y += cpu.c
ramstage-y += misaligned.c
ramstage-y += sbi.c
ramstage-y += virtual_memory.c
diff --git a/src/arch/riscv/cpu.c b/src/arch/riscv/cpu.c
new file mode 100644
index 0000000..69556f3
--- /dev/null
+++ b/src/arch/riscv/cpu.c
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2012 Google Inc.
+ *
+ * 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 <arch/cpu.h>
+
+
+__weak int soc_supports_extension(char ext)
+{
+ return 0;
+}
+
+__weak int soc_machine_xlen(void)
+{
+ return -1;
+}
diff --git a/src/arch/riscv/include/arch/cpu.h b/src/arch/riscv/include/arch/cpu.h
index c62199e..72a8a69 100644
--- a/src/arch/riscv/include/arch/cpu.h
+++ b/src/arch/riscv/include/arch/cpu.h
@@ -18,6 +18,7 @@
#include <arch/encoding.h>
#include <device/device.h>
+#include <commonlib/compiler.h>
#define asmlinkage
@@ -42,15 +43,68 @@
uint8_t riscv_model;
};
+/* If the SOC does not implement misa, the read misa will be zero.
+ * Such SOC requires a non-standard mechanism to detect ISA extensions.
+ * If the soc does not implement misa, implement this function.
+ * */
+int soc_supports_extension(char ext);
+
static inline int supports_extension(char ext)
{
- return read_csr(misa) & (1 << (ext - 'A'));
+ uintptr_t isa = read_csr(misa);
+ if (isa)
+ return isa & (1 << (ext - 'A'));
+ else
+ return soc_supports_extension(ext);
}
+/* If the SOC does not implement misa, the read misa will be zero.
+ * Such SOC requires a non-standard mechanism to detect machine XLEN.
+ * If the soc does not implement misa, implement this function.
+ * */
+int soc_machine_xlen(void);
+
static inline int machine_xlen(void)
{
- int mxl = (read_csr(misa) >> (__riscv_xlen - 2)) & 3;
- return (1 << mxl) * 16;
+ int r;
+ asm (
+ "csrr t0, misa\n\t"
+ "bnez t0, 1f\n\t"
+ "call soc_machine_xlen\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "srli t1, t0, 30\n\t"
+ "srli t1, t1, 32\n\t"
+ "srli t1, t1, 32\n\t"
+ "srli t1, t1, 32\n\t"
+ "andi t1, t1, 3\n\t"
+ "li t2, 3\n\t"
+ "bne t1, t2, 1f\n\t"
+ "li %0, 128\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "srli t1, t0, 30\n\t"
+ "srli t1, t1, 32\n\t"
+ "andi t1, t1, 3\n\t"
+ "li t2, 2\n\t"
+ "bne t1, t2, 1f\n\t"
+ "li %0, 64\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "srli t1, t0, 30\n\t"
+ "andi t1, t1, 3\n\t"
+ "li t2, 1\n\t"
+ "bne t1, t2, 1f\n\t"
+ "li %0, 32\n\t"
+ "j 2f\n"
+ "1:\n\t"
+ "li %0, -1\n"
+ "2:"
+ : "=r"(r)
+ :
+ : "t0", "t1", "t2", "ra"
+ );
+ return r;
}
struct cpu_info *cpu_info(void);
--
To view, visit https://review.coreboot.org/c/coreboot/+/36944
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id24f77bf21ef0c7c300faa477d67294d093eeecc
Gerrit-Change-Number: 36944
Gerrit-PatchSet: 1
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-MessageType: newchange