Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/nvdimm/nvdimm_var.h
/*- | /*- | ||||
* Copyright (c) 2017 The FreeBSD Foundation | * Copyright (c) 2017 The FreeBSD Foundation | ||||
* All rights reserved. | * All rights reserved. | ||||
* Copyright (c) 2018, 2019 Intel Corporation | |||||
* | * | ||||
* This software was developed by Konstantin Belousov <kib@FreeBSD.org> | * This software was developed by Konstantin Belousov <kib@FreeBSD.org> | ||||
* under sponsorship from the FreeBSD Foundation. | * under sponsorship from the FreeBSD Foundation. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
Show All 17 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; | ||||
enum nvdimm_root_ivar { | |||||
NVDIMM_ROOT_IVAR_ACPI_HANDLE, | |||||
NVDIMM_ROOT_IVAR_DEVICE_HANDLE, | |||||
NVDIMM_ROOT_IVAR_MAX, | |||||
}; | |||||
__BUS_ACCESSOR(nvdimm_root, acpi_handle, NVDIMM_ROOT, ACPI_HANDLE, ACPI_HANDLE) | |||||
__BUS_ACCESSOR(nvdimm_root, device_handle, NVDIMM_ROOT, DEVICE_HANDLE, | |||||
nfit_handle_t) | |||||
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; | |||||
}; | }; | ||||
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, | ||||
Show All 16 Lines | struct SPA_mapping { | ||||
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; | 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 { | |||||
ACPI_STATUS (*func)(ACPI_HANDLE, void *); | |||||
void *arg; | |||||
}; | }; | ||||
extern struct SPA_mapping *spa_mappings; | extern struct SPA_mapping *spa_mappings; | ||||
extern int spa_mappings_cnt; | 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__ */ |