diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-07 23:19:02 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-07 23:19:02 -0400 |
| commit | b409624ad5a99c2e84df6657bd0f7931ac470d2d (patch) | |
| tree | a4d2197ed560300b831504789744fd10a3c58039 /include/uapi | |
| parent | c4c17252283a13c0d63a8d9df828da109c116411 (diff) | |
| parent | d82e8bfdef9afae83b894be49af4644d9ac3c359 (diff) | |
Merge git://git.infradead.org/users/willy/linux-nvme
Pull NVM Express driver update from Matthew Wilcox.
* git://git.infradead.org/users/willy/linux-nvme:
NVMe: Merge issue on character device bring-up
NVMe: Handle ioremap failure
NVMe: Add pci suspend/resume driver callbacks
NVMe: Use normal shutdown
NVMe: Separate controller init from disk discovery
NVMe: Separate queue alloc/free from create/delete
NVMe: Group pci related actions in functions
NVMe: Disk stats for read/write commands only
NVMe: Bring up cdev on set feature failure
NVMe: Fix checkpatch issues
NVMe: Namespace IDs are unsigned
NVMe: Update nvme_id_power_state with latest spec
NVMe: Split header file into user-visible and kernel-visible pieces
NVMe: Call nvme_process_cq from submission path
NVMe: Remove "process_cq did something" message
NVMe: Return correct value from interrupt handler
NVMe: Disk IO statistics
NVMe: Restructure MSI / MSI-X setup
NVMe: Use kzalloc instead of kmalloc+memset
Diffstat (limited to 'include/uapi')
| -rw-r--r-- | include/uapi/linux/Kbuild | 1 | ||||
| -rw-r--r-- | include/uapi/linux/nvme.h | 477 |
2 files changed, 478 insertions, 0 deletions
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index e7c94eeb9475..115add2515aa 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
| @@ -284,6 +284,7 @@ header-y += nfs_mount.h | |||
| 284 | header-y += nfsacl.h | 284 | header-y += nfsacl.h |
| 285 | header-y += nl80211.h | 285 | header-y += nl80211.h |
| 286 | header-y += nubus.h | 286 | header-y += nubus.h |
| 287 | header-y += nvme.h | ||
| 287 | header-y += nvram.h | 288 | header-y += nvram.h |
| 288 | header-y += omap3isp.h | 289 | header-y += omap3isp.h |
| 289 | header-y += omapfb.h | 290 | header-y += omapfb.h |
diff --git a/include/uapi/linux/nvme.h b/include/uapi/linux/nvme.h new file mode 100644 index 000000000000..989c04e0c563 --- /dev/null +++ b/include/uapi/linux/nvme.h | |||
| @@ -0,0 +1,477 @@ | |||
| 1 | /* | ||
| 2 | * Definitions for the NVM Express interface | ||
| 3 | * Copyright (c) 2011-2013, Intel Corporation. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef _UAPI_LINUX_NVME_H | ||
| 20 | #define _UAPI_LINUX_NVME_H | ||
| 21 | |||
| 22 | #include <linux/types.h> | ||
| 23 | |||
| 24 | struct nvme_id_power_state { | ||
| 25 | __le16 max_power; /* centiwatts */ | ||
| 26 | __u8 rsvd2; | ||
| 27 | __u8 flags; | ||
| 28 | __le32 entry_lat; /* microseconds */ | ||
| 29 | __le32 exit_lat; /* microseconds */ | ||
| 30 | __u8 read_tput; | ||
| 31 | __u8 read_lat; | ||
| 32 | __u8 write_tput; | ||
| 33 | __u8 write_lat; | ||
| 34 | __u8 rsvd16[16]; | ||
| 35 | }; | ||
| 36 | |||
| 37 | enum { | ||
| 38 | NVME_PS_FLAGS_MAX_POWER_SCALE = 1 << 0, | ||
| 39 | NVME_PS_FLAGS_NON_OP_STATE = 1 << 1, | ||
| 40 | }; | ||
| 41 | |||
| 42 | struct nvme_id_ctrl { | ||
| 43 | __le16 vid; | ||
| 44 | __le16 ssvid; | ||
| 45 | char sn[20]; | ||
| 46 | char mn[40]; | ||
| 47 | char fr[8]; | ||
| 48 | __u8 rab; | ||
| 49 | __u8 ieee[3]; | ||
| 50 | __u8 mic; | ||
| 51 | __u8 mdts; | ||
| 52 | __u8 rsvd78[178]; | ||
| 53 | __le16 oacs; | ||
| 54 | __u8 acl; | ||
| 55 | __u8 aerl; | ||
| 56 | __u8 frmw; | ||
| 57 | __u8 lpa; | ||
| 58 | __u8 elpe; | ||
| 59 | __u8 npss; | ||
| 60 | __u8 rsvd264[248]; | ||
| 61 | __u8 sqes; | ||
| 62 | __u8 cqes; | ||
| 63 | __u8 rsvd514[2]; | ||
| 64 | __le32 nn; | ||
| 65 | __le16 oncs; | ||
| 66 | __le16 fuses; | ||
| 67 | __u8 fna; | ||
| 68 | __u8 vwc; | ||
| 69 | __le16 awun; | ||
| 70 | __le16 awupf; | ||
| 71 | __u8 rsvd530[1518]; | ||
| 72 | struct nvme_id_power_state psd[32]; | ||
| 73 | __u8 vs[1024]; | ||
| 74 | }; | ||
| 75 | |||
| 76 | enum { | ||
| 77 | NVME_CTRL_ONCS_COMPARE = 1 << 0, | ||
| 78 | NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1, | ||
| 79 | NVME_CTRL_ONCS_DSM = 1 << 2, | ||
| 80 | }; | ||
| 81 | |||
| 82 | struct nvme_lbaf { | ||
| 83 | __le16 ms; | ||
| 84 | __u8 ds; | ||
| 85 | __u8 rp; | ||
| 86 | }; | ||
| 87 | |||
| 88 | struct nvme_id_ns { | ||
| 89 | __le64 nsze; | ||
| 90 | __le64 ncap; | ||
| 91 | __le64 nuse; | ||
| 92 | __u8 nsfeat; | ||
| 93 | __u8 nlbaf; | ||
| 94 | __u8 flbas; | ||
| 95 | __u8 mc; | ||
| 96 | __u8 dpc; | ||
| 97 | __u8 dps; | ||
| 98 | __u8 rsvd30[98]; | ||
| 99 | struct nvme_lbaf lbaf[16]; | ||
| 100 | __u8 rsvd192[192]; | ||
| 101 | __u8 vs[3712]; | ||
| 102 | }; | ||
| 103 | |||
| 104 | enum { | ||
| 105 | NVME_NS_FEAT_THIN = 1 << 0, | ||
| 106 | NVME_LBAF_RP_BEST = 0, | ||
| 107 | NVME_LBAF_RP_BETTER = 1, | ||
| 108 | NVME_LBAF_RP_GOOD = 2, | ||
| 109 | NVME_LBAF_RP_DEGRADED = 3, | ||
| 110 | }; | ||
| 111 | |||
| 112 | struct nvme_smart_log { | ||
| 113 | __u8 critical_warning; | ||
| 114 | __u8 temperature[2]; | ||
| 115 | __u8 avail_spare; | ||
| 116 | __u8 spare_thresh; | ||
| 117 | __u8 percent_used; | ||
| 118 | __u8 rsvd6[26]; | ||
| 119 | __u8 data_units_read[16]; | ||
| 120 | __u8 data_units_written[16]; | ||
| 121 | __u8 host_reads[16]; | ||
| 122 | __u8 host_writes[16]; | ||
| 123 | __u8 ctrl_busy_time[16]; | ||
| 124 | __u8 power_cycles[16]; | ||
| 125 | __u8 power_on_hours[16]; | ||
| 126 | __u8 unsafe_shutdowns[16]; | ||
| 127 | __u8 media_errors[16]; | ||
| 128 | __u8 num_err_log_entries[16]; | ||
| 129 | __u8 rsvd192[320]; | ||
| 130 | }; | ||
| 131 | |||
| 132 | enum { | ||
| 133 | NVME_SMART_CRIT_SPARE = 1 << 0, | ||
| 134 | NVME_SMART_CRIT_TEMPERATURE = 1 << 1, | ||
| 135 | NVME_SMART_CRIT_RELIABILITY = 1 << 2, | ||
| 136 | NVME_SMART_CRIT_MEDIA = 1 << 3, | ||
| 137 | NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4, | ||
| 138 | }; | ||
| 139 | |||
| 140 | struct nvme_lba_range_type { | ||
| 141 | __u8 type; | ||
| 142 | __u8 attributes; | ||
| 143 | __u8 rsvd2[14]; | ||
| 144 | __u64 slba; | ||
| 145 | __u64 nlb; | ||
| 146 | __u8 guid[16]; | ||
| 147 | __u8 rsvd48[16]; | ||
| 148 | }; | ||
| 149 | |||
| 150 | enum { | ||
| 151 | NVME_LBART_TYPE_FS = 0x01, | ||
| 152 | NVME_LBART_TYPE_RAID = 0x02, | ||
| 153 | NVME_LBART_TYPE_CACHE = 0x03, | ||
| 154 | NVME_LBART_TYPE_SWAP = 0x04, | ||
| 155 | |||
| 156 | NVME_LBART_ATTRIB_TEMP = 1 << 0, | ||
| 157 | NVME_LBART_ATTRIB_HIDE = 1 << 1, | ||
| 158 | }; | ||
| 159 | |||
| 160 | /* I/O commands */ | ||
| 161 | |||
| 162 | enum nvme_opcode { | ||
| 163 | nvme_cmd_flush = 0x00, | ||
| 164 | nvme_cmd_write = 0x01, | ||
| 165 | nvme_cmd_read = 0x02, | ||
| 166 | nvme_cmd_write_uncor = 0x04, | ||
| 167 | nvme_cmd_compare = 0x05, | ||
| 168 | nvme_cmd_dsm = 0x09, | ||
| 169 | }; | ||
| 170 | |||
| 171 | struct nvme_common_command { | ||
| 172 | __u8 opcode; | ||
| 173 | __u8 flags; | ||
| 174 | __u16 command_id; | ||
| 175 | __le32 nsid; | ||
| 176 | __le32 cdw2[2]; | ||
| 177 | __le64 metadata; | ||
