diff options
author | Bart Van Assche <bvanassche@google.com> | 2022-11-23 18:56:18 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-11-23 18:56:18 +0000 |
commit | 71b9916bab71328ec690b8677524e512d580d28f (patch) | |
tree | 207cdb23f8257e270a30143fde23d2033901581f /inhex/nvme_read_ctl.hex | |
parent | 8718296061e35ba33bf88847e7498f3d7e38f8f1 (diff) | |
parent | 448b67b18a80f8cc0feaaa669deaf169faa169f3 (diff) | |
download | sg3_utils-71b9916bab71328ec690b8677524e512d580d28f.tar.gz |
Merge remote-tracking branch 'aosp/upstream-main' into HEAD am: 448b67b18a
Original change: https://android-review.googlesource.com/c/platform/external/sg3_utils/+/2312210
Change-Id: I9653250a81928fffacf92bb5d9daffbc0ad7b2a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'inhex/nvme_read_ctl.hex')
-rw-r--r-- | inhex/nvme_read_ctl.hex | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/inhex/nvme_read_ctl.hex b/inhex/nvme_read_ctl.hex new file mode 100644 index 00000000..7996a1ae --- /dev/null +++ b/inhex/nvme_read_ctl.hex @@ -0,0 +1,39 @@ +# 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 2048 bytes. +# 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 queue +# 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/nvme0n1 +# In FreeBSD the device name would be /dev/nvme0ns1 +# +# Notice the '--nvm' option which is needed to distinguish 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. |