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
Yan Liu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43478 )
Change subject: mb/mainboard/dedede: Add P-sensor for Boten
......................................................................
mb/mainboard/dedede: Add P-sensor for Boten
Add devicetree and device ID for P-sensor
BUG=b:161217096
BRANCH=NONE
TEST=We can get the data from P-sensor if touch the SAR antenna.
Signed-off-by: Yan Liu <yan.liu(a)bitland.corp-partner.google.com>
Change-Id: I8e02c2cf477aa83b3d4c69ce84d48a8ad1a2560f
---
M src/mainboard/google/dedede/Kconfig
M src/mainboard/google/dedede/variants/boten/overridetree.cb
2 files changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/43478/1
diff --git a/src/mainboard/google/dedede/Kconfig b/src/mainboard/google/dedede/Kconfig
index dcea3fa..0658e66 100644
--- a/src/mainboard/google/dedede/Kconfig
+++ b/src/mainboard/google/dedede/Kconfig
@@ -17,6 +17,7 @@
select MAINBOARD_HAS_SPI_TPM_CR50
select MAINBOARD_HAS_TPM2
select SOC_INTEL_JASPERLAKE
+ select DRIVERS_I2C_SX9310
if BOARD_GOOGLE_BASEBOARD_DEDEDE
diff --git a/src/mainboard/google/dedede/variants/boten/overridetree.cb b/src/mainboard/google/dedede/variants/boten/overridetree.cb
index 46fe20e..e743abe 100644
--- a/src/mainboard/google/dedede/variants/boten/overridetree.cb
+++ b/src/mainboard/google/dedede/variants/boten/overridetree.cb
@@ -140,6 +140,15 @@
device i2c 29 on end
end
end # I2C 4
+ device pci 19.1 on
+ chip drivers/i2c/generic
+ register "hid" = ""sx932x""
+ register "name" = ""Semtech sx932x""
+ register "desc" = ""SAR Proximity Sensor""
+ register "irq" = "ACPI_IRQ_LEVEL_LOW(GPP_E11_IRQ)"
+ device i2c 28 on end
+ end
+ end # I2C 5
device pci 1f.3 on end # Intel HDA/cAVS
end
end
--
To view, visit https://review.coreboot.org/c/coreboot/+/43478
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I8e02c2cf477aa83b3d4c69ce84d48a8ad1a2560f
Gerrit-Change-Number: 43478
Gerrit-PatchSet: 1
Gerrit-Owner: Yan Liu <yan.liu(a)bitland.corp-partner.google.com>
Gerrit-MessageType: newchange