Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/nvdimm/nvdimm_var.h
Show All 28 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef __DEV_NVDIMM_VAR_H__ | #ifndef __DEV_NVDIMM_VAR_H__ | ||||
#define __DEV_NVDIMM_VAR_H__ | #define __DEV_NVDIMM_VAR_H__ | ||||
typedef uint32_t nfit_handle_t; | typedef uint32_t nfit_handle_t; | ||||
struct nvdimm_root_dev { | |||||
device_t nv_root_dev; | |||||
SLIST_HEAD(, SPA_mapping) spas; | |||||
}; | |||||
struct nvdimm_dev { | struct nvdimm_dev { | ||||
device_t nv_dev; | device_t nv_dev; | ||||
nfit_handle_t nv_handle; | nfit_handle_t nv_handle; | ||||
uint64_t **nv_flush_addr; | uint64_t **nv_flush_addr; | ||||
int nv_flush_addr_cnt; | int nv_flush_addr_cnt; | ||||
int nv_devs_idx; | int nv_devs_idx; | ||||
}; | }; | ||||
enum SPA_mapping_type { | enum SPA_mapping_type { | ||||
SPA_TYPE_VOLATILE_MEMORY = 0, | SPA_TYPE_VOLATILE_MEMORY = 0, | ||||
SPA_TYPE_PERSISTENT_MEMORY = 1, | SPA_TYPE_PERSISTENT_MEMORY = 1, | ||||
SPA_TYPE_CONTROL_REGION = 2, | SPA_TYPE_CONTROL_REGION = 2, | ||||
SPA_TYPE_DATA_REGION = 3, | SPA_TYPE_DATA_REGION = 3, | ||||
SPA_TYPE_VOLATILE_VIRTUAL_DISK = 4, | SPA_TYPE_VOLATILE_VIRTUAL_DISK = 4, | ||||
SPA_TYPE_VOLATILE_VIRTUAL_CD = 5, | SPA_TYPE_VOLATILE_VIRTUAL_CD = 5, | ||||
SPA_TYPE_PERSISTENT_VIRTUAL_DISK= 6, | SPA_TYPE_PERSISTENT_VIRTUAL_DISK= 6, | ||||
SPA_TYPE_PERSISTENT_VIRTUAL_CD = 7, | SPA_TYPE_PERSISTENT_VIRTUAL_CD = 7, | ||||
}; | }; | ||||
struct SPA_mapping { | struct SPA_mapping { | ||||
SLIST_ENTRY(SPA_mapping) link; | |||||
enum SPA_mapping_type spa_type; | enum SPA_mapping_type spa_type; | ||||
int spa_domain; | int spa_domain; | ||||
int spa_nfit_idx; | int spa_nfit_idx; | ||||
uint64_t spa_phys_base; | uint64_t spa_phys_base; | ||||
uint64_t spa_len; | uint64_t spa_len; | ||||
uint64_t spa_efi_mem_flags; | uint64_t spa_efi_mem_flags; | ||||
void *spa_kva; | void *spa_kva; | ||||
struct vm_object *spa_obj; | |||||
struct cdev *spa_dev; | struct cdev *spa_dev; | ||||
struct g_geom *spa_g; | struct g_geom *spa_g; | ||||
}; | |||||
struct g_spa_softc { | |||||
struct SPA_mapping *spa; | |||||
struct g_provider *spa_p; | struct g_provider *spa_p; | ||||
struct bio_queue_head spa_g_queue; | struct bio_queue_head spa_g_queue; | ||||
struct mtx spa_g_mtx; | struct mtx spa_g_mtx; | ||||
struct mtx spa_g_stat_mtx; | struct mtx spa_g_stat_mtx; | ||||
struct devstat *spa_g_devstat; | struct devstat *spa_g_devstat; | ||||
struct proc *spa_g_proc; | struct proc *spa_g_proc; | ||||
struct vm_object *spa_obj; | |||||
bool spa_g_proc_run; | bool spa_g_proc_run; | ||||
bool spa_g_proc_exiting; | bool spa_g_proc_exiting; | ||||
}; | }; | ||||
struct nvdimm_ns_walk_ctx { | struct nvdimm_ns_walk_ctx { | ||||
ACPI_STATUS (*func)(ACPI_HANDLE, void *); | ACPI_STATUS (*func)(ACPI_HANDLE, void *); | ||||
void *arg; | void *arg; | ||||
}; | }; | ||||
extern struct SPA_mapping *spa_mappings; | |||||
extern int spa_mappings_cnt; | |||||
MALLOC_DECLARE(M_NVDIMM); | MALLOC_DECLARE(M_NVDIMM); | ||||
struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t nv_handle); | struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t nv_handle); | ||||
int nvdimm_iterate_nfit(ACPI_TABLE_NFIT *nfitbl, enum AcpiNfitType type, | int nvdimm_iterate_nfit(ACPI_TABLE_NFIT *nfitbl, enum AcpiNfitType type, | ||||
int (*cb)(void *, void *), void *arg); | int (*cb)(void *, void *), void *arg); | ||||
#endif /* __DEV_NVDIMM_VAR_H__ */ | #endif /* __DEV_NVDIMM_VAR_H__ */ |