| 1 |
/** |
| 2 |
* collectd - src/nvme.h |
| 3 |
* MIT License |
| 4 |
* |
| 5 |
* Copyright (C) 2020 Intel Corporation. All rights reserved. |
| 6 |
* |
| 7 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 8 |
* copy of this software and associated documentation files (the "Software"), |
| 9 |
* to deal in the Software without restriction, including without limitation |
| 10 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 12 |
* Software is furnished to do so, subject to the following conditions: |
| 13 |
* |
| 14 |
* The above copyright notice and this permission notice shall be included in |
| 15 |
* all copies or substantial portions of the Software. |
| 16 |
* |
| 17 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 |
* DEALINGS IN THE SOFTWARE. |
| 24 |
* |
| 25 |
* Authors: |
| 26 |
* Bartlomiej Kotlowski <[email protected]> |
| 27 |
* **/ |
| 28 |
|
| 29 |
#include <linux/types.h> |
| 30 |
|
| 31 |
#define NVME_NSID_ALL 0xffffffff |
| 32 |
#define NVME_ADMIN_GET_LOG_PAGE 0x02 |
| 33 |
#define NVME_ADMIN_IDENTIFY 0x06 |
| 34 |
|
| 35 |
union nvme_smart_log { |
| 36 |
struct { |
| 37 |
__u8 critical_warning; |
| 38 |
__u8 temperature[2]; |
| 39 |
__u8 avail_spare; |
| 40 |
__u8 spare_thresh; |
| 41 |
__u8 percent_used; |
| 42 |
__u8 endu_grp_crit_warn_sumry; |
| 43 |
__u8 rsvd1[25]; |
| 44 |
__u8 data_units_read[16]; |
| 45 |
__u8 data_units_written[16]; |
| 46 |
__u8 host_commands_read[16]; |
| 47 |
__u8 host_commands_written[16]; |
| 48 |
__u8 ctrl_busy_time[16]; |
| 49 |
__u8 power_cycles[16]; |
| 50 |
__u8 power_on_hours[16]; |
| 51 |
__u8 unsafe_shutdowns[16]; |
| 52 |
__u8 media_errors[16]; |
| 53 |
__u8 num_err_log_entries[16]; |
| 54 |
__le32 warning_temp_time; |
| 55 |
__le32 critical_comp_time; |
| 56 |
__le16 temp_sensor[8]; |
| 57 |
__le32 thm_temp1_trans_count; |
| 58 |
__le32 thm_temp2_trans_count; |
| 59 |
__le32 thm_temp1_total_time; |
| 60 |
__le32 thm_temp2_total_time; |
| 61 |
__u8 rsvd2[280]; |
| 62 |
} data; |
| 63 |
__u8 raw[512]; |
| 64 |
}; |