Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/nvme/nvme_private.h
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | |||||
} __aligned(CACHE_LINE_SIZE); | } __aligned(CACHE_LINE_SIZE); | ||||
struct nvme_namespace { | struct nvme_namespace { | ||||
struct nvme_controller *ctrlr; | struct nvme_controller *ctrlr; | ||||
struct nvme_namespace_data data; | struct nvme_namespace_data data; | ||||
uint32_t id; | uint32_t id; | ||||
uint32_t flags; | uint32_t flags; | ||||
#define NVME_NS_FLAG_ADDED 0x1 | |||||
#define NVME_NS_FLAG_CHANGED 0x2 | |||||
#define NVME_NS_FLAG_GONE 0x4 | |||||
struct cdev *cdev; | struct cdev *cdev; | ||||
void *cons_cookie[NVME_MAX_CONSUMERS]; | void *cons_cookie[NVME_MAX_CONSUMERS]; | ||||
uint32_t boundary; | uint32_t boundary; | ||||
struct mtx lock; | struct mtx lock; | ||||
STAILQ_ENTRY(nvme_namespace) stailq; | |||||
}; | }; | ||||
/* | /* | ||||
* One of these per allocated PCI device. | * One of these per allocated PCI device. | ||||
*/ | */ | ||||
struct nvme_controller { | struct nvme_controller { | ||||
device_t dev; | device_t dev; | ||||
Show All 25 Lines | #define QUIRK_DISABLE_TIMEOUT 2 /* Disable broken completion timeout feature */ | ||||
/* Fields for tracking progress during controller initialization. */ | /* Fields for tracking progress during controller initialization. */ | ||||
struct intr_config_hook config_hook; | struct intr_config_hook config_hook; | ||||
uint32_t ns_identified; | uint32_t ns_identified; | ||||
uint32_t queues_created; | uint32_t queues_created; | ||||
struct task reset_task; | struct task reset_task; | ||||
struct task fail_req_task; | struct task fail_req_task; | ||||
struct task update_ns_task; | |||||
struct taskqueue *taskqueue; | struct taskqueue *taskqueue; | ||||
/* For shared legacy interrupt. */ | /* For shared legacy interrupt. */ | ||||
int rid; | int rid; | ||||
struct resource *res; | struct resource *res; | ||||
void *tag; | void *tag; | ||||
/** maximum i/o size in bytes */ | /** maximum i/o size in bytes */ | ||||
Show All 34 Lines | #define QUIRK_DISABLE_TIMEOUT 2 /* Disable broken completion timeout feature */ | ||||
uint32_t is_resetting; | uint32_t is_resetting; | ||||
uint32_t is_initialized; | uint32_t is_initialized; | ||||
uint32_t notification_sent; | uint32_t notification_sent; | ||||
bool is_failed; | bool is_failed; | ||||
bool is_dying; | bool is_dying; | ||||
STAILQ_HEAD(, nvme_request) fail_req; | STAILQ_HEAD(, nvme_request) fail_req; | ||||
STAILQ_HEAD(, nvme_namespace) update_ns_req; | |||||
/* Host Memory Buffer */ | /* Host Memory Buffer */ | ||||
int hmb_nchunks; | int hmb_nchunks; | ||||
size_t hmb_chunk; | size_t hmb_chunk; | ||||
bus_dma_tag_t hmb_tag; | bus_dma_tag_t hmb_tag; | ||||
struct nvme_hmb_chunk { | struct nvme_hmb_chunk { | ||||
bus_dmamap_t hmbc_map; | bus_dmamap_t hmbc_map; | ||||
void *hmbc_vaddr; | void *hmbc_vaddr; | ||||
uint64_t hmbc_paddr; | uint64_t hmbc_paddr; | ||||
} *hmb_chunks; | } *hmb_chunks; | ||||
bus_dma_tag_t hmb_desc_tag; | bus_dma_tag_t hmb_desc_tag; | ||||
bus_dmamap_t hmb_desc_map; | bus_dmamap_t hmb_desc_map; | ||||
struct nvme_hmb_desc *hmb_desc_vaddr; | struct nvme_hmb_desc *hmb_desc_vaddr; | ||||
uint64_t hmb_desc_paddr; | uint64_t hmb_desc_paddr; | ||||
}; | }; | ||||
enum nvme_ctor_reason { | |||||
NVME_REASON_RESET, /* Controller was reset, rebuilding */ | |||||
NVME_REASON_FLAGGED, /* NS was flagged as changed somehow */ | |||||
}; | |||||
#define nvme_mmio_offsetof(reg) \ | #define nvme_mmio_offsetof(reg) \ | ||||
offsetof(struct nvme_registers, reg) | offsetof(struct nvme_registers, reg) | ||||
#define nvme_mmio_read_4(sc, reg) \ | #define nvme_mmio_read_4(sc, reg) \ | ||||
bus_space_read_4((sc)->bus_tag, (sc)->bus_handle, \ | bus_space_read_4((sc)->bus_tag, (sc)->bus_handle, \ | ||||
nvme_mmio_offsetof(reg)) | nvme_mmio_offsetof(reg)) | ||||
#define nvme_mmio_write_4(sc, reg, val) \ | #define nvme_mmio_write_4(sc, reg, val) \ | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | |||||
void nvme_admin_qpair_disable(struct nvme_qpair *qpair); | void nvme_admin_qpair_disable(struct nvme_qpair *qpair); | ||||
void nvme_admin_qpair_destroy(struct nvme_qpair *qpair); | void nvme_admin_qpair_destroy(struct nvme_qpair *qpair); | ||||
void nvme_io_qpair_enable(struct nvme_qpair *qpair); | void nvme_io_qpair_enable(struct nvme_qpair *qpair); | ||||
void nvme_io_qpair_disable(struct nvme_qpair *qpair); | void nvme_io_qpair_disable(struct nvme_qpair *qpair); | ||||
void nvme_io_qpair_destroy(struct nvme_qpair *qpair); | void nvme_io_qpair_destroy(struct nvme_qpair *qpair); | ||||
int nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, | int nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, | ||||
struct nvme_controller *ctrlr); | struct nvme_controller *ctrlr, enum nvme_ctor_reason why); | ||||
void nvme_ns_destruct(struct nvme_namespace *ns); | void nvme_ns_destruct(struct nvme_namespace *ns); | ||||
void nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr); | void nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr); | ||||
void nvme_dump_command(struct nvme_command *cmd); | void nvme_dump_command(struct nvme_command *cmd); | ||||
void nvme_dump_completion(struct nvme_completion *cpl); | void nvme_dump_completion(struct nvme_completion *cpl); | ||||
int nvme_attach(device_t dev); | int nvme_attach(device_t dev); | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |