nvme_ioctl.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Definitions for the NVM Express ioctl interface
  4. * Copyright (c) 2011-2014, Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. */
  15. #ifndef _UAPI_LINUX_NVME_IOCTL_H
  16. #define _UAPI_LINUX_NVME_IOCTL_H
  17. #include <linux/types.h>
  18. struct nvme_user_io {
  19. __u8 opcode;
  20. __u8 flags;
  21. __u16 control;
  22. __u16 nblocks;
  23. __u16 rsvd;
  24. __u64 metadata;
  25. __u64 addr;
  26. __u64 slba;
  27. __u32 dsmgmt;
  28. __u32 reftag;
  29. __u16 apptag;
  30. __u16 appmask;
  31. };
  32. struct nvme_passthru_cmd {
  33. __u8 opcode;
  34. __u8 flags;
  35. __u16 rsvd1;
  36. __u32 nsid;
  37. __u32 cdw2;
  38. __u32 cdw3;
  39. __u64 metadata;
  40. __u64 addr;
  41. __u32 metadata_len;
  42. __u32 data_len;
  43. __u32 cdw10;
  44. __u32 cdw11;
  45. __u32 cdw12;
  46. __u32 cdw13;
  47. __u32 cdw14;
  48. __u32 cdw15;
  49. __u32 timeout_ms;
  50. __u32 result;
  51. };
  52. #define nvme_admin_cmd nvme_passthru_cmd
  53. #define NVME_IOCTL_ID _IO('N', 0x40)
  54. #define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
  55. #define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
  56. #define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd)
  57. #define NVME_IOCTL_RESET _IO('N', 0x44)
  58. #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45)
  59. #define NVME_IOCTL_RESCAN _IO('N', 0x46)
  60. #endif /* _UAPI_LINUX_NVME_IOCTL_H */