Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
6ee44cdc
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6ee44cdc
编写于
2月 03, 2011
作者:
M
Matthew Wilcox
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NVMe: Add download / activate firmware ioctls
Signed-off-by:
N
Matthew Wilcox
<
matthew.r.wilcox@intel.com
>
上级
7a63e07b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
72 addition
and
6 deletion
+72
-6
drivers/block/nvme.c
drivers/block/nvme.c
+45
-0
include/linux/nvme.h
include/linux/nvme.h
+27
-6
未找到文件。
drivers/block/nvme.c
浏览文件 @
6ee44cdc
...
...
@@ -829,6 +829,47 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
return
status
;
}
static
int
nvme_download_firmware
(
struct
nvme_ns
*
ns
,
struct
nvme_dlfw
__user
*
udlfw
)
{
struct
nvme_dev
*
dev
=
ns
->
dev
;
struct
nvme_dlfw
dlfw
;
struct
nvme_command
c
;
int
nents
,
status
;
struct
scatterlist
*
sg
;
if
(
copy_from_user
(
&
dlfw
,
udlfw
,
sizeof
(
dlfw
)))
return
-
EFAULT
;
if
(
dlfw
.
length
>=
(
1
<<
30
))
return
-
EINVAL
;
nents
=
nvme_map_user_pages
(
dev
,
1
,
dlfw
.
addr
,
dlfw
.
length
*
4
,
&
sg
);
if
(
nents
<
0
)
return
nents
;
memset
(
&
c
,
0
,
sizeof
(
c
));
c
.
dlfw
.
opcode
=
nvme_admin_download_fw
;
c
.
dlfw
.
numd
=
cpu_to_le32
(
dlfw
.
length
);
c
.
dlfw
.
offset
=
cpu_to_le32
(
dlfw
.
offset
);
nvme_setup_prps
(
&
c
.
common
,
sg
,
dlfw
.
length
*
4
);
status
=
nvme_submit_admin_cmd
(
dev
,
&
c
,
NULL
);
nvme_unmap_user_pages
(
dev
,
0
,
dlfw
.
addr
,
dlfw
.
length
*
4
,
sg
,
nents
);
return
status
;
}
static
int
nvme_activate_firmware
(
struct
nvme_ns
*
ns
,
unsigned
long
arg
)
{
struct
nvme_dev
*
dev
=
ns
->
dev
;
struct
nvme_command
c
;
memset
(
&
c
,
0
,
sizeof
(
c
));
c
.
common
.
opcode
=
nvme_admin_activate_fw
;
c
.
common
.
rsvd10
[
0
]
=
cpu_to_le32
(
arg
);
return
nvme_submit_admin_cmd
(
dev
,
&
c
,
NULL
);
}
static
int
nvme_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
...
...
@@ -843,6 +884,10 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
return
nvme_get_range_type
(
ns
,
arg
);
case
NVME_IOCTL_SUBMIT_IO
:
return
nvme_submit_io
(
ns
,
(
void
__user
*
)
arg
);
case
NVME_IOCTL_DOWNLOAD_FW
:
return
nvme_download_firmware
(
ns
,
(
void
__user
*
)
arg
);
case
NVME_IOCTL_ACTIVATE_FW
:
return
nvme_activate_firmware
(
ns
,
arg
);
default:
return
-
ENOTTY
;
}
...
...
include/linux/nvme.h
浏览文件 @
6ee44cdc
...
...
@@ -262,7 +262,7 @@ struct nvme_create_cq {
__u8
opcode
;
__u8
flags
;
__u16
command_id
;
__
le
32
rsvd1
[
5
];
__
u
32
rsvd1
[
5
];
__le64
prp1
;
__u64
rsvd8
;
__le16
cqid
;
...
...
@@ -276,14 +276,14 @@ struct nvme_create_sq {
__u8
opcode
;
__u8
flags
;
__u16
command_id
;
__
le
32
rsvd1
[
5
];
__
u
32
rsvd1
[
5
];
__le64
prp1
;
__u64
rsvd8
;
__le16
sqid
;
__le16
qsize
;
__le16
sq_flags
;
__le16
cqid
;
__
le
32
rsvd12
[
4
];
__
u
32
rsvd12
[
4
];
};
struct
nvme_delete_queue
{
...
...
@@ -292,8 +292,20 @@ struct nvme_delete_queue {
__u16
command_id
;
__u32
rsvd1
[
9
];
__le16
qid
;
__le16
rsvd10
;
__le32
rsvd11
[
5
];
__u16
rsvd10
;
__u32
rsvd11
[
5
];
};
struct
nvme_download_firmware
{
__u8
opcode
;
__u8
flags
;
__u16
command_id
;
__u32
rsvd1
[
5
];
__le64
prp1
;
__le64
prp2
;
__le32
numd
;
__le32
offset
;
__u32
rsvd12
[
4
];
};
struct
nvme_command
{
...
...
@@ -305,6 +317,7 @@ struct nvme_command {
struct
nvme_create_cq
create_cq
;
struct
nvme_create_sq
create_sq
;
struct
nvme_delete_queue
delete_queue
;
struct
nvme_download_firmware
dlfw
;
};
};
...
...
@@ -348,7 +361,7 @@ enum {
struct
nvme_completion
{
__le32
result
;
/* Used by admin commands to return data */
__
le
32
rsvd
;
__
u
32
rsvd
;
__le16
sq_head
;
/* how much of this queue may be reclaimed */
__le16
sq_id
;
/* submission queue that generated this entry */
__u16
command_id
;
/* of the command which completed */
...
...
@@ -372,9 +385,17 @@ struct nvme_user_io {
__u32
result
;
};
struct
nvme_dlfw
{
__u64
addr
;
__u32
length
;
/* In dwords */
__u32
offset
;
/* In dwords */
};
#define NVME_IOCTL_IDENTIFY_NS _IOW('N', 0x40, struct nvme_id_ns)
#define NVME_IOCTL_IDENTIFY_CTRL _IOW('N', 0x41, struct nvme_id_ctrl)
#define NVME_IOCTL_GET_RANGE_TYPE _IOW('N', 0x42, struct nvme_lba_range_type)
#define NVME_IOCTL_SUBMIT_IO _IOWR('N', 0x43, struct nvme_rw_command)
#define NVME_IOCTL_DOWNLOAD_FW _IOR('N', 0x44, struct nvme_dlfw)
#define NVME_IOCTL_ACTIVATE_FW _IO('N', 0x45)
#endif
/* _LINUX_NVME_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录