mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 23:50:13 +08:00
parent
fed6e9be67
commit
da6b9a1891
@ -49,6 +49,7 @@ net80211 = off
|
|||||||
netinet = on
|
netinet = on
|
||||||
netinet6 = on
|
netinet6 = on
|
||||||
netipsec = off
|
netipsec = off
|
||||||
|
nvme = on
|
||||||
opencrypto = on
|
opencrypto = on
|
||||||
pci = on
|
pci = on
|
||||||
pf = on
|
pf = on
|
||||||
|
@ -73,6 +73,7 @@ nvme_init(void)
|
|||||||
|
|
||||||
SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL);
|
SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL);
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
static void
|
static void
|
||||||
nvme_uninit(void)
|
nvme_uninit(void)
|
||||||
{
|
{
|
||||||
@ -80,6 +81,7 @@ nvme_uninit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL);
|
SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL);
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
int
|
int
|
||||||
nvme_shutdown(device_t dev)
|
nvme_shutdown(device_t dev)
|
||||||
|
@ -997,7 +997,9 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr,
|
|||||||
{
|
{
|
||||||
struct nvme_request *req;
|
struct nvme_request *req;
|
||||||
struct mtx *mtx;
|
struct mtx *mtx;
|
||||||
|
#ifndef __rtems__
|
||||||
struct buf *buf = NULL;
|
struct buf *buf = NULL;
|
||||||
|
#endif /* __rtems__ */
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
vm_offset_t addr, end;
|
vm_offset_t addr, end;
|
||||||
|
|
||||||
@ -1019,6 +1021,7 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr,
|
|||||||
ctrlr->max_xfer_size);
|
ctrlr->max_xfer_size);
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
#ifndef __rtems__
|
||||||
if (is_user_buffer) {
|
if (is_user_buffer) {
|
||||||
/*
|
/*
|
||||||
* Ensure the user buffer is wired for the duration of
|
* Ensure the user buffer is wired for the duration of
|
||||||
@ -1036,6 +1039,7 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr,
|
|||||||
req = nvme_allocate_request_vaddr(buf->b_data, pt->len,
|
req = nvme_allocate_request_vaddr(buf->b_data, pt->len,
|
||||||
nvme_pt_done, pt);
|
nvme_pt_done, pt);
|
||||||
} else
|
} else
|
||||||
|
#endif /* __rtems__ */
|
||||||
req = nvme_allocate_request_vaddr(pt->buf, pt->len,
|
req = nvme_allocate_request_vaddr(pt->buf, pt->len,
|
||||||
nvme_pt_done, pt);
|
nvme_pt_done, pt);
|
||||||
} else
|
} else
|
||||||
@ -1068,11 +1072,13 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr,
|
|||||||
mtx_sleep(pt, mtx, PRIBIO, "nvme_pt", 0);
|
mtx_sleep(pt, mtx, PRIBIO, "nvme_pt", 0);
|
||||||
mtx_unlock(mtx);
|
mtx_unlock(mtx);
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
err:
|
err:
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
relpbuf(buf, NULL);
|
relpbuf(buf, NULL);
|
||||||
PRELE(curproc);
|
PRELE(curproc);
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include "nvme_private.h"
|
#include "nvme_private.h"
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
static void nvme_bio_child_inbed(struct bio *parent, int bio_error);
|
static void nvme_bio_child_inbed(struct bio *parent, int bio_error);
|
||||||
static void nvme_bio_child_done(void *arg,
|
static void nvme_bio_child_done(void *arg,
|
||||||
const struct nvme_completion *cpl);
|
const struct nvme_completion *cpl);
|
||||||
@ -63,6 +64,7 @@ static struct bio ** nvme_construct_child_bios(struct bio *bp,
|
|||||||
static int nvme_ns_split_bio(struct nvme_namespace *ns,
|
static int nvme_ns_split_bio(struct nvme_namespace *ns,
|
||||||
struct bio *bp,
|
struct bio *bp,
|
||||||
uint32_t alignment);
|
uint32_t alignment);
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvme_ns_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag,
|
nvme_ns_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag,
|
||||||
@ -76,10 +78,12 @@ nvme_ns_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag,
|
|||||||
ctrlr = ns->ctrlr;
|
ctrlr = ns->ctrlr;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
#ifndef __rtems__
|
||||||
case NVME_IO_TEST:
|
case NVME_IO_TEST:
|
||||||
case NVME_BIO_TEST:
|
case NVME_BIO_TEST:
|
||||||
nvme_ns_test(ns, cmd, arg);
|
nvme_ns_test(ns, cmd, arg);
|
||||||
break;
|
break;
|
||||||
|
#endif /* __rtems__ */
|
||||||
case NVME_PASSTHROUGH_CMD:
|
case NVME_PASSTHROUGH_CMD:
|
||||||
pt = (struct nvme_pt_command *)arg;
|
pt = (struct nvme_pt_command *)arg;
|
||||||
return (nvme_ctrlr_passthrough_cmd(ctrlr, pt, ns->id,
|
return (nvme_ctrlr_passthrough_cmd(ctrlr, pt, ns->id,
|
||||||
@ -125,6 +129,7 @@ nvme_ns_close(struct cdev *dev __unused, int flags, int fmt __unused,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
static void
|
static void
|
||||||
nvme_ns_strategy_done(void *arg, const struct nvme_completion *cpl)
|
nvme_ns_strategy_done(void *arg, const struct nvme_completion *cpl)
|
||||||
{
|
{
|
||||||
@ -161,15 +166,20 @@ nvme_ns_strategy(struct bio *bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static struct cdevsw nvme_ns_cdevsw = {
|
static struct cdevsw nvme_ns_cdevsw = {
|
||||||
.d_version = D_VERSION,
|
.d_version = D_VERSION,
|
||||||
.d_flags = D_DISK,
|
.d_flags = D_DISK,
|
||||||
|
#ifndef __rtems__
|
||||||
.d_read = physread,
|
.d_read = physread,
|
||||||
.d_write = physwrite,
|
.d_write = physwrite,
|
||||||
|
#endif /* __rtems__ */
|
||||||
.d_open = nvme_ns_open,
|
.d_open = nvme_ns_open,
|
||||||
.d_close = nvme_ns_close,
|
.d_close = nvme_ns_close,
|
||||||
|
#ifndef __rtems__
|
||||||
.d_strategy = nvme_ns_strategy,
|
.d_strategy = nvme_ns_strategy,
|
||||||
|
#endif /* __rtems__ */
|
||||||
.d_ioctl = nvme_ns_ioctl
|
.d_ioctl = nvme_ns_ioctl
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -240,6 +250,7 @@ nvme_ns_get_stripesize(struct nvme_namespace *ns)
|
|||||||
return (ns->boundary);
|
return (ns->boundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
static void
|
static void
|
||||||
nvme_ns_bio_done(void *arg, const struct nvme_completion *status)
|
nvme_ns_bio_done(void *arg, const struct nvme_completion *status)
|
||||||
{
|
{
|
||||||
@ -496,6 +507,7 @@ nvme_ns_bio_process(struct nvme_namespace *ns, struct bio *bp,
|
|||||||
|
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
int
|
int
|
||||||
nvme_ns_ioctl_process(struct nvme_namespace *ns, u_long cmd, caddr_t arg,
|
nvme_ns_ioctl_process(struct nvme_namespace *ns, u_long cmd, caddr_t arg,
|
||||||
|
@ -52,6 +52,7 @@ nvme_ns_cmd_read(struct nvme_namespace *ns, void *payload, uint64_t lba,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
int
|
int
|
||||||
nvme_ns_cmd_read_bio(struct nvme_namespace *ns, struct bio *bp,
|
nvme_ns_cmd_read_bio(struct nvme_namespace *ns, struct bio *bp,
|
||||||
nvme_cb_fn_t cb_fn, void *cb_arg)
|
nvme_cb_fn_t cb_fn, void *cb_arg)
|
||||||
@ -73,6 +74,7 @@ nvme_ns_cmd_read_bio(struct nvme_namespace *ns, struct bio *bp,
|
|||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
int
|
int
|
||||||
nvme_ns_cmd_write(struct nvme_namespace *ns, void *payload, uint64_t lba,
|
nvme_ns_cmd_write(struct nvme_namespace *ns, void *payload, uint64_t lba,
|
||||||
@ -93,6 +95,7 @@ nvme_ns_cmd_write(struct nvme_namespace *ns, void *payload, uint64_t lba,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
int
|
int
|
||||||
nvme_ns_cmd_write_bio(struct nvme_namespace *ns, struct bio *bp,
|
nvme_ns_cmd_write_bio(struct nvme_namespace *ns, struct bio *bp,
|
||||||
nvme_cb_fn_t cb_fn, void *cb_arg)
|
nvme_cb_fn_t cb_fn, void *cb_arg)
|
||||||
@ -113,6 +116,7 @@ nvme_ns_cmd_write_bio(struct nvme_namespace *ns, struct bio *bp,
|
|||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
int
|
int
|
||||||
nvme_ns_cmd_deallocate(struct nvme_namespace *ns, void *payload,
|
nvme_ns_cmd_deallocate(struct nvme_namespace *ns, void *payload,
|
||||||
|
@ -168,7 +168,11 @@ struct nvme_tracker {
|
|||||||
uint16_t cid;
|
uint16_t cid;
|
||||||
|
|
||||||
uint64_t *prp;
|
uint64_t *prp;
|
||||||
|
#ifndef __rtems__
|
||||||
bus_addr_t prp_bus_addr;
|
bus_addr_t prp_bus_addr;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
uint64_t prp_bus_addr;
|
||||||
|
#endif /* __rtems__ */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nvme_qpair {
|
struct nvme_qpair {
|
||||||
|
@ -1064,6 +1064,7 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
|
|||||||
case NVME_REQUEST_NULL:
|
case NVME_REQUEST_NULL:
|
||||||
nvme_qpair_submit_tracker(tr->qpair, tr);
|
nvme_qpair_submit_tracker(tr->qpair, tr);
|
||||||
break;
|
break;
|
||||||
|
#ifndef __rtems__
|
||||||
case NVME_REQUEST_BIO:
|
case NVME_REQUEST_BIO:
|
||||||
KASSERT(req->u.bio->bio_bcount <= qpair->ctrlr->max_xfer_size,
|
KASSERT(req->u.bio->bio_bcount <= qpair->ctrlr->max_xfer_size,
|
||||||
("bio->bio_bcount (%jd) exceeds max_xfer_size (%d)\n",
|
("bio->bio_bcount (%jd) exceeds max_xfer_size (%d)\n",
|
||||||
@ -1083,6 +1084,7 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
|
|||||||
nvme_printf(qpair->ctrlr,
|
nvme_printf(qpair->ctrlr,
|
||||||
"bus_dmamap_load_ccb returned 0x%x!\n", err);
|
"bus_dmamap_load_ccb returned 0x%x!\n", err);
|
||||||
break;
|
break;
|
||||||
|
#endif /* __rtems__ */
|
||||||
default:
|
default:
|
||||||
panic("unknown nvme request type 0x%x\n", req->type);
|
panic("unknown nvme request type 0x%x\n", req->type);
|
||||||
break;
|
break;
|
||||||
|
0
rtemsbsd/include/rtems/bsd/local/opt_nvme.h
Normal file
0
rtemsbsd/include/rtems/bsd/local/opt_nvme.h
Normal file
Loading…
x
Reference in New Issue
Block a user