diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2020-08-03 04:16:31 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2020-08-03 04:16:31 +0000 |
commit | 936a3271c9f9d86c9592e1406bdd254341ff2849 (patch) | |
tree | 9670d1c5e49bf15e036c7f43830fad570571176f /examples | |
parent | 33f7b2296c779583acd5475484f57552ba437c41 (diff) | |
download | sg3_utils-936a3271c9f9d86c9592e1406bdd254341ff2849.tar.gz |
sg_raw: fix --cmdfile= handling; add --nvm option; sg_pt: add do_nvm_pt(); sg_lib: fix crash in sg_f2hex_arr() when fname not found
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@860 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'examples')
-rw-r--r-- | examples/nvme_read_ctl.hex | 38 | ||||
-rw-r--r-- | examples/nvme_write_ctl.hex | 38 |
2 files changed, 76 insertions, 0 deletions
diff --git a/examples/nvme_read_ctl.hex b/examples/nvme_read_ctl.hex new file mode 100644 index 00000000..397072d8 --- /dev/null +++ b/examples/nvme_read_ctl.hex @@ -0,0 +1,38 @@ +# 64 byte NVMe, Read command (a NVM command) that is suitable for: +# sg_raw --cmdfile=<this_file_name> --nvm --request=2048 <nvme_device> +# +# The address field (at byte offset 24, 8 bytes and little endian) gives +# special meaning to the highest address pointers: +# ffffffff fffffffe use address of data-in buffer +# ffffffff fffffffd use address of data-out buffer +# +# The data length field (at byte offset 36, 4 bytes and little endian) +# gives special meaning to the highest block counts: +# fffffffe use byte length of data-in buffer +# fffffffd use byte length of data-out buffer +# +# 512 byte logical block size is assumed. Read 4 blocks hence 2048bytes. +# The first LBA read is 0x12345 and the namespace is 1. If successful +# the four blocks will be read into the data-in buffer. Submission queu +# 0 is used (the same queue that Admin commands use). The NVM opcode for +# the Read command is 0x2 and appears in the first command byte. + +02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 fe ff ff ff ff ff ff ff +00 00 00 00 fe ff ff ff 45 23 01 00 00 00 00 00 +03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +# Notice NVMe uses its quirky "0's based" number of blocks so +# 03 appears at byte offset 48 to mean "read 4 blocks". +# +# A typical invocation in Linux and FreeBSD would look like this: +# sg_raw --cmdfile=nvme_read_ctl.hex --nvm -r 2048 +# --outfile=t.bin /dev/nvme0 +# +# Notice the '--nvm' option which is needed to distiguish a NVM +# command from an Admin command as Admin commands are the default +# in this utility. +# +# This utility (and most others in the package) aligns data-in and +# data-out buffers to the beginning of pages which are 4096 bytes +# long at a minimum. This is the way NVMe likes things as well. diff --git a/examples/nvme_write_ctl.hex b/examples/nvme_write_ctl.hex new file mode 100644 index 00000000..02b5a377 --- /dev/null +++ b/examples/nvme_write_ctl.hex @@ -0,0 +1,38 @@ +# 64 byte NVMe, Write command (a NVM command) that is suitable for: +# sg_raw --cmdfile=<this_file_name> --nvm --request=2048 <nvme_device> +# +# The address field (at byte offset 24, 8 bytes and little endian) gives +# special meaning to the highest address pointers: +# ffffffff fffffffe use address of data-in buffer +# ffffffff fffffffd use address of data-out buffer +# +# The data length field (at byte offset 36, 4 bytes and little endian) +# gives special meaning to the highest block counts: +# fffffffe use byte length of data-in buffer +# fffffffd use byte length of data-out buffer +# +# 512 byte logical block size is assumed. Write 4 blocks hence 2048 bytes. +# The first LBA written is 0x12345 and the namespace is 1. If successful the +# four blocks will be written out of the data-out buffer. Submission queue +# is used (the same queue that Admin commands use). The NVM opcode for the +# Write command is 0x1 and appears in the first command byte. + +01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 fd ff ff ff ff ff ff ff +00 00 00 00 fd ff ff ff 45 23 01 00 00 00 00 00 +03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +# Notice NVMe uses its quirky "0's based" number of blocks so +# 03 appears at byte offset 48 to mean "write 4 blocks". +# +# A typical invocation in Linux and FreeBSD would look like this: +# sg_raw --cmdfile=nvme_write_ctl.hex --nvm -s 2048 +# --infile=t.bin /dev/nvme0 +# +# Notice the '--nvm' option which is needed to distiguish a NVM +# command from an Admin command as Admin commands are the default +# in this utility. +# +# This utility (and most others in the package) aligns data-in and +# data-out buffers to the beginning of pages which are 4096 bytes +# long at a minimum. This is the way NVMe likes things as well. |