diff mbox series

x86: coreboot: add SMBIOS cbmem entry parsing

Message ID 20200514131622.611208-1-christian.gmeiner@gmail.com
State Accepted
Commit 53942b96586fd0c9b15fb89b7c73dbf4047350df
Headers show
Series x86: coreboot: add SMBIOS cbmem entry parsing | expand

Commit Message

Christian Gmeiner May 14, 2020, 1:16 p.m. UTC
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 arch/x86/cpu/coreboot/tables.c               | 14 ++++++++++++++
 arch/x86/include/asm/arch-coreboot/sysinfo.h |  2 ++
 arch/x86/include/asm/coreboot_tables.h       | 11 +++++++++++
 3 files changed, 27 insertions(+)

Comments

Bin Meng May 17, 2020, 2:29 p.m. UTC | #1
On Thu, May 14, 2020 at 9:16 PM Christian Gmeiner
<christian.gmeiner at gmail.com> wrote:
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
>  arch/x86/cpu/coreboot/tables.c               | 14 ++++++++++++++
>  arch/x86/include/asm/arch-coreboot/sysinfo.h |  2 ++
>  arch/x86/include/asm/coreboot_tables.h       | 11 +++++++++++
>  3 files changed, 27 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
Bin Meng May 19, 2020, 2:16 p.m. UTC | #2
On Sun, May 17, 2020 at 10:29 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> On Thu, May 14, 2020 at 9:16 PM Christian Gmeiner
> <christian.gmeiner at gmail.com> wrote:
> >
> > Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> > ---
> >  arch/x86/cpu/coreboot/tables.c               | 14 ++++++++++++++
> >  arch/x86/include/asm/arch-coreboot/sysinfo.h |  2 ++
> >  arch/x86/include/asm/coreboot_tables.h       | 11 +++++++++++
> >  3 files changed, 27 insertions(+)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

applied to u-boot-x86, thanks!
diff mbox series

Patch

diff --git a/arch/x86/cpu/coreboot/tables.c b/arch/x86/cpu/coreboot/tables.c
index 0f04c4f8e9..a5d31d1dea 100644
--- a/arch/x86/cpu/coreboot/tables.c
+++ b/arch/x86/cpu/coreboot/tables.c
@@ -69,6 +69,17 @@  static void cb_parse_vbnv(unsigned char *ptr, struct sysinfo_t *info)
 	info->vbnv_size = vbnv->vbnv_size;
 }
 
+static void cb_parse_cbmem_entry(unsigned char *ptr, struct sysinfo_t *info)
+{
+	struct cb_cbmem_entry *entry = (struct cb_cbmem_entry *)ptr;
+
+	if (entry->id != CBMEM_ID_SMBIOS)
+		return;
+
+	info->smbios_start = entry->address;
+	info->smbios_size = entry->entry_size;
+}
+
 static void cb_parse_gpios(unsigned char *ptr, struct sysinfo_t *info)
 {
 	int i;
@@ -206,6 +217,9 @@  static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 		case CB_TAG_VBNV:
 			cb_parse_vbnv(ptr, info);
 			break;
+		case CB_TAG_CBMEM_ENTRY:
+			cb_parse_cbmem_entry(ptr, info);
+			break;
 		default:
 			cb_parse_unhandled(rec->tag, ptr);
 			break;
diff --git a/arch/x86/include/asm/arch-coreboot/sysinfo.h b/arch/x86/include/asm/arch-coreboot/sysinfo.h
index dd8d1cba92..419ec52933 100644
--- a/arch/x86/include/asm/arch-coreboot/sysinfo.h
+++ b/arch/x86/include/asm/arch-coreboot/sysinfo.h
@@ -49,6 +49,8 @@  struct sysinfo_t {
 	u32	vdat_size;
 	void	*tstamp_table;
 	void	*cbmem_cons;
+	u64 smbios_start;
+	u32 smbios_size;
 
 	struct cb_serial *serial;
 };
diff --git a/arch/x86/include/asm/coreboot_tables.h b/arch/x86/include/asm/coreboot_tables.h
index 268284f43c..7e1576768b 100644
--- a/arch/x86/include/asm/coreboot_tables.h
+++ b/arch/x86/include/asm/coreboot_tables.h
@@ -214,6 +214,17 @@  struct cb_vbnv {
 	uint32_t vbnv_size;
 };
 
+#define CB_TAG_CBMEM_ENTRY 0x0031
+#define CBMEM_ID_SMBIOS    0x534d4254
+
+struct cb_cbmem_entry {
+	uint32_t tag;
+	uint32_t size;
+	uint64_t address;
+	uint32_t entry_size;
+	uint32_t id;
+};
+
 #define CB_TAG_CMOS_OPTION_TABLE	0x00c8
 
 struct cb_cmos_option_table {