Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147925383
D10466.1784806954.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D10466.1784806954.diff
View Options
Index: head/sys/cam/cam_ccb.h
===================================================================
--- head/sys/cam/cam_ccb.h
+++ head/sys/cam/cam_ccb.h
@@ -366,8 +366,7 @@
u_int8_t serial_num[252];
u_int8_t inq_flags;
u_int8_t serial_num_len;
- const struct nvme_controller_data *nvme_cdata;
- const struct nvme_namespace_data *nvme_data;
+ void *padding[2];
};
/* Device Statistics CCB */
@@ -1267,6 +1266,8 @@
#define CDAI_TYPE_PHYS_PATH 3
#define CDAI_TYPE_RCAPLONG 4
#define CDAI_TYPE_EXT_INQ 5
+#define CDAI_TYPE_NVME_CNTRL 6 /* NVMe Identify Controller data */
+#define CDAI_TYPE_NVME_NS 7 /* NVMe Identify Namespace data */
off_t bufsiz; /* IN: Size of external buffer */
#define CAM_SCSI_DEVID_MAXLEN 65536 /* length in buffer is an uint16_t */
off_t provsiz; /* OUT: Size required/used */
Index: head/sys/cam/cam_xpt.c
===================================================================
--- head/sys/cam/cam_xpt.c
+++ head/sys/cam/cam_xpt.c
@@ -2834,8 +2834,6 @@
cgd->inq_data = dev->inq_data;
cgd->ident_data = dev->ident_data;
cgd->inq_flags = dev->inq_flags;
- cgd->nvme_data = dev->nvme_data;
- cgd->nvme_cdata = dev->nvme_cdata;
cgd->ccb_h.status = CAM_REQ_CMP;
cgd->serial_num_len = dev->serial_num_len;
if ((dev->serial_num_len > 0)
Index: head/sys/cam/nvme/nvme_all.h
===================================================================
--- head/sys/cam/nvme/nvme_all.h
+++ head/sys/cam/nvme/nvme_all.h
@@ -44,5 +44,7 @@
void nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *);
const char *nvme_op_string(const struct nvme_command *);
const char *nvme_cmd_string(const struct nvme_command *, char *, size_t);
+const void *nvme_get_identify_cntrl(struct cam_periph *);
+const void *nvme_get_identify_ns(struct cam_periph *);
#endif /* CAM_NVME_NVME_ALL_H */
Index: head/sys/cam/nvme/nvme_all.c
===================================================================
--- head/sys/cam/nvme/nvme_all.c
+++ head/sys/cam/nvme/nvme_all.c
@@ -35,6 +35,7 @@
#include <sys/systm.h>
#include <sys/libkern.h>
#include <sys/kernel.h>
+#include <sys/malloc.h>
#include <sys/sysctl.h>
#else
#include <errno.h>
@@ -54,6 +55,13 @@
#include <sys/sbuf.h>
#include <sys/endian.h>
+#ifdef _KERNEL
+#include <cam/cam_periph.h>
+#include <cam/cam_xpt_sim.h>
+#include <cam/cam_xpt_periph.h>
+#include <cam/cam_xpt_internal.h>
+#endif
+
void
nvme_ns_cmd(struct ccb_nvmeio *nvmeio, uint8_t cmd, uint32_t nsid,
uint32_t cdw10, uint32_t cdw11, uint32_t cdw12, uint32_t cdw13,
@@ -121,4 +129,24 @@
cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, cmd->cdw15);
return cmd_string;
+}
+
+const void *
+nvme_get_identify_cntrl(struct cam_periph *periph)
+{
+ struct cam_ed *device;
+
+ device = periph->path->device;
+
+ return device->nvme_cdata;
+}
+
+const void *
+nvme_get_identify_ns(struct cam_periph *periph)
+{
+ struct cam_ed *device;
+
+ device = periph->path->device;
+
+ return device->nvme_data;
}
Index: head/sys/cam/nvme/nvme_da.c
===================================================================
--- head/sys/cam/nvme/nvme_da.c
+++ head/sys/cam/nvme/nvme_da.c
@@ -684,21 +684,14 @@
struct nda_softc *softc;
struct disk *disk;
struct ccb_pathinq cpi;
- struct ccb_getdev *cgd;
const struct nvme_namespace_data *nsd;
const struct nvme_controller_data *cd;
char announce_buf[80];
-// caddr_t match;
u_int maxio;
int quirks;
- cgd = (struct ccb_getdev *)arg;
- if (cgd == NULL) {
- printf("ndaregister: no getdev CCB, can't register device\n");
- return(CAM_REQ_CMP_ERR);
- }
- nsd = cgd->nvme_data;
- cd = cgd->nvme_cdata;
+ nsd = nvme_get_identify_ns(periph);
+ cd = nvme_get_identify_cntrl(periph);
softc = (struct nda_softc *)malloc(sizeof(*softc), M_DEVBUF,
M_NOWAIT | M_ZERO);
@@ -719,19 +712,7 @@
periph->softc = softc;
-#if 0
- /*
- * See if this device has any quirks.
- */
- match = cam_quirkmatch((caddr_t)&cgd->ident_data,
- (caddr_t)nda_quirk_table,
- sizeof(nda_quirk_table)/sizeof(*nda_quirk_table),
- sizeof(*nda_quirk_table), ata_identify_match);
- if (match != NULL)
- softc->quirks = ((struct nda_quirk_entry *)match)->quirks;
- else
-#endif
- softc->quirks = NDA_Q_NONE;
+ softc->quirks = NDA_Q_NONE;
bzero(&cpi, sizeof(cpi));
xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);
Index: head/sys/cam/nvme/nvme_xpt.c
===================================================================
--- head/sys/cam/nvme/nvme_xpt.c
+++ head/sys/cam/nvme/nvme_xpt.c
@@ -538,6 +538,24 @@
memcpy(cdai->buf, device->physpath, amt);
}
break;
+ case CDAI_TYPE_NVME_CNTRL:
+ if (cdai->flags & CDAI_FLAG_STORE)
+ return;
+ amt = sizeof(struct nvme_controller_data);
+ cdai->provsiz = amt;
+ if (amt > cdai->bufsiz)
+ amt = cdai->bufsiz;
+ memcpy(cdai->buf, device->nvme_cdata, amt);
+ break;
+ case CDAI_TYPE_NVME_NS:
+ if (cdai->flags & CDAI_FLAG_STORE)
+ return;
+ amt = sizeof(struct nvme_namespace_data);
+ cdai->provsiz = amt;
+ if (amt > cdai->bufsiz)
+ amt = cdai->bufsiz;
+ memcpy(cdai->buf, device->nvme_data, amt);
+ break;
default:
return;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 23, 11:42 AM (18 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29238551
Default Alt Text
D10466.1784806954.diff (5 KB)
Attached To
Mode
D10466: Fix NVMe's use of XPT_GDEV_TYPE
Attached
Detach File
Event Timeline
Log In to Comment