xref: /aosp_15_r20/external/sg3_utils/inhex/nvme_read_oob_ctl.hex (revision 44704f698541f6367e81f991ef8bb54ccbf3fc18)
1# 64 byte NVMe, Read command (a NVM command) which what should be an
2# Out-of-Bounds LBA (around 377 TB with 512 byte sectors. This file is
3# suitable for:
4#       sg_raw --cmdfile=<this_file_name> --nvm --request=2048 <nvme_device>
5#
6# The address field (at byte offset 24, 8 bytes and little endian) gives
7# special meaning to the highest address pointers:
8#    ffffffff fffffffe         use address of data-in buffer
9#    ffffffff fffffffd         use address of data-out buffer
10#
11# The data length field (at byte offset 36, 4 bytes and little endian)
12# gives special meaning to the highest block counts:
13#    fffffffe                  use byte length of data-in buffer
14#    fffffffd                  use byte length of data-out buffer
15#
16# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
17# This NVMe (NVM) Read command purposely has a very large starting LBA
18# in order to get a "Attempted write to read only range" error. This is
19# to test error reporting.
20# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21#
22# 512 byte logical block size is assumed. Read 4 blocks hence 2048 bytes.
23# The first LBA read is 0xabcd012345 and the namespace is 1. If successful
24# the four blocks will be read into the data-in buffer. Submission queue
25# 0 is used (the same queue that Admin commands use). The NVM opcode for
26# the Read command is 0x2 and appears in the first command byte.
27
2802 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
2900 00 00 00 00 00 00 00  fe ff ff ff ff ff ff ff
3000 00 00 00 fe ff ff ff  45 23 01 cd ab 00 00 00
3103 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
32
33# Notice NVMe uses its quirky "0's based" number of blocks so
34# 03 appears at byte offset 48 to mean "read 4 blocks".
35#
36# A typical invocation in Linux and FreeBSD would look like this:
37#    sg_raw --cmdfile=nvme_read_oob_ctl.hex --nvm -r 2048
38#           --outfile=t.bin /dev/nvme0n1
39# In FreeBSD the device name would be /dev/nvme0ns1
40#
41# Notice the '--nvm' option which is needed to distinguish a NVM
42# command from an Admin command as Admin commands are the default
43# in this utility.
44#
45# This utility (and most others in the package) aligns data-in and
46# data-out buffers to the beginning of pages which are 4096 bytes
47# long at a minimum. This is the way NVMe likes things as well.
48