2 * Copyright (c) 2017 The FreeBSD Foundation
5 * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
6 * under sponsorship from the FreeBSD Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #ifndef __DEV_NVDIMM_VAR_H__
33 #define __DEV_NVDIMM_VAR_H__
35 typedef uint32_t nfit_handle_t;
39 nfit_handle_t nv_handle;
40 uint64_t **nv_flush_addr;
41 int nv_flush_addr_cnt;
45 enum SPA_mapping_type {
46 SPA_TYPE_VOLATILE_MEMORY = 0,
47 SPA_TYPE_PERSISTENT_MEMORY = 1,
48 SPA_TYPE_CONTROL_REGION = 2,
49 SPA_TYPE_DATA_REGION = 3,
50 SPA_TYPE_VOLATILE_VIRTUAL_DISK = 4,
51 SPA_TYPE_VOLATILE_VIRTUAL_CD = 5,
52 SPA_TYPE_PERSISTENT_VIRTUAL_DISK= 6,
53 SPA_TYPE_PERSISTENT_VIRTUAL_CD = 7,
57 enum SPA_mapping_type spa_type;
60 uint64_t spa_phys_base;
62 uint64_t spa_efi_mem_flags;
66 struct g_provider *spa_p;
67 struct bio_queue_head spa_g_queue;
69 struct mtx spa_g_stat_mtx;
70 struct devstat *spa_g_devstat;
71 struct proc *spa_g_proc;
72 struct vm_object *spa_obj;
74 bool spa_g_proc_exiting;
77 struct nvdimm_ns_walk_ctx {
78 ACPI_STATUS (*func)(ACPI_HANDLE, void *);
82 extern struct SPA_mapping *spa_mappings;
83 extern int spa_mappings_cnt;
85 MALLOC_DECLARE(M_NVDIMM);
87 struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t nv_handle);
88 int nvdimm_iterate_nfit(ACPI_TABLE_NFIT *nfitbl, enum AcpiNfitType type,
89 int (*cb)(void *, void *), void *arg);
91 #endif /* __DEV_NVDIMM_VAR_H__ */