Skip to content

Commit 2cb873b

Browse files
committed
x86 FSP: generate ACPI tables (RSDP/XSDT/FADT/MADT/MCFG/DSDT) for the Linux payload
1 parent 9bdc6cb commit 2cb873b

8 files changed

Lines changed: 711 additions & 3 deletions

File tree

‎arch.mk‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,9 @@ ifeq ("${FSP}", "1")
23022302
OBJS += src/gpt.o
23032303
OBJS += src/disk.o
23042304
OBJS += src/x86/mptable.o
2305+
ifeq ($(ACPI),1)
2306+
OBJS += src/x86/acpi.o
2307+
endif
23052308
OBJS += src/stage2_params.o
23062309
OBJS += src/x86/exceptions.o
23072310
OBJS += src/x86/gdt.o

‎include/x86/acpi.h‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* acpi.h
2+
*
3+
* Copyright (C) 2026 wolfSSL Inc.
4+
*
5+
* This file is part of wolfBoot.
6+
*
7+
* wolfBoot is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfBoot is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
#ifndef WOLFBOOT_ACPI_H
22+
#define WOLFBOOT_ACPI_H
23+
24+
#include <stdint.h>
25+
26+
/* ACPI tables go in high RAM below tolum, clear of the payload; the loader
27+
* reserves it in e820. Overridable for the host unit test. */
28+
#ifndef ACPI_TABLE_BASE
29+
#define ACPI_TABLE_BASE 0x60000000UL
30+
#endif
31+
#define ACPI_TABLE_SIZE 0x00010000UL /* 64 KiB */
32+
33+
/* Build RSDP -> XSDT -> { FADT, MADT, MCFG, DSDT } at ACPI_TABLE_BASE and
34+
* return the RSDP physical address for boot_params.acpi_rsdp_addr. */
35+
uint64_t acpi_setup(void);
36+
37+
#endif /* WOLFBOOT_ACPI_H */

