41 #if defined(OCS_ENABLE_ECD_HELPER)
66 buf = (
ocs_ioctl_test_t *)ocs_ioctl_preprocess(ocs, (
void *)arg,
sizeof(*buf));
68 ocs_log_test(ocs,
"copy from user failed\n");
72 ocs_log_debug(ocs,
"CMD_TEST: %s\n", buf->
string);
75 rc = ocs_ioctl_postprocess(ocs, (
void *)arg, buf,
sizeof(*buf));
77 ocs_log_test(ocs,
"Error: copy to user failed: %d\n", rc);
88 ocs_log_test(ocs,
"Error: copy from user failed\n");
96 if (ocs_ioctl_postprocess(ocs, (
void *)arg, mcmd,
sizeof(*mcmd))) {
97 ocs_log_test(ocs,
"Error: copy to user failed\n");
101 ocs_ioctl_free(ocs, mcmd,
sizeof(*mcmd));
109 uint8_t *pserial, *pvpd;
114 ocs_log_test(ocs,
"Can't get VPD length\n");
120 ocs_log_test(ocs,
"Error: copy from user failed\n");
128 ocs_strncpy(info->
desc, ocs->desc,
sizeof(info->
desc));
142 ocs_memcpy(info->
serialnum, pserial, len);
148 if (ocs_ioctl_postprocess(ocs, (
void*) arg, info,
sizeof(*info))) {
149 ocs_log_test(ocs,
"Error: copy to user failed\n");
157 char action_name[128];
161 ocs_log_test(ocs,
"Error: copy from user failed\n");
165 if (ocs_copy_from_user(action_name, req->
name,
sizeof(action_name))) {
166 ocs_log_test(ocs,
"Error: copy req.name from user failed\n");
167 ocs_ioctl_free(ocs, req,
sizeof(*req));
175 if (ocs_ioctl_postprocess(ocs, (
void*) arg, req,
sizeof(*req))) {
176 ocs_log_err(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
189 ocs_log_test(ocs,
"Error: ocs_copy from user failed\n");
195 ocs_log_err(ocs,
"Error: ocs_textbuf_alloc failed\n");
196 ocs_ioctl_free(ocs, req,
sizeof(*req));
204 ocs_log_test(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
209 if (ocs_ioctl_postprocess(ocs, (
void*) arg, req,
sizeof(*req))) {
210 ocs_log_test(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
229 ocs_log_test(ocs,
"Error: ocs_copy from user failed\n");
235 ocs_log_err(ocs,
"Error: ocs_textbuf_alloc failed\n");
236 ocs_ioctl_free(ocs, req,
sizeof(*req));
245 ocs_log_test(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
252 if (ocs_ioctl_postprocess(ocs, (
void*) arg, req,
sizeof(*req))) {
253 ocs_log_test(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
270 ocs_log_test(ocs,
"copy from user failed\n");
276 ocs_log_test(ocs,
"ocs_copy_from_user failed\n");
283 ocs_log_err(ocs,
"Error: ocs_textbuf_alloc failed\n");
290 ocs_log_err(ocs,
"ocs_mgmt_get %s failed with %d status\n", name, rc);
293 ocs_log_err(ocs,
"Device is busy in other operations");
297 ocs_log_test(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
314 req = ocs_ioctl_preprocess(ocs, (
void *)arg,
sizeof(*req));
316 ocs_log_test(ocs,
"Error: copy from user failed\n");
322 ocs_log_test(ocs,
"Error: copy from user failed\n");
323 ocs_ioctl_free(ocs, req,
sizeof(*req));
329 ocs_log_test(ocs,
"Error: copy from user failed\n");
330 ocs_ioctl_free(ocs, req,
sizeof(*req));
336 ocs_log_err(ocs,
"ocs_mgmt_set failed(%d) to set mgmt cmd: %s\n", req->
result, name);
337 if (req->
result == -EBUSY)
338 ocs_log_err(ocs,
"Device is busy in other operations");
341 if (ocs_ioctl_postprocess(ocs, (
void*) arg, req,
sizeof(*req))) {
342 ocs_log_test(ocs,
"Error: (%d) copy_to_user failed\n", __LINE__);
356 ocs_log_test(ocs,
"Error: ocs_copy from user failed\n");
370 ocs_log_debug(ocs,
"%sdriver dump, max buffer size %d\n",
376 ptbuf = &ocs->ddump_saved;
381 ocs_log_err(ocs,
"Error: ocs_textbuf_alloc failed\n");
382 ocs_ioctl_free(ocs, req,
sizeof(*req));
415 ocs_log_test(ocs,
"ocs_ddump failed\n");
425 for (idx = 0; remaining; idx++) {
430 if ((uint32_t)n >= remaining) {
431 n = (int32_t)remaining;
435 ocs_log_test(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
438 remaining -= (uint32_t)n;
442 if (ptbuf == &textbuf) {
451 ocs_log_err(ocs,
"Error: ocs_textbuf_alloc failed\n");
455 if (ocs_ioctl_postprocess(ocs, (
void*) arg, req,
sizeof(*req))) {
456 ocs_log_test(ocs,
"Error: (%d) ocs_copy_to_user failed\n", __LINE__);
465 #if defined(OCS_ENABLE_ECD_HELPER)
471 ocs_log_test(ocs,
"Error: copy from user failed\n");
475 req->
status = ocs_process_ecd_helper(ocs, req);
477 if (ocs_ioctl_postprocess(ocs, (
void*) arg, req,
sizeof(*req))) {
478 ocs_log_test(ocs,
"Error: copy to user failed\n");
486 #if defined(OCS_INCLUDE_WORKLOAD)
492 ocs_log_test(ocs,
"Error: OCS_IOCTL_CMD_SCSI_CMD: copy from user space failed\n");
496 rc = ocs_workload_run(ocs, cmd);
498 if (ocs_ioctl_postprocess(ocs, (
void*)arg, cmd,
sizeof(*cmd))) {
499 ocs_log_test(ocs,
"Error: OCS_IOCTL_CMD_SCSI_CMD: copy to user space failed\n");
506 #if defined(OCS_INCLUDE_FC)
511 cmd = ocs_ioctl_preprocess(ocs, (
void *)arg,
sizeof(*cmd));
514 ocs_workload_send_frame(ocs, cmd);
517 if (ocs_ioctl_postprocess(ocs, NULL, cmd,
sizeof(*cmd))) {
518 ocs_log_test(ocs,
"Error: OCS_IOCTL_CMD_SCSI_CMD: copy to user space failed\n");
547 #if defined(OCS_ENABLE_ECD_HELPER)
565 if (req->
bar >= PCI_MAX_BAR) {
566 ocs_log_test(ocs,
"Error: bar %d out of range\n", req->
bar);
569 if (ocs->ocs_os.reg[req->
bar] == NULL) {
570 ocs_log_test(ocs,
"Error: bar %d not defined\n", req->
bar);
573 pmem = ocs->ocs_os.reg[req->
bar] + req->
offset;
580 rc = pci_read_config_byte(ocs->ocs_os.pdev, req->
offset, &v8);
585 rc = pci_read_config_word(ocs->ocs_os.pdev, req->
offset, &v16);
590 rc = pci_read_config_dword(ocs->ocs_os.pdev, req->
offset, &v32);
595 rc = pci_write_config_byte(ocs->ocs_os.pdev, req->
offset, req->
data);
598 rc = pci_write_config_word(ocs->ocs_os.pdev, req->
offset, req->
data);
601 rc = pci_write_config_dword(ocs->ocs_os.pdev, req->
offset, req->
data);
604 req->
data = readb(pmem);
607 req->
data = readw(pmem);
610 req->
data = readl(pmem);
613 writeb(req->
data, pmem);
616 writew(req->
data, pmem);
619 writel(req->
data, pmem);
#define OCS_IOCTL_CMD_ELXU_MBOX
int ocs_ddump(ocs_t *ocs, ocs_textbuf_t *textbuf, uint32_t flags, uint32_t qentries)
Initiate ddump.
#define OCS_DDUMP_FLAGS_WQES
int32_t ocs_device_ioctl(ocs_t *ocs, unsigned int cmd, unsigned long arg)
ocs driver ioctl method
int ocs_mgmt_get(ocs_t *ocs, char *name, ocs_textbuf_t *textbuf)
Return the value of a management item.
int32_t ocs_textbuf_ext_get_written(ocs_textbuf_t *textbuf, uint32_t idx)
#define OCS_IOCTL_CMD_MGMT_SET
#define OCS_IOCTL_DDUMP_FLAGS_CQES
#define OCS_IOCTL_CMD_MGMT_GET
ocs_ioctl_ddump_arg_t args
int32_t ocs_elxu(ocs_t *ocs, ocs_ioctl_elxu_mbox_t *mcmd)
int ocs_mgmt_set(ocs_t *ocs, char *name, char *value)
Set the value of a mgmt item.
void ocs_info_get_xport_address(ocs_t *ocs, ocs_ioctl_driver_info_t *info)
Retrieve transport port address.
#define OCS_IOCTL_DDUMP_FLAGS_RQES
int32_t ocs_device_ioctl_xport(ocs_t *ocs, unsigned int cmd, unsigned long arg)
Perform transport specific ioctl operation.
int ocs_mgmt_exec(ocs_t *ocs, char *action, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length)
Perform a management action.
int32_t ocs_textbuf_get_written(ocs_textbuf_t *textbuf)
uint8_t * ocs_textbuf_get_buffer(ocs_textbuf_t *textbuf)
#define OCS_DDUMP_FLAGS_RQES
static uint8_t * ocs_find_vpd(uint8_t *vpddata, uint32_t vpddata_length, const char *key)
find a VPD entry
IOCTL_CMD_IOCTL_ELXU_MBOX ioctl structure.
void ocs_textbuf_free(ocs_t *ocs, ocs_textbuf_t *textbuf)
#define OCS_IOCTL_CMD_GET_DDUMP
#define OCS_IOCTL_CMD_DRIVER_INFO
#define OCS_IOCTL_CMD_ECD_HELPER
#define OCS_DDUMP_FLAGS_EQES
void ocs_mgmt_get_list(ocs_t *ocs, ocs_textbuf_t *textbuf)
Get a list of options supported by the driver.
int32_t ocs_clear_saved_ddump(ocs_t *ocs)
Clear saved ddump.
void ocs_mgmt_get_all(ocs_t *ocs, ocs_textbuf_t *textbuf)
#define OCS_IOCTL_DDUMP_FLAGS_MQES
ocs_hal_rtn_e ocs_hal_get(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t *value)
#define OCS_MGMT_MAX_VALUE
#define OCS_IOCTL_DDUMP_FLAGS_EQES
uint8_t * ocs_textbuf_ext_get_buffer(ocs_textbuf_t *textbuf, uint32_t idx)
#define OCS_IOCTL_CMD_MGMT_GET_ALL
#define OCS_IOCTL_CMD_MGMT_EXEC
OCS_CTL_CMD_GET_DDUMP ioctl structure.
#define OCS_MGMT_MAX_NAME
#define OCS_IOCTL_CMD_TEST
#define SLI4_INTF_REG
SLI_INTF - SLI Interface Definition Register.
#define OCS_IOCTL_CMD_SCSI_CMD
DRIVER_INFO ioctl structure.
ocs_ddump_action_t action
OCS_CTL_CMD_GET_STATUS, OCS_CTL_CMD_GET_CONFIG.
OCS_IOCTL_CMD_ECD_HELPER ioctl structure.
void ocs_textbuf_reset(ocs_textbuf_t *textbuf)
#define OCS_IOCTL_DDUMP_FLAGS_WQES
int32_t ocs_textbuf_alloc(ocs_t *ocs, ocs_textbuf_t *textbuf, uint32_t length)
void * ocs_hal_get_ptr(ocs_hal_t *hal, ocs_hal_property_e prop)
uint32_t ocs_textbuf_initialized(ocs_textbuf_t *textbuf)
#define OCS_DDUMP_FLAGS_CQES
#define OCS_IOCTL_CMD_SEND_FRAME
#define OCS_DDUMP_FLAGS_MQES
#define OCS_IOCTL_CMD_MGMT_LIST