xref: /titanic_44/usr/src/cmd/nvmeadm/nvmeadm.h (revision 032cbfeb31ca7a979f1bfc44d634f28fc24a70dd)
1*032cbfebSHans Rosenfeld /*
2*032cbfebSHans Rosenfeld  * This file and its contents are supplied under the terms of the
3*032cbfebSHans Rosenfeld  * Common Development and Distribution License ("CDDL"), version 1.0.
4*032cbfebSHans Rosenfeld  * You may only use this file in accordance with the terms of version
5*032cbfebSHans Rosenfeld  * 1.0 of the CDDL.
6*032cbfebSHans Rosenfeld  *
7*032cbfebSHans Rosenfeld  * A full copy of the text of the CDDL should have accompanied this
8*032cbfebSHans Rosenfeld  * source.  A copy of the CDDL is also available via the Internet at
9*032cbfebSHans Rosenfeld  * http://www.illumos.org/license/CDDL.
10*032cbfebSHans Rosenfeld  */
11*032cbfebSHans Rosenfeld 
12*032cbfebSHans Rosenfeld /*
13*032cbfebSHans Rosenfeld  * Copyright 2016 Nexenta Systems, Inc.
14*032cbfebSHans Rosenfeld  */
15*032cbfebSHans Rosenfeld 
16*032cbfebSHans Rosenfeld #ifndef _NVMEADM_H
17*032cbfebSHans Rosenfeld #define	_NVMEADM_H
18*032cbfebSHans Rosenfeld 
19*032cbfebSHans Rosenfeld #include <stdio.h>
20*032cbfebSHans Rosenfeld #include <libdevinfo.h>
21*032cbfebSHans Rosenfeld #include <sys/nvme.h>
22*032cbfebSHans Rosenfeld 
23*032cbfebSHans Rosenfeld #ifdef __cplusplus
24*032cbfebSHans Rosenfeld extern "C" {
25*032cbfebSHans Rosenfeld #endif
26*032cbfebSHans Rosenfeld 
27*032cbfebSHans Rosenfeld extern int verbose;
28*032cbfebSHans Rosenfeld extern int debug;
29*032cbfebSHans Rosenfeld 
30*032cbfebSHans Rosenfeld /* printing functions */
31*032cbfebSHans Rosenfeld extern void nvme_print(int, char *, int, const char *, ...);
32*032cbfebSHans Rosenfeld extern void nvme_print_ctrl_summary(nvme_identify_ctrl_t *, nvme_version_t *);
33*032cbfebSHans Rosenfeld extern void nvme_print_nsid_summary(nvme_identify_nsid_t *);
34*032cbfebSHans Rosenfeld extern void nvme_print_identify_ctrl(nvme_identify_ctrl_t *,
35*032cbfebSHans Rosenfeld     nvme_capabilities_t *, nvme_version_t *);
36*032cbfebSHans Rosenfeld extern void nvme_print_identify_nsid(nvme_identify_nsid_t *, nvme_version_t *);
37*032cbfebSHans Rosenfeld extern void nvme_print_error_log(int, nvme_error_log_entry_t *);
38*032cbfebSHans Rosenfeld extern void nvme_print_health_log(nvme_health_log_t *, nvme_identify_ctrl_t *);
39*032cbfebSHans Rosenfeld extern void nvme_print_fwslot_log(nvme_fwslot_log_t *);
40*032cbfebSHans Rosenfeld 
41*032cbfebSHans Rosenfeld extern void nvme_print_feat_arbitration(uint64_t, void *, size_t,
42*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
43*032cbfebSHans Rosenfeld extern void nvme_print_feat_power_mgmt(uint64_t, void *, size_t,
44*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
45*032cbfebSHans Rosenfeld extern void nvme_print_feat_lba_range(uint64_t, void *, size_t,
46*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
47*032cbfebSHans Rosenfeld extern void nvme_print_feat_temperature(uint64_t, void *, size_t,
48*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
49*032cbfebSHans Rosenfeld extern void nvme_print_feat_error(uint64_t, void *, size_t,
50*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
51*032cbfebSHans Rosenfeld extern void nvme_print_feat_write_cache(uint64_t, void *, size_t,
52*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
53*032cbfebSHans Rosenfeld extern void nvme_print_feat_nqueues(uint64_t, void *, size_t,
54*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
55*032cbfebSHans Rosenfeld extern void nvme_print_feat_intr_coal(uint64_t, void *, size_t,
56*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
57*032cbfebSHans Rosenfeld extern void nvme_print_feat_intr_vect(uint64_t, void *, size_t,
58*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
59*032cbfebSHans Rosenfeld extern void nvme_print_feat_write_atom(uint64_t, void *, size_t,
60*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
61*032cbfebSHans Rosenfeld extern void nvme_print_feat_async_event(uint64_t, void *, size_t,
62*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
63*032cbfebSHans Rosenfeld extern void nvme_print_feat_auto_pst(uint64_t, void *, size_t,
64*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
65*032cbfebSHans Rosenfeld extern void nvme_print_feat_progress(uint64_t, void *, size_t,
66*032cbfebSHans Rosenfeld     nvme_identify_ctrl_t *);
67*032cbfebSHans Rosenfeld 
68*032cbfebSHans Rosenfeld /* device node functions */
69*032cbfebSHans Rosenfeld extern int nvme_open(di_minor_t);
70*032cbfebSHans Rosenfeld extern void nvme_close(int);
71*032cbfebSHans Rosenfeld extern nvme_version_t *nvme_version(int);
72*032cbfebSHans Rosenfeld extern nvme_capabilities_t *nvme_capabilities(int);
73*032cbfebSHans Rosenfeld extern nvme_identify_ctrl_t *nvme_identify_ctrl(int);
74*032cbfebSHans Rosenfeld extern nvme_identify_nsid_t *nvme_identify_nsid(int);
75*032cbfebSHans Rosenfeld extern void *nvme_get_logpage(int, uint8_t, size_t *);
76*032cbfebSHans Rosenfeld extern boolean_t nvme_get_feature(int, uint8_t, uint32_t, uint64_t *, size_t *,
77*032cbfebSHans Rosenfeld     void **);
78*032cbfebSHans Rosenfeld extern int nvme_intr_cnt(int);
79*032cbfebSHans Rosenfeld extern boolean_t nvme_format_nvm(int, uint8_t, uint8_t);
80*032cbfebSHans Rosenfeld extern boolean_t nvme_detach(int);
81*032cbfebSHans Rosenfeld extern boolean_t nvme_attach(int);
82*032cbfebSHans Rosenfeld 
83*032cbfebSHans Rosenfeld #ifdef __cplusplus
84*032cbfebSHans Rosenfeld }
85*032cbfebSHans Rosenfeld #endif
86*032cbfebSHans Rosenfeld 
87*032cbfebSHans Rosenfeld #endif /* _NVMEADM_H */
88