Alex Martir
|
Re: RE: Read Temperature of NVMe SSD Drive over PCIe (QNX7.0)
|
Alex Martir
11/02/2020 3:10 PM
post121055
|
Re: RE: Read Temperature of NVMe SSD Drive over PCIe (QNX7.0)
Hello there and thank you for the answers!
I am currently looking into devctl() per your suggestion. I found an interesting header for linux (nvme_ioctl.h) where
they define ioctl's for NVME ADMIN commands (which is exactly what I need), but I am not sure if something analogous is
supported in QNX. I am trying something like the following (with devctl)
// --> Pseudocode-ish
// Not sure about this define (I couldn't find a suitable device class, so chose _DCMD_CAM for now)
// 0x41 is opcode for ADMIN_CMD (according to NVME spec)
// nvme_admin_cmd structure is defined by NVME spec
#define NVME_IOCTL_ADMIN_CMD __DIOTF(_DCMD_CAM, 0x41, struct nvme_admin_cmd)
// Open file descriptor to NVME SSD
int fd = open("/dev/hd0", O_RDWR);
if(fd < 0)
return -1;
uint8_t buffer[512]; // This buffer will hold our device reply (expect 512 bytes for Vendor Log Page)
struct nvme_admin_cmd cmd;
memset(&cmd, 0, sizeof(cmd));
// Assemble ADMIN command
cmd.opcode = 0x02; // Get Vendor Log Page command
cmd.data_length = 512; // The SSD returns 512 bytes
cmd.addr = (int)buffer;
int error = devctl(fd, NVME_IOCTL_ADMIN_CMD, &cmd, sizeof(cmd), nullptr);
if(error)
cout << "Error sending ADMIN cmd to NVME drive";
// ...
. Am I heading in the right direction here?
. Is there any NVMe command support for QNX? (Similar to Linux)
. Should the device class above be different (using CAM class, dcmd_cam.h)
. Any advise/suggestions is very appreciated!
Thanks!
|
|
|