Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/stand/efiboot efiboot: pass memory map after E...
details: https://anonhg.NetBSD.org/src/rev/ede80b5f9a72
branches: trunk
changeset: 821624:ede80b5f9a72
user: nonaka <nonaka%NetBSD.org@localhost>
date: Sat Feb 11 10:13:46 2017 +0000
description:
efiboot: pass memory map after ExitBootService is called to kernel.
diffstat:
sys/arch/i386/stand/efiboot/Makefile.efiboot | 3 +-
sys/arch/i386/stand/efiboot/efiboot.c | 21 ++++++++++---
sys/arch/i386/stand/efiboot/efiboot.h | 4 +-
sys/arch/i386/stand/efiboot/efimemory.c | 44 +++++----------------------
4 files changed, 29 insertions(+), 43 deletions(-)
diffs (184 lines):
diff -r 38c135145dfb -r ede80b5f9a72 sys/arch/i386/stand/efiboot/Makefile.efiboot
--- a/sys/arch/i386/stand/efiboot/Makefile.efiboot Sat Feb 11 09:15:38 2017 +0000
+++ b/sys/arch/i386/stand/efiboot/Makefile.efiboot Sat Feb 11 10:13:46 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.6 2017/02/06 10:32:35 nonaka Exp $
+# $NetBSD: Makefile.efiboot,v 1.7 2017/02/11 10:13:46 nonaka Exp $
S= ${.CURDIR}/../../../../..
@@ -61,7 +61,6 @@
CPPFLAGS+= -DSUPPORT_DOSFS
CPPFLAGS+= -DSUPPORT_EXT2FS
CPPFLAGS+= -DPASS_BIOSGEOM
-CPPFLAGS+= -DPASS_MEMMAP
CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
EFIDIR= ${S}/external/bsd/gnu-efi/dist
diff -r 38c135145dfb -r ede80b5f9a72 sys/arch/i386/stand/efiboot/efiboot.c
--- a/sys/arch/i386/stand/efiboot/efiboot.c Sat Feb 11 09:15:38 2017 +0000
+++ b/sys/arch/i386/stand/efiboot/efiboot.c Sat Feb 11 10:13:46 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $ */
+/* $NetBSD: efiboot.c,v 1.2 2017/02/11 10:13:46 nonaka Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -97,6 +97,8 @@
EFI_MEMORY_DESCRIPTOR *desc;
UINTN NoEntries, MapKey, DescriptorSize;
UINT32 DescriptorVersion;
+ struct btinfo_efimemmap *bim;
+ size_t allocsz;
clearit();
@@ -108,17 +110,26 @@
BI_ADD(&btinfo_efi, BTINFO_EFI, sizeof(btinfo_efi));
NoEntries = 0;
- desc = LibMemoryMap(&NoEntries, &MapKey, &DescriptorSize,
- &DescriptorVersion);
+ desc = efi_memory_get_map(&NoEntries, &MapKey, &DescriptorSize,
+ &DescriptorVersion, true);
status = uefi_call_wrapper(BS->ExitBootServices, 2, IH, MapKey);
if (EFI_ERROR(status)) {
FreePool(desc);
- desc = LibMemoryMap(&NoEntries, &MapKey, &DescriptorSize,
- &DescriptorVersion);
+ desc = efi_memory_get_map(&NoEntries, &MapKey, &DescriptorSize,
+ &DescriptorVersion, true);
status = uefi_call_wrapper(BS->ExitBootServices, 2, IH, MapKey);
if (EFI_ERROR(status))
Panic(L"ExitBootServices failed");
}
+
+ allocsz = sizeof(struct btinfo_efimemmap) - 1
+ + NoEntries * DescriptorSize;
+ bim = alloc(allocsz);
+ bim->num = NoEntries;
+ bim->version = DescriptorVersion;
+ bim->size = DescriptorSize;
+ memcpy(bim->memmap, desc, NoEntries * DescriptorSize);
+ BI_ADD(bim, BTINFO_EFIMEMMAP, allocsz);
}
static void
diff -r 38c135145dfb -r ede80b5f9a72 sys/arch/i386/stand/efiboot/efiboot.h
--- a/sys/arch/i386/stand/efiboot/efiboot.h Sat Feb 11 09:15:38 2017 +0000
+++ b/sys/arch/i386/stand/efiboot/efiboot.h Sat Feb 11 10:13:46 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.h,v 1.1 2017/01/24 11:09:14 nonaka Exp $ */
+/* $NetBSD: efiboot.h,v 1.2 2017/02/11 10:13:46 nonaka Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -61,6 +61,8 @@
/* efimemory.c */
void efi_memory_probe(void);
void efi_memory_show_map(bool);
+EFI_MEMORY_DESCRIPTOR *efi_memory_get_map(UINTN *, UINTN *, UINTN *, UINT32 *,
+ bool);
/* panic.c */
__dead VOID Panic(IN CHAR16 *, ...);
diff -r 38c135145dfb -r ede80b5f9a72 sys/arch/i386/stand/efiboot/efimemory.c
--- a/sys/arch/i386/stand/efiboot/efimemory.c Sat Feb 11 09:15:38 2017 +0000
+++ b/sys/arch/i386/stand/efiboot/efimemory.c Sat Feb 11 10:13:46 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efimemory.c,v 1.2 2017/02/03 16:42:26 roy Exp $ */
+/* $NetBSD: efimemory.c,v 1.3 2017/02/11 10:13:46 nonaka Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -87,9 +87,9 @@
return BIM_Reserved;
}
-static EFI_MEMORY_DESCRIPTOR *
-GetMemoryMap(OUT UINTN *NoEntries, OUT UINTN *MapKey, OUT UINTN *DescriptorSize,
- OUT UINT32 *DescriptorVersion, bool sorted)
+EFI_MEMORY_DESCRIPTOR *
+efi_memory_get_map(UINTN *NoEntries, UINTN *MapKey, UINTN *DescriptorSize,
+ UINT32 *DescriptorVersion, bool sorted)
{
EFI_MEMORY_DESCRIPTOR *desc, *md, *next, *target, tmp;
UINTN i, j;
@@ -98,7 +98,7 @@
desc = LibMemoryMap(NoEntries, MapKey, DescriptorSize,
DescriptorVersion);
if (desc == NULL)
- Panic(L"LibMemoryMap failed");
+ Panic(L"efi_memory_get_map failed");
if (!sorted)
return desc;
@@ -128,7 +128,7 @@
UINT32 DescriptorVersion;
EFI_PHYSICAL_ADDRESS basemem = 0, epa;
- mdtop = GetMemoryMap(&NoEntries, &MapKey, &DescriptorSize,
+ mdtop = efi_memory_get_map(&NoEntries, &MapKey, &DescriptorSize,
&DescriptorVersion, true);
for (i = 0, md = mdtop; i < NoEntries; i++, md = next) {
@@ -167,7 +167,7 @@
bool first16m = true, first4g = true;
int extmem;
- mdtop = GetMemoryMap(&NoEntries, &MapKey, &DescriptorSize,
+ mdtop = efi_memory_get_map(&NoEntries, &MapKey, &DescriptorSize,
&DescriptorVersion, true);
for (i = 0, md = mdtop; i < NoEntries; i++, md = next) {
@@ -223,7 +223,7 @@
UINT32 DescriptorVersion;
int memtype;
- mdtop = GetMemoryMap(&NoEntries, &MapKey, &DescriptorSize,
+ mdtop = efi_memory_get_map(&NoEntries, &MapKey, &DescriptorSize,
&DescriptorVersion, false);
Print(L" mem[");
@@ -266,7 +266,7 @@
else
rows -= 2;
- mdtop = GetMemoryMap(&NoEntries, &MapKey, &DescriptorSize,
+ mdtop = efi_memory_get_map(&NoEntries, &MapKey, &DescriptorSize,
&DescriptorVersion, sorted);
for (i = 0, md = mdtop; i < NoEntries; i++, md = next) {
@@ -300,32 +300,6 @@
}
void
-bi_getmemmap(void)
-{
- EFI_MEMORY_DESCRIPTOR *md;
- UINTN NoEntries, MapKey, DescriptorSize;
- UINT32 DescriptorVersion;
- struct btinfo_efimemmap *bim;
- size_t allocsz;
-
- md = GetMemoryMap(&NoEntries, &MapKey, &DescriptorSize,
- &DescriptorVersion, true);
-
- allocsz = sizeof(struct btinfo_efimemmap) - 1
- + NoEntries * DescriptorSize;
- bim = alloc(allocsz);
-
- bim->num = NoEntries;
- bim->version = DescriptorVersion;
- bim->size = DescriptorSize;
- memcpy(bim->memmap, md, NoEntries * DescriptorSize);
-
- FreePool(md);
-
- BI_ADD(bim, BTINFO_EFIMEMMAP, allocsz);
-}
-
-void
vpbcopy(const void *va, void *pa, size_t n)
{
memmove(pa, va, n);
Home |
Main Index |
Thread Index |
Old Index