Handle persistent memory. Currently only debug output.

This commit is contained in:
nonaka 2017-02-14 13:29:09 +00:00
parent 60b05b5f3b
commit 5acea1cb30
6 changed files with 34 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: efimemory.c,v 1.3 2017/02/11 10:13:46 nonaka Exp $ */ /* $NetBSD: efimemory.c,v 1.4 2017/02/14 13:29:09 nonaka Exp $ */
/*- /*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka@netbsd.org> * Copyright (c) 2016 Kimihiro Nonaka <nonaka@netbsd.org>
@ -35,7 +35,15 @@ static const char *memtypes[] = {
"available", "available",
"reserved", "reserved",
"ACPI reclaimable", "ACPI reclaimable",
"ACPI NVS" "ACPI NVS",
"unusable",
"disabled",
"Persistent",
"undefined (8)",
"undefined (9)",
"undefined (10)",
"undefined (11)",
"Persistent (Legacy)"
}; };
static const char *efimemtypes[] = { static const char *efimemtypes[] = {
@ -53,6 +61,7 @@ static const char *efimemtypes[] = {
"MemoryMappedIO", "MemoryMappedIO",
"MemoryMappedIOPortSpace", "MemoryMappedIOPortSpace",
"PalCode", "PalCode",
"PersistentMemory",
}; };
static int static int
@ -74,6 +83,9 @@ getmemtype(EFI_MEMORY_DESCRIPTOR *md)
case EfiACPIMemoryNVS: case EfiACPIMemoryNVS:
return BIM_NVS; return BIM_NVS;
case EfiPersistentMemory:
return BIM_PMEM;
case EfiReservedMemoryType: case EfiReservedMemoryType:
case EfiRuntimeServicesCode: case EfiRuntimeServicesCode:
case EfiRuntimeServicesData: case EfiRuntimeServicesData:
@ -82,9 +94,9 @@ getmemtype(EFI_MEMORY_DESCRIPTOR *md)
case EfiMemoryMappedIOPortSpace: case EfiMemoryMappedIOPortSpace:
case EfiPalCode: case EfiPalCode:
case EfiMaxMemoryType: case EfiMaxMemoryType:
default:
return BIM_Reserved; return BIM_Reserved;
} }
return BIM_Reserved;
} }
EFI_MEMORY_DESCRIPTOR * EFI_MEMORY_DESCRIPTOR *

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_machdep.c,v 1.17 2017/02/14 13:23:50 nonaka Exp $ */ /* $NetBSD: acpi_machdep.c,v 1.18 2017/02/14 13:29:09 nonaka Exp $ */
/* /*
* Copyright 2001 Wasabi Systems, Inc. * Copyright 2001 Wasabi Systems, Inc.
@ -40,7 +40,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.17 2017/02/14 13:23:50 nonaka Exp $"); __KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.18 2017/02/14 13:29:09 nonaka Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -395,6 +395,8 @@ acpi_md_mcfg_validate(uint64_t addr, int bus_start, int *bus_end)
(type == BIM_Reserved) ? "Reserved" : (type == BIM_Reserved) ? "Reserved" :
(type == BIM_ACPI) ? "ACPI" : (type == BIM_ACPI) ? "ACPI" :
(type == BIM_NVS) ? "NVS" : (type == BIM_NVS) ? "NVS" :
(type == BIM_PMEM) ? "Persistent" :
(type == BIM_PRAM) ? "Persistent (Legacy)" :
"unknown"); "unknown");
switch (type) { switch (type) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: efi.h,v 1.4 2017/02/14 13:23:50 nonaka Exp $ */ /* $NetBSD: efi.h,v 1.5 2017/02/14 13:29:09 nonaka Exp $ */
/*- /*-
* Copyright (c) 2004 Marcel Moolenaar * Copyright (c) 2004 Marcel Moolenaar
@ -74,6 +74,7 @@ struct efi_md {
#define EFI_MD_TYPE_IOMEM 11 /* Memory-mapped I/O. */ #define EFI_MD_TYPE_IOMEM 11 /* Memory-mapped I/O. */
#define EFI_MD_TYPE_IOPORT 12 /* I/O port space. */ #define EFI_MD_TYPE_IOPORT 12 /* I/O port space. */
#define EFI_MD_TYPE_PALCODE 13 /* PAL */ #define EFI_MD_TYPE_PALCODE 13 /* PAL */
#define EFI_MD_TYPE_PMEM 14 /* Persistent memory. */
uint32_t __pad; uint32_t __pad;
uint64_t md_phys; uint64_t md_phys;
uint64_t md_virt; uint64_t md_virt;

