(no subject)
Test for NVMe driver:
platform: LS1046AQDS NVMe SSD: Intel P3700 400G
The test logs are as follow:
----------------------------
=> nvme list
Device 0: Vendor: 0x8086 Rev: 8DV10131 Prod: CVFT535600LS400BGN
Type: Hard Disk
Capacity: 381554.0 MB = 372.6 GB (781422768 x 512)
=> nvme device 0
Device 0: Vendor: 0x8086 Rev: 8DV10131 Prod: CVFT535600LS400BGN
Type: Hard Disk
Capacity: 381554.0 MB = 372.6 GB (781422768 x 512)... is now current device
=> nvme info
Blk device 0: Optional Admin Command Support:
Namespace Management/Attachment: no Firmware Commit/Image download: yes Format NVM: yes
Security Send/Receive: no
Blk device 0: Optional NVM Command Support:
Reservation: no
Save/Select field in the Set/Get features: no Write Zeroes: yes
Dataset Management: yes
Write Uncorrectable: no
Blk device 0: Format NVM Attributes:
Support Cryptographic Erase: yes Support erase a particular namespace: No Support format a particular namespace: No
Blk device 0: LBA Format Support:
LBA Foramt 0 Support: (current)
Metadata Size: 0
LBA Data Size: 512
Relative Performance: Good
LBA Foramt 1 Support:
Metadata Size: 8
LBA Data Size: 512
Relative Performance: Good
LBA Foramt 2 Support:
Metadata Size: 16
LBA Data Size: 512
Relative Performance: Good
LBA Foramt 3 Support:
Metadata Size: 0
LBA Data Size: 4096
Relative Performance: Best
LBA Foramt 4 Support:
Metadata Size: 8
LBA Data Size: 4096
Relative Performance: Best
LBA Foramt 5 Support:
Metadata Size: 64
LBA Data Size: 4096
Relative Performance: Best
Blk device 0: End-to-End DataProtect Capabilities:
As last eight bytes: yes
As first eight bytes: No
Support Type3: No
Support Type2: No
Support Type1: yes
Blk device 0: Metadata capabilities:
As part of a separate buffer: No
As part of an extended data LBA: yes
=> nvme part
Partition Map for UNKNOWN device 0 -- Partition Type: DOS
Part Start Sector Num Sectors UUID Type 1 2048 2048000 ffc18949-01 83
=> nvme read 90000000 0 100000
NVME read: device 0 block # 0, count 1048576 ... read: OK 536870912 bytes read in 1086 ms (471.5 MiB/s)
=> nvme write 90000000 0 100000
NVME write: device 0 block # 0, count 1048576 ... write: OK 536870912 bytes read in 1070 ms (478.5 MiB/s)
=> fatls nvme 0
32376967 kernel.itb
22929408 100m
2 file(s), 0 dir(s)
=> fatload nvme 0 90000000 kernel.itb
reading kernel.itb
32376967 bytes read in 128 ms (241.2 MiB/s)
RFC v2 1/2 NVMe: add NVMe driver support
Add Support of devices that follow the NVM Express standard
basic functions: nvme Read/Write
---
Changes for v2:
- add UCLASS_NVME (drivers/block/nvme-uclasss.c)
- remove the support of non-BLK
- remove common/nvme.c
--- common/board_r.c | 13 + doc/README.nvme | 30 ++ drivers/block/Kconfig | 8 + drivers/block/Makefile | 2 + drivers/block/blk-uclass.c | 3 +- drivers/block/nvme-uclass.c | 64 +++ drivers/block/nvme.c | 966 ++++++++++++++++++++++++++++++++++++++++++++ drivers/block/nvme.h | 133 ++++++ drivers/block/nvme_uapi.h | 574 ++++++++++++++++++++++++++ include/blk.h | 1 + include/dm/uclass-id.h | 1 + include/nvme.h | 12 + 12 files changed, 1806 insertions(+), 1 deletion(-) create mode 100644 doc/README.nvme create mode 100644 drivers/block/nvme-uclass.c create mode 100644 drivers/block/nvme.c create mode 100644 drivers/block/nvme.h create mode 100644 drivers/block/nvme_uapi.h create mode 100644 include/nvme.h
common/board_r.c +13 -0
@@ -44,6 +44,7 @@#include <nand.h> #include <onenand_uboot.h> #include <scsi.h> +#include <nvme.h> #include <serial.h> #include <spi.h> #include <stdio_dev.h>
@@ -450,6 +451,15 @@ static int initr_dataflash(void) }#endif +#ifdef CONFIG_NVME +static int initr_nvme (void ) +{ +puts ("NVMe: " ); +nvme_initialize (); +return 0 ; +} +#endif +/* * Tell if it's OK to load the environment early in boot. *
@@ -912,6 +922,9 @@ static init_fnc_t init_sequence_r[] = {#ifdef CONFIG_PS2KBD initr_kbd,#endif +#ifdef CONFIG_NVME + initr_nvme, +#endif run_main_loop, };
doc/README.nvme new file +30 -0
@@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 NXP Semiconductors + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +NVMe NVM Express (NVMe) is a register level interface that allows + host software to communicate with a non-volatile memory subsystem. + This interface is optimized for Enterprise and Client solid state drives, + typically attached to the PCI Express interface. + +namespace A quantity of non-volatile memory that be formatted into logical blocks. + An NVM Express namespace is equivalent to a SCSI LUN + Each namespace is operated as an independent "device". + +How it works: +------------- +First, the NVMe controller("nvme"), which based on UCLASS_NVME, +should be bind throuth PCIe DM driver. +Then, we can scan the namespaces(based on UCLASS_BLK) in the controller, +and bind/probe namespace as a standard Block device through BLK DM driver. + +Basic functions: +---------------- +It only support basic Read/Write functions in the driver. +You can also get/set other features through standard commands. + +NVMe Config Switches: +--------------------- +CONFIG_NVME enables basic NVMe device support
drivers/block/Kconfig +8 -0
@@ -49,3 +49,11 @@ config SATA_CEVA AHCI 1.3 specifications with hot-plug detect feature. endmenu + +config NVME + bool "Support NVMe devices" + depends on BLK + depends on PCI + help + This option enables supporting for NVMe devices. + It supports basic functions of NVMe(read/write).
drivers/block/Makefile +2 -0
@@ -30,3 +30,5 @@ obj-$(CONFIG_SANDBOX) += sandbox.o sandbox_scsi.o sata_sandbox.o obj-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o obj-$(CONFIG_SYSTEMACE) += systemace.o obj-$(CONFIG_BLOCK_CACHE) += blkcache.o +obj-$(CONFIG_NVME) += nvme.o +obj-$(CONFIG_NVME) += nvme-uclass.o
drivers/block/blk-uclass.c +2 -1
@@ -4,7 +4,6 @@* * SPDX-License-Identifier: GPL-2.0+ */ -#include <common.h> #include <blk.h> #include <dm.h>
@@ -22,6 +21,7 @@ static const char *if_typename_str[IF_TYPE_COUNT] = { [IF_TYPE_SATA] = "sata", [IF_TYPE_HOST] = "host", [IF_TYPE_SYSTEMACE] = "ace", + [IF_TYPE_NVME] = "nvme", };static enum uclass_id if_type_uclass_id[IF_TYPE_COUNT ] = {
@@ -34,6 +34,7 @@ static enum uclass_id if_type_uclass_id[IF_TYPE_COUNT] = { [IF_TYPE_SD] = UCLASS_INVALID, [IF_TYPE_SATA] = UCLASS_AHCI, [IF_TYPE_HOST] = UCLASS_ROOT, + [IF_TYPE_NVME] = UCLASS_NVME, [IF_TYPE_SYSTEMACE] = UCLASS_INVALID, };
drivers/block/nvme-uclass.c new file +64 -0
64 lines not on this page · raw message
drivers/block/nvme.c new file +966 -0
966 lines not on this page · raw message
drivers/block/nvme.h new file +133 -0
133 lines not on this page · raw message
drivers/block/nvme_uapi.h new file +574 -0
574 lines not on this page · raw message
include/blk.h +1 -0
@@ -31,6 +31,7 @@ enum if_type {IF_TYPE_SATA ,IF_TYPE_HOST ,IF_TYPE_SYSTEMACE , +IF_TYPE_NVME , IF_TYPE_COUNT, /* Number of interface types */ };
include/dm/uclass-id.h +1 -0
@@ -68,6 +68,7 @@ enum uclass_id {UCLASS_RESET ,/* Reset controller device */ UCLASS_RTC ,/* Real time clock device */ UCLASS_SCSI ,/* SCSI device */ +UCLASS_NVME ,/* NVME device */ UCLASS_SERIAL ,/* Serial UART */ UCLASS_SPI ,/* SPI bus */ UCLASS_SPMI, /* System Power Management Interface bus */
include/nvme.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* Copyright (C) 2017 NXP Semiconductors +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __NVME_H__ +#define __NVME_H__ + +int nvme_initialize (void ); +int nvme_print_info (struct udevice *udev); +#endif
Signature · 1 line
2.1.0.27.g96db324
RFC v2 2/2 NVMe: add nvme commands
In reply to Zhikang ZhangAdd nvme commands in U-Boot command line.
1. "nvme list" - show all available NVMe blk devices
2. "nvme info" - show current or a specific NVMe blk device
3. "nvme device" - show or set current device
4. "nvme part" - print partition table
5. "nvme read" - read data from NVMe blk device
6. "nvme write" - write data to NVMe blk device
---
Changes for v2:
- remove the calling of "initialie" in fuction "do_nvmecops"
- change the function "do_nvme_info" to support BLK uclass
--- cmd/Kconfig | 9 +++ cmd/Makefile | 1 + cmd/nvme.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ disk/part.c | 6 ++ doc/README.nvme | 54 ++++++++++++++++++ 5 files changed, 243 insertions(+) create mode 100644 cmd/nvme.c
cmd/Kconfig +9 -0
@@ -502,6 +502,15 @@ config CMD_USB help USB support. +config CMD_NVME + bool "NVMe" + depends on NVME + help + NVMe support. + This enables nvme commands in command line + You can use comamnd "nvme" to show what commands it supports + such as "nvme info" "nvme list". + config CMD_DFU bool "dfu" select USB_FUNCTION_DFU
cmd/Makefile +1 -0
@@ -111,6 +111,7 @@ obj-$(CONFIG_CMD_REISER) += reiser.o obj-$(CONFIG_CMD_REMOTEPROC) += remoteproc.o obj-$(CONFIG_SANDBOX) += host.o obj-$(CONFIG_CMD_SATA) += sata.o +obj-$(CONFIG_CMD_NVME) += nvme.o obj-$(CONFIG_CMD_SF) += sf.o obj-$(CONFIG_SCSI) += scsi.o disk.o obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
cmd/nvme.c new file +173 -0
173 lines not on this page · raw message
disk/part.c +6 -0
@@ -140,6 +140,12 @@ void dev_print (struct blk_desc *dev_desc)case IF_TYPE_DOC :puts ("device type DOC\n" );return ; +case IF_TYPE_NVME : +printf ("Vendor: %s Rev: %s Prod: %s\n" , + dev_desc->vendor, + dev_desc->revision, + dev_desc->product); +break ;case IF_TYPE_UNKNOWN :puts ("device type unknown\n" );return ;
doc/README.nvme +54 -0
57 lines not on this page · raw message
Signature · 1 line
2.1.0.27.g96db324