Skip to content

Commit 08b7b3d

Browse files
committed
acpi: use multiboot2-provided RSDP structure when available
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
1 parent 16f4008 commit 08b7b3d

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

arch/x86/boot/multiboot.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ void init_multiboot(unsigned long *addr, const char **cmdline) {
149149

150150
printk("[multiboot2] EFI64 Pointer: 0x%p\n", efi64->pointer);
151151
} break;
152+
153+
case MULTIBOOT2_TAG_TYPE_ACPI_OLD: {
154+
struct multiboot2_tag_old_acpi *acpi = (struct multiboot2_tag_old_acpi *) tag;
155+
156+
acpi_rsdp = _paddr(&acpi->rsdp);
157+
158+
printk("[multiboot2] ACPI RSDPv1: 0x%016lx\n", acpi_rsdp);
159+
} break;
160+
161+
case MULTIBOOT2_TAG_TYPE_ACPI_NEW: {
162+
struct multiboot2_tag_new_acpi *acpi = (struct multiboot2_tag_new_acpi *) tag;
163+
164+
acpi_rsdp = _paddr(&acpi->rsdp);
165+
166+
printk("[multiboot2] ACPI RSDPv2: 0x%016lx\n", acpi_rsdp);
167+
} break;
168+
152169
case MULTIBOOT2_TAG_TYPE_LOAD_BASE_ADDR: {
153170
struct multiboot2_tag_load_base_addr *addr =
154171
(struct multiboot2_tag_load_base_addr *) tag;

common/acpi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <setup.h>
2929
#include <string.h>
3030

31+
paddr_t acpi_rsdp = 0;
32+
3133
static const char *madt_int_bus_names[] = {
3234
[ACPI_MADT_INT_BUS_ISA] = "ISA",
3335
};
@@ -115,6 +117,9 @@ static rsdp_rev1_t *acpi_find_rsdp(void) {
115117
uint32_t ebda_addr;
116118
rsdp_rev1_t *rsdp;
117119

120+
if (acpi_rsdp)
121+
return (rsdp_rev1_t *) acpi_rsdp;
122+
118123
ebda_addr = get_bios_ebda_addr();
119124
rsdp =
120125
find_rsdp(paddr_to_virt_kern(ebda_addr), paddr_to_virt_kern(ebda_addr + KB(1)));

drivers/acpi/acpica/osl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424
*/
2525
#ifdef KTF_ACPICA
26+
#include <acpi_ktf.h>
2627
#include <cpu.h>
2728
#include <ktf.h>
2829
#include <mm/slab.h>
@@ -186,7 +187,11 @@ ACPI_STATUS AcpiOsWritePort(ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width)
186187
ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer(void) {
187188
ACPI_PHYSICAL_ADDRESS pa = 0;
188189

189-
AcpiFindRootPointer(&pa);
190+
if (acpi_rsdp)
191+
pa = (ACPI_PHYSICAL_ADDRESS) acpi_rsdp;
192+
else
193+
AcpiFindRootPointer(&pa);
194+
190195
return pa;
191196
}
192197

include/acpi_ktf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
extern unsigned acpi_get_nr_cpus(void);
4949

50+
extern paddr_t acpi_rsdp;
51+
5052
#ifndef KTF_ACPICA
5153
#define RSDP_SIGNATURE (('R') | ('S' << 8) | ('D' << 16) | ('P' << 24))
5254
#define RSDT_SIGNATURE (('R') | ('S' << 8) | ('D' << 16) | ('T' << 24))

0 commit comments

Comments
 (0)