View File

@ -1,4 +1,4 @@
/* $NetBSD: efi.c,v 1.7 2017/02/14 13:23:50 nonaka Exp $ */ /* $NetBSD: efi.c,v 1.8 2017/02/14 13:29:09 nonaka Exp $ */
/*- /*-
* Copyright (c) 2016 The NetBSD Foundation, Inc. * Copyright (c) 2016 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.7 2017/02/14 13:23:50 nonaka Exp $"); __KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.8 2017/02/14 13:29:09 nonaka Exp $");
#include <sys/kmem.h> #include <sys/kmem.h>
#include <sys/param.h> #include <sys/param.h>
@ -320,6 +320,9 @@ efi_getbiosmemtype(uint32_t type, uint64_t attr)
case EFI_MD_TYPE_FIRMWARE: case EFI_MD_TYPE_FIRMWARE:
return BIM_NVS; return BIM_NVS;
case EFI_MD_TYPE_PMEM:
return BIM_PMEM;
case EFI_MD_TYPE_NULL: case EFI_MD_TYPE_NULL:
case EFI_MD_TYPE_RT_CODE: case EFI_MD_TYPE_RT_CODE:
case EFI_MD_TYPE_RT_DATA: case EFI_MD_TYPE_RT_DATA:
@ -327,9 +330,9 @@ efi_getbiosmemtype(uint32_t type, uint64_t attr)
case EFI_MD_TYPE_IOMEM: case EFI_MD_TYPE_IOMEM:
case EFI_MD_TYPE_IOPORT: case EFI_MD_TYPE_IOPORT:
case EFI_MD_TYPE_PALCODE: case EFI_MD_TYPE_PALCODE:
default:
return BIM_Reserved; return BIM_Reserved;
} }
return BIM_Reserved;
} }
const char * const char *
@ -350,6 +353,7 @@ efi_getmemtype_str(uint32_t type)
"MemoryMappedIO", "MemoryMappedIO",
"MemoryMappedIOPortSpace", "MemoryMappedIOPortSpace",
"PalCode", "PalCode",
"PersistentMemory",
}; };
if (type < __arraycount(efimemtypes)) if (type < __arraycount(efimemtypes))

View File

@ -1,4 +1,4 @@
/* $NetBSD: x86_machdep.c,v 1.88 2017/02/14 13:23:50 nonaka Exp $ */ /* $NetBSD: x86_machdep.c,v 1.89 2017/02/14 13:29:09 nonaka Exp $ */
/*- /*-
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@ -31,7 +31,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.88 2017/02/14 13:23:50 nonaka Exp $"); __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.89 2017/02/14 13:29:09 nonaka Exp $");
#include "opt_modular.h" #include "opt_modular.h"
#include "opt_physmem.h" #include "opt_physmem.h"
@ -658,6 +658,8 @@ x86_parse_clusters(struct btinfo_memmap *bim)
(type == BIM_Reserved) ? "Reserved" : (type == BIM_Reserved) ? "Reserved" :
(type == BIM_ACPI) ? "ACPI" : (type == BIM_ACPI) ? "ACPI" :
(type == BIM_NVS) ? "NVS" : (type == BIM_NVS) ? "NVS" :
(type == BIM_PMEM) ? "Persistent" :
(type == BIM_PRAM) ? "Persistent (Legacy)" :
"unknown"); "unknown");
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: efidef.h,v 1.1.1.1 2014/04/01 16:16:07 jakllsch Exp $ */ /* $NetBSD: efidef.h,v 1.2 2017/02/14 13:29:09 nonaka Exp $ */
#ifndef _EFI_DEF_H #ifndef _EFI_DEF_H
#define _EFI_DEF_H #define _EFI_DEF_H
@ -162,6 +162,7 @@ typedef enum {
EfiMemoryMappedIO, EfiMemoryMappedIO,
EfiMemoryMappedIOPortSpace, EfiMemoryMappedIOPortSpace,
EfiPalCode, EfiPalCode,
EfiPersistentMemory,
EfiMaxMemoryType EfiMaxMemoryType
} EFI_MEMORY_TYPE; } EFI_MEMORY_TYPE;