‎include/x86/acpi_dsdt.h‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/* acpi_dsdt.h
2+
*
3+
* Copyright (C) 2026 wolfSSL Inc.
4+
*
5+
* This file is part of wolfBoot.
6+
*
7+
* wolfBoot is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfBoot is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
/* Generated from src/x86/acpi_dsdt.asl by iasl + xxd -i; do not edit by hand.
22+
* Regenerate: iasl src/x86/acpi_dsdt.asl &&
23+
* xxd -i -n acpi_dsdt_aml src/x86/acpi_dsdt.aml (append below this header). */
24+
static const unsigned char acpi_dsdt_aml[] = {
25+
0x44, 0x53, 0x44, 0x54, 0x1e, 0x02, 0x00, 0x00, 0x02, 0x48, 0x57, 0x4f,
26+
0x4c, 0x46, 0x42, 0x54, 0x4e, 0x41, 0x49, 0x54, 0x47, 0x4c, 0x00, 0x00,
27+
0x01, 0x00, 0x00, 0x00, 0x49, 0x4e, 0x54, 0x4c, 0x28, 0x06, 0x23, 0x20,
28+
0x10, 0x49, 0x1f, 0x5f, 0x53, 0x42, 0x5f, 0x5b, 0x82, 0x41, 0x1f, 0x50,
29+
0x43, 0x49, 0x30, 0x08, 0x5f, 0x48, 0x49, 0x44, 0x0c, 0x41, 0xd0, 0x0a,
30+
0x08, 0x08, 0x5f, 0x43, 0x49, 0x44, 0x0c, 0x41, 0xd0, 0x0a, 0x03, 0x08,
31+
0x5f, 0x53, 0x45, 0x47, 0x00, 0x08, 0x5f, 0x42, 0x42, 0x4e, 0x00, 0x08,
32+
0x5f, 0x55, 0x49, 0x44, 0x00, 0x14, 0x46, 0x12, 0x5f, 0x50, 0x52, 0x54,
33+
0x00, 0xa4, 0x12, 0x4d, 0x11, 0x17, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
34+
0x02, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
35+
0x04, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
36+
0x0d, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
37+
0x14, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
38+
0x14, 0x00, 0x01, 0x00, 0x0a, 0x11, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
39+
0x15, 0x00, 0x00, 0x00, 0x0a, 0x1b, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
40+
0x15, 0x00, 0x01, 0x00, 0x0a, 0x28, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
41+
0x16, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
42+
0x17, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff,
43+
0x19, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x12, 0x0c, 0x04, 0x0c, 0xff, 0xff,
44+
0x19, 0x00, 0x0a, 0x02, 0x00, 0x0a, 0x21, 0x12, 0x0b, 0x04, 0x0c, 0xff,
45+
0xff, 0x1c, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04, 0x0c, 0xff,
46+
0xff, 0x1c, 0x00, 0x01, 0x00, 0x0a, 0x11, 0x12, 0x0c, 0x04, 0x0c, 0xff,
47+
0xff, 0x1c, 0x00, 0x0a, 0x02, 0x00, 0x0a, 0x12, 0x12, 0x0c, 0x04, 0x0c,
48+
0xff, 0xff, 0x1c, 0x00, 0x0a, 0x03, 0x00, 0x0a, 0x13, 0x12, 0x0b, 0x04,
49+
0x0c, 0xff, 0xff, 0x1d, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12, 0x0b, 0x04,
50+
0x0c, 0xff, 0xff, 0x1d, 0x00, 0x01, 0x00, 0x0a, 0x11, 0x12, 0x0c, 0x04,
51+
0x0c, 0xff, 0xff, 0x1d, 0x00, 0x0a, 0x02, 0x00, 0x0a, 0x12, 0x12, 0x0c,
52+
0x04, 0x0c, 0xff, 0xff, 0x1d, 0x00, 0x0a, 0x03, 0x00, 0x0a, 0x13, 0x12,
53+
0x0b, 0x04, 0x0c, 0xff, 0xff, 0x1e, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x12,
54+
0x0b, 0x04, 0x0c, 0xff, 0xff, 0x1e, 0x00, 0x01, 0x00, 0x0a, 0x11, 0x12,
55+
0x0c, 0x04, 0x0c, 0xff, 0xff, 0x1e, 0x00, 0x0a, 0x02, 0x00, 0x0a, 0x24,
56+
0x12, 0x0b, 0x04, 0x0c, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x0a, 0x10,
57+
0x08, 0x5f, 0x43, 0x52, 0x53, 0x11, 0x48, 0x09, 0x0a, 0x94, 0x88, 0x0d,
58+
0x00, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
59+
0x18, 0x00, 0x88, 0x0d, 0x00, 0x01, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00,
60+
0xf7, 0x0c, 0x00, 0x00, 0xf8, 0x0c, 0x88, 0x0d, 0x00, 0x01, 0x0c, 0x03,
61+
0x00, 0x00, 0x00, 0x0d, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf3, 0x87, 0x17,
62+
0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
63+
0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
64+
0x87, 0x17, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65+
0x00, 0x80, 0xff, 0xff, 0xff, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66+
0x00, 0x40, 0x8a, 0x2b, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x00,
67+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
68+
0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
70+
0x79, 0x00
71+
};
72+
static const unsigned int acpi_dsdt_aml_len = 542;

‎include/x86/linux_loader.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct boot_e820_entry {
3737
enum e820_type {
3838
E820_TYPE_RAM = 1,
3939
E820_TYPE_RESERVED = 2,
40+
E820_TYPE_ACPI = 3,
4041
};
4142

4243
struct setup_header {

‎options.mk‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ endif
5151
WOLFBOOT_TEST_FILLER?=0
5252
WOLFBOOT_TIME_TEST?=0
5353

54+
# Generate a minimal ACPI table set (RSDP/XSDT/FADT/MADT/MCFG + DSDT) for the
55+
# x86 FSP Linux payload, so the OS gets the interrupt model and PCI routing.
56+
ifeq ($(ACPI),1)
57+
CFLAGS+=-D"WOLFBOOT_ACPI"
58+
endif
59+
5460
ifeq ($(USE_CLANG),1)
5561
ifeq ($(USE_GCC),1)
5662
$(error USE_CLANG=1 is incompatible with USE_GCC=1; set USE_GCC=0)

0 commit comments

Comments
 (0)