README.nvme 3.1 KB

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