Skip to content

Commit 015fb7a

Browse files
committed
setup, acpi: map BIOS areas where ACPI's RSDP table is located
This is needed to get rid of "Low memory" mappings. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
1 parent 4fb9742 commit 015fb7a

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

common/acpi.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
#include <percpu.h>
3434
#include <string.h>
3535

36-
#define ACPI_RSDP_BIOS_ROM_START 0xE0000
37-
#define ACPI_RSDP_BIOS_ROM_STOP 0xFFFFF
38-
3936
acpi_table_t *acpi_tables[128];
4037
unsigned max_acpi_tables;
4138

@@ -109,8 +106,8 @@ static rsdp_rev1_t *acpi_find_rsdp(void) {
109106
if (rsdp)
110107
return rsdp;
111108

112-
rsdp = find_rsdp(paddr_to_virt_kern(ACPI_RSDP_BIOS_ROM_START),
113-
paddr_to_virt_kern(ACPI_RSDP_BIOS_ROM_STOP));
109+
rsdp = find_rsdp(paddr_to_virt_kern(BIOS_ACPI_ROM_START),
110+
paddr_to_virt_kern(BIOS_ACPI_ROM_STOP));
114111
if (rsdp)
115112
return rsdp;
116113

common/setup.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,19 @@ void zap_boot_mappings(void) {
179179
}
180180
}
181181

182+
static void map_bios_area(void) {
183+
vmap_4k(paddr_to_virt(BDA_ADDR_START), paddr_to_mfn(BDA_ADDR_START), L1_PROT_RO);
184+
kmap_4k(paddr_to_mfn(BDA_ADDR_START), L1_PROT_RO);
185+
186+
uint32_t ebda_addr = get_bios_ebda_addr();
187+
vmap_4k(paddr_to_virt(ebda_addr), paddr_to_mfn(ebda_addr), L1_PROT_RO);
188+
kmap_4k(paddr_to_mfn(ebda_addr), L1_PROT_RO);
189+
190+
for (mfn_t bios_mfn = paddr_to_mfn(BIOS_ACPI_ROM_START);
191+
bios_mfn < paddr_to_mfn(BIOS_ACPI_ROM_STOP); bios_mfn++)
192+
kmap_4k(bios_mfn, L1_PROT_RO);
193+
}
194+
182195
void __noreturn __text_init kernel_start(uint32_t multiboot_magic,
183196
multiboot_info_t *mbi) {
184197
/* Zero-out BSS sections */
@@ -220,6 +233,7 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic,
220233
init_pagetables();
221234

222235
map_multiboot_areas();
236+
map_bios_area();
223237

224238
write_cr3(cr3.paddr);
225239
WRITE_SP(get_free_pages_top(PAGE_ORDER_2M, GFP_KERNEL));

include/mm/pmm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#define BDA_COM_PORTS_ENTRY 0x400
3232
#define EBDA_ADDR_ENTRY 0x40E
3333

34+
#define BIOS_ACPI_ROM_START 0xE0000
35+
#define BIOS_ACPI_ROM_STOP 0xFFFFF
36+
3437
#define BIOS_ROM_ADDR_START 0xF0000
3538

3639
#ifndef __ASSEMBLY__

0 commit comments

Comments
 (0)