Hi,
I recently got a VAIO Pro PK. The diff below is required to boot.
Without the diff, it freezes during boot.
Its EFI framebuffer is located 0x4000000000 (9 zeros). This is > 4GB
and higher than highest available memory of the machine. These
configuraions seem to cause the problem.
* * *
Call cninit() after pmap_bootstrap() is called. Since the EFI
framebuffer may be located > 4GB which is not initialized by locore,
but by pmap_bootstrap(). Also make the address parameter passed to
pmap_bootstrap() cover the framebuffer. Actually VAIO pro PK's
framebuffer is located higher than the highest available memory
region.
ok? comments?
Index: sys/arch/amd64/amd64/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v
retrieving revision 1.259
diff -u -p -r1.259 machdep.c
--- sys/arch/amd64/amd64/machdep.c 7 Sep 2019 19:05:44 -0000 1.259
+++ sys/arch/amd64/amd64/machdep.c 19 Sep 2019 15:55:18 -0000
@@ -193,6 +193,8 @@ int lid_action = 1;
int pwr_action = 1;
int forceukbd;
+int docninit;
+
/*
* safepri is a safe priority for sleep to set for a spin-wait
* during autoconfiguration or after a panic.
@@ -1371,6 +1373,7 @@ init_x86_64(paddr_t first_avail)
bios_memmap_t *bmp;
int x, ist;
uint64_t max_dm_size = ((uint64_t)512 * NUM_L4_SLOT_DIRECT) << 30;
+ paddr_t max_pa;
cpu_init_msrs(&cpu_info_primary);
@@ -1541,7 +1544,16 @@ init_x86_64(paddr_t first_avail)
* Call pmap initialization to make new kernel address space.
* We must do this before loading pages into the VM system.
*/
- first_avail = pmap_bootstrap(first_avail, trunc_page(avail_end));
+ max_pa = avail_end;
+ /* Make sure max_pa covers the EFI frame buffer */
+ if (bios_efiinfo->fb_addr != 0 &&
+ max_pa < bios_efiinfo->fb_addr + bios_efiinfo->fb_size)
+ max_pa = bios_efiinfo->fb_addr + bios_efiinfo->fb_size;
+ first_avail = pmap_bootstrap(first_avail, trunc_page(max_pa));
+
+ /* Call cninit after entire physical memory is available */
+ if (docninit > 0)
+ cninit();
/* Allocate these out of the 640KB base memory */
if (avail_start != PAGE_SIZE)
@@ -1914,7 +1926,6 @@ getbootinfo(char *bootinfo, int bootinfo
bios_ddb_t *bios_ddb;
bios_bootduid_t *bios_bootduid;
bios_bootsr_t *bios_bootsr;
- int docninit = 0;
#undef BOOTINFO_DEBUG
#ifdef BOOTINFO_DEBUG
@@ -2026,8 +2037,6 @@ getbootinfo(char *bootinfo, int bootinfo
break;
}
}
- if (docninit > 0)
- cninit();
#ifdef BOOTINFO_DEBUG
printf("\n");
#endif