]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | # SPDX-License-Identifier: GPL-2.0+ |
982388ea ZZ |
2 | # |
3 | # Copyright (C) 2017 NXP Semiconductors | |
4 | # Copyright (C) 2017 Bin Meng <[email protected]> | |
982388ea ZZ |
5 | |
6 | What is NVMe | |
7 | ============ | |
8 | ||
9 | NVM Express (NVMe) is a register level interface that allows host software to | |
10 | communicate with a non-volatile memory subsystem. This interface is optimized | |
11 | for enterprise and client solid state drives, typically attached to the PCI | |
12 | express interface. It is a scalable host controller interface designed to | |
13 | address the needs of enterprise and client systems that utilize PCI express | |
14 | based solid state drives (SSD). The interface provides optimized command | |
15 | submission and completion paths. It includes support for parallel operation by | |
16 | supporting up to 64K I/O queues with up to 64K commands per I/O queue. | |
17 | ||
18 | The device is comprised of some number of controllers, where each controller | |
19 | is comprised of some number of namespaces, where each namespace is comprised | |
20 | of some number of logical blocks. A namespace is a quantity of non-volatile | |
21 | memory that is formatted into logical blocks. An NVMe namespace is equivalent | |
22 | to a SCSI LUN. Each namespace is operated as an independent "device". | |
23 | ||
24 | How it works | |
25 | ------------ | |
26 | There is an NVMe uclass driver (driver name "nvme"), an NVMe host controller | |
27 | driver (driver name "nvme") and an NVMe namespace block driver (driver name | |
28 | "nvme-blk"). The host controller driver is supposed to probe the hardware and | |
29 | do necessary initialization to put the controller into a ready state at which | |
30 | it is able to scan all available namespaces attached to it. Scanning namespace | |
31 | is triggered by the NVMe uclass driver and the actual work is done in the NVMe | |
32 | namespace block driver. | |
33 | ||
34 | Status | |
35 | ------ | |
36 | It only support basic block read/write functions in the NVMe driver. | |
37 | ||
38 | Config options | |
39 | -------------- | |
40 | CONFIG_NVME Enable NVMe device support | |
0adc38be ZZ |
41 | CONFIG_CMD_NVME Enable basic NVMe commands |
42 | ||
43 | Usage in U-Boot | |
44 | --------------- | |
45 | To use an NVMe hard disk from U-Boot shell, a 'nvme scan' command needs to | |
46 | be executed for all NVMe hard disks attached to the NVMe controller to be | |
47 | identified. | |
48 | ||
49 | To list all of the NVMe hard disks, try: | |
50 | ||
fceadc14 | 51 | => nvme info |
0adc38be ZZ |
52 | Device 0: Vendor: 0x8086 Rev: 8DV10131 Prod: CVFT535600LS400BGN |
53 | Type: Hard Disk | |
54 | Capacity: 381554.0 MB = 372.6 GB (781422768 x 512) | |
55 | ||
56 | and print out detailed information for controller and namespaces via: | |
57 | ||
fceadc14 | 58 | => nvme detail |
0adc38be ZZ |
59 | |
60 | Raw block read/write to can be done via the 'nvme read/write' commands: | |
61 | ||
62 | => nvme read a0000000 0 11000 | |
63 | ||
64 | => tftp 80000000 /tftpboot/kernel.itb | |
65 | => nvme write 80000000 0 11000 | |
66 | ||
67 | Of course, file system command can be used on the NVMe hard disk as well: | |
68 | ||
69 | => fatls nvme 0:1 | |
70 | 32376967 kernel.itb | |
71 | 22929408 100m | |
72 | ||
73 | 2 file(s), 0 dir(s) | |
74 | ||
75 | => fatload nvme 0:1 a0000000 /kernel.itb | |
76 | => bootm a0000000 | |
7088a365 BM |
77 | |
78 | Testing NVMe with QEMU x86 | |
79 | -------------------------- | |
80 | QEMU supports NVMe emulation and we can test NVMe driver with QEMU x86 running | |
81 | U-Boot. Please see README.x86 for how to build u-boot.rom image for QEMU x86. | |
82 | ||
83 | Example command line to call QEMU x86 below with emulated NVMe device: | |
84 | $ ./qemu-system-i386 -drive file=nvme.img,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom |