Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/nvme/nvme.h
Show First 20 Lines • Show All 1,390 Lines • ▼ Show 20 Lines | struct nvme_command_effects_page { | ||||
uint32_t acs[256]; | uint32_t acs[256]; | ||||
uint32_t iocs[256]; | uint32_t iocs[256]; | ||||
uint8_t reserved[2048]; | uint8_t reserved[2048]; | ||||
} __packed __aligned(4); | } __packed __aligned(4); | ||||
_Static_assert(sizeof(struct nvme_command_effects_page) == 4096, | _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, | ||||
"bad size for nvme_command_effects_page"); | "bad size for nvme_command_effects_page"); | ||||
struct nvme_device_self_test_page { | |||||
uint8_t curr_operation; | |||||
uint8_t curr_compl; | |||||
uint8_t rsvd2[2]; | |||||
struct { | |||||
uint8_t status; | |||||
uint8_t segment_num; | |||||
uint8_t valid_diag_info; | |||||
uint8_t rsvd3; | |||||
uint64_t poh; | |||||
uint32_t nsid; | |||||
uint64_t failing_lba; | |||||
uint8_t status_code_type; | |||||
uint8_t status_code; | |||||
uint8_t vendor_specific[2]; | |||||
} __packed __aligned(4) result[20]; | |||||
} __packed __aligned(4); | |||||
_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, | |||||
"bad size for nvme_device_self_test_page"); | |||||
struct nvme_res_notification_page { | struct nvme_res_notification_page { | ||||
uint64_t log_page_count; | uint64_t log_page_count; | ||||
uint8_t log_page_type; | uint8_t log_page_type; | ||||
uint8_t available_log_pages; | uint8_t available_log_pages; | ||||
uint8_t reserved2; | uint8_t reserved2; | ||||
uint32_t nsid; | uint32_t nsid; | ||||
uint8_t reserved[48]; | uint8_t reserved[48]; | ||||
} __packed __aligned(4); | } __packed __aligned(4); | ||||
▲ Show 20 Lines • Show All 604 Lines • ▼ Show 20 Lines | #if _BYTE_ORDER != _LITTLE_ENDIAN | ||||
for (i = 0; i < n; i++) { | for (i = 0; i < n; i++) { | ||||
s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id); | s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id); | ||||
s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); | s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); | ||||
nvme_le128toh((void *)s->ctrlr[i].hostid); | nvme_le128toh((void *)s->ctrlr[i].hostid); | ||||
} | } | ||||
#endif | #endif | ||||
} | } | ||||
static inline void | |||||
nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) | |||||
{ | |||||
#if _BYTE_ORDER != _LITTLE_ENDIAN | |||||
uint32_t r; | |||||
for (r = 0; r < 20; r++) { | |||||
s->result[r].poh = le64toh(s->result[r].poh); | |||||
s->result[r].nsid = le32toh(s->result[r].nsid); | |||||
s->result[r].failing_lba = le64toh(s->result[r].failing_lba); | |||||
} | |||||
#endif | |||||
} | |||||
#endif /* __NVME_H__ */ | #endif /* __NVME_H__ */ |