ron minnich has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41388 )
Change subject: acpi: add a function to read a table and verify it
......................................................................
acpi: add a function to read a table and verify it
coreboot can currently read some ACPI tables from cbfs.
There is a fair amount of repeated code. Add a function
which can take a file name, and a table name, which
reads the file in, verifies its size, and its name,
returns a pointer to it if it is OK, NULL otherwise.
Show one use of the function: if a madt is found in
cbfs, use it instead of generating tables.
Over time, this code might replace other instances
of the copied-pasted code use for, e.g., the SLIT.
One such use of this code is on platforms where an
ACPI table has been supplied and it it not yet possible
to generate one.
Tested-by: Ronald G. Minnich <rminnich(a)google.com>
Change-Id: Id5e82eb0a82555b7763107e2a1e2a529a0c1b11f
Signed-off-by: Ronald G. Minnich <rminnich(a)google.com>
---
M src/acpi/acpi.c
1 file changed, 36 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/41388/1
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index 8bf4b49..f1d2e78 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -39,6 +39,34 @@
}
/**
+ * Read in a named table, and verify its properties
+ */
+acpi_header_t *acpi_read_table(const char *filename, const char *tablename)
+{
+ acpi_header_t *file;
+ size_t table_size;
+
+ file = cbfs_boot_map_with_leak(filename, CBFS_TYPE_RAW, &table_size);
+ if (!file) {
+ printk(BIOS_ERR, "No %s file for table %s\n", filename, tablename);
+ return NULL;
+ }
+ if (file->length > table_size) {
+ printk(BIOS_ERR, "Invalid %s file: file length(%d) > table_size(%ld)\n", filename, file->length, table_size);
+ return NULL;
+ }
+ if (file->length < sizeof(acpi_header_t)) {
+ printk(BIOS_ERR, "Invalid %s file: file length(%d) < table_size(%ld)\n", filename, file->length, table_size);
+ return NULL;
+ }
+ if (memcmp(file->signature, tablename, 4) != 0) {
+ printk(BIOS_ERR, "Invalid %s file, signature(%s) does not match %s\n", filename, file->signature, tablename);
+ return NULL;
+ }
+ return file;
+}
+
+/**
* Add an ACPI table to the RSDT (and XSDT) structure, recalculate length
* and checksum.
*/
@@ -231,9 +259,16 @@
void acpi_create_madt(acpi_madt_t *madt)
{
- acpi_header_t *header = &(madt->header);
+ acpi_header_t *header, *file;
unsigned long current = (unsigned long)madt + sizeof(acpi_madt_t);
+ file = acpi_read_table(CONFIG_CBFS_PREFIX "/madt.aml", "APIC");
+ if (file) {
+ memmove(madt, file, file->length);
+ return;
+ }
+
+ header = &(madt->header);
memset((void *)madt, 0, sizeof(acpi_madt_t));
if (!header)
--
To view, visit https://review.coreboot.org/c/coreboot/+/41388
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id5e82eb0a82555b7763107e2a1e2a529a0c1b11f
Gerrit-Change-Number: 41388
Gerrit-PatchSet: 1
Gerrit-Owner: ron minnich <rminnich(a)gmail.com>
Gerrit-MessageType: newchange
ron minnich has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42235 )
Change subject: get vgabios command to build in
......................................................................
get vgabios command to build in
This program was broken by f94aed87730. This points to a weakness
in our CI: changes in coreboot itself broke a utility and it
was not caught for a year.
This builds, but in most ways, it seems like it would never work.
Many important bits are unsupported, particularly devfn and
tracing.
It seems the best path forward is to revert the 2015 patch that
converted it to using YABEL. The vgabios code prior to that patch
builds without warning and still works.
But it's probably worth getting this code to build.
Change-Id: I48e13e31deee0100a616a2f1d08ca84b9c470219
Signed-off-by: Ronald G Minnich <rminnich(a)gmail.com>
---
M src/device/oprom/x86emu/x86emui.h
M src/device/oprom/yabel/device.h
M src/device/oprom/yabel/interrupt.c
M src/device/oprom/yabel/pmm.h
M util/vgabios/device.c
M util/vgabios/testbios.c
6 files changed, 16 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/42235/1
diff --git a/src/device/oprom/x86emu/x86emui.h b/src/device/oprom/x86emu/x86emui.h
index b1647c5..a49a00f 100644
--- a/src/device/oprom/x86emu/x86emui.h
+++ b/src/device/oprom/x86emu/x86emui.h
@@ -41,6 +41,7 @@
#ifndef __X86EMU_X86EMUI_H
#define __X86EMU_X86EMUI_H
+#include <string.h>
/* If we are compiling in C++ mode, we can compile some functions as
* inline to increase performance (however the code size increases quite
* dramatically in this case).
diff --git a/src/device/oprom/yabel/device.h b/src/device/oprom/yabel/device.h
index 4f28a59..57b0533 100644
--- a/src/device/oprom/yabel/device.h
+++ b/src/device/oprom/yabel/device.h
@@ -62,7 +62,7 @@
u16 bev; // Bootstrap Entry Vector
u16 reserved_2;
u16 sriv; // Static Resource Information Vector
-} __packed exp_header_struct_t;
+} __attribute__((packed)) exp_header_struct_t;
// a PCI Data Struct as defined in PCI 2.3 Spec Chapter 6.3.1.2
typedef struct {
@@ -78,7 +78,7 @@
u8 code_type;
u8 indicator;
u16 reserved_2;
-} __packed pci_data_struct_t;
+} __attribute__((packed)) pci_data_struct_t;
typedef struct {
u8 bus;
@@ -118,7 +118,7 @@
u64 address;
u64 address_offset;
u64 size;
-} __packed translate_address_t;
+} __attribute((packed)) translate_address_t;
// array to store address translations for this
// device. Needed for faster address translation, so
@@ -205,4 +205,7 @@
printf("HID4: %016llx\n", (unsigned long long)hid);
}
+// prototypes from coreboot that we can not easily include.
+const char *dev_path(const struct device *dev);
+struct device *dev_find_device(u16 vendor, u16 device, struct device *from);
#endif
diff --git a/src/device/oprom/yabel/interrupt.c b/src/device/oprom/yabel/interrupt.c
index 338156f..ddc9080 100644
--- a/src/device/oprom/yabel/interrupt.c
+++ b/src/device/oprom/yabel/interrupt.c
@@ -373,7 +373,8 @@
dev = bios_device.dev;
M.x86.R_BH = bios_device.bus;
M.x86.R_BL = bios_device.devfn;
- } else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
+ } else {
+#if CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)
dev = dev_find_device(M.x86.R_DX, M.x86.R_CX, 0);
if (dev != NULL) {
M.x86.R_BH = dev->bus->secondary;
@@ -382,6 +383,7 @@
("%s(): function %x: PCI Find Device --> 0x%04x\n",
__func__, M.x86.R_AX, M.x86.R_BX);
}
+#endif
}
if (dev == NULL) {
DEBUG_PRINTF_INTR
@@ -408,10 +410,12 @@
if ((bus == bios_device.bus) && (devfn == bios_device.devfn)) {
dev = bios_device.dev;
- } else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
+ } else {
+#if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES))
dev = pcidev_path_on_bus(bus, devfn);
DEBUG_PRINTF_INTR("%s(): function: %x: pcidev_path_on_bus() returned: %s\n",
__func__, M.x86.R_AX, dev_path(dev));
+#endif
}
if (dev == NULL) {
diff --git a/src/device/oprom/yabel/pmm.h b/src/device/oprom/yabel/pmm.h
index 2ecc36e..ea728f5 100644
--- a/src/device/oprom/yabel/pmm.h
+++ b/src/device/oprom/yabel/pmm.h
@@ -54,7 +54,7 @@
* see interrupt.c) and the INT Handler will do the actual PMM work.
*/
u8 code[3];
-} __packed pmm_information_t;
+} __attribute__((packed)) pmm_information_t;
/* This function is used to setup the PMM struct in virtual memory
* at a certain offset */
diff --git a/util/vgabios/device.c b/util/vgabios/device.c
index d130314..def8c44 100644
--- a/util/vgabios/device.c
+++ b/util/vgabios/device.c
@@ -308,6 +308,7 @@
u8
biosemu_dev_check_exprom(unsigned long rom_base_addr)
{
+ DEBUG_PRINTF("Not checking for exprom at %#lx\n", rom_base_addr);
#if 0
int i = 0;
translate_address_t ta;
diff --git a/util/vgabios/testbios.c b/util/vgabios/testbios.c
index d66c857..7612276 100644
--- a/util/vgabios/testbios.c
+++ b/util/vgabios/testbios.c
@@ -137,7 +137,7 @@
unsigned short initialip = 0, initialcs = 0, devfn = 0;
//X86EMU_intrFuncs intFuncs[256];
int debugflag = 0;
- struct device *dev;
+ struct device *dev = NULL;
//const char *optstring = "vh?b:i:c:s:tpd:";
const char *optstring = "vh?b:i:c:s:tpd:";
--
To view, visit https://review.coreboot.org/c/coreboot/+/42235
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I48e13e31deee0100a616a2f1d08ca84b9c470219
Gerrit-Change-Number: 42235
Gerrit-PatchSet: 1
Gerrit-Owner: ron minnich <rminnich(a)gmail.com>
Gerrit-MessageType: newchange
Tim Chu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41604 )
Change subject: mb/ocp/tiogapass: Implement set POST start/end command
......................................................................
mb/ocp/tiogapass: Implement set POST start/end command
Implemented sending POST start and POST end command to BMC in ramstage.
Tested=Read POST command in OpenBMC,
if success message may show as below,
root@bmc:~# cat /var/log/messages |grep -i "POST"
Aug 10 00:11:24 bmc user.info ipmid: POST Start Event for Payload#1
Aug 10 00:11:28 bmc user.info ipmid: POST End Event for Payload#1
root@bmc:~#
Signed-off-by: TimChu <Tim.Chu(a)quantatw.com>
Change-Id: Ia283c5e8d539bfeb47a73d32d8bfb5e666f27170
---
M src/mainboard/ocp/tiogapass/Kconfig
M src/mainboard/ocp/tiogapass/devicetree.cb
2 files changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/41604/1
diff --git a/src/mainboard/ocp/tiogapass/Kconfig b/src/mainboard/ocp/tiogapass/Kconfig
index 5cb2421..2ec47ed 100644
--- a/src/mainboard/ocp/tiogapass/Kconfig
+++ b/src/mainboard/ocp/tiogapass/Kconfig
@@ -9,6 +9,7 @@
select HAVE_ACPI_TABLES
select MAINBOARD_USES_FSP2_0
select IPMI_KCS
+ select IPMI_OCP
select SOC_INTEL_SKYLAKE_SP
select SUPERIO_ASPEED_AST2400
diff --git a/src/mainboard/ocp/tiogapass/devicetree.cb b/src/mainboard/ocp/tiogapass/devicetree.cb
index 19dba55..35e74b0 100644
--- a/src/mainboard/ocp/tiogapass/devicetree.cb
+++ b/src/mainboard/ocp/tiogapass/devicetree.cb
@@ -77,6 +77,9 @@
register "bmc_i2c_address" = "0x20"
register "bmc_boot_timeout" = "60"
end
+ chip drivers/ocp/ipmi # OCP specific IPMI porting
+ device pnp ca2.1 on end
+ end
end # Intel Corporation C621 Series Chipset LPC/eSPI Controller
device pci 1f.2 on end # Intel Corporation C620 Series Chipset Family Power Management Controller
device pci 1f.4 on end # Intel Corporation C620 Series Chipset Family SMBus
--
To view, visit https://review.coreboot.org/c/coreboot/+/41604
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ia283c5e8d539bfeb47a73d32d8bfb5e666f27170
Gerrit-Change-Number: 41604
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Chu <Tim.Chu(a)quantatw.com>
Gerrit-MessageType: newchange