• Home
  • Raw
  • Download

Lines Matching +full:hi +full:- +full:fi

1 // SPDX-License-Identifier: GPL-2.0
16 #include <linux/io-64-nonatomic-lo-hi.h>
65 return ERR_PTR(-ENOMEM); in stuser_create()
67 get_device(&stdev->dev); in stuser_create()
68 stuser->stdev = stdev; in stuser_create()
69 kref_init(&stuser->kref); in stuser_create()
70 INIT_LIST_HEAD(&stuser->list); in stuser_create()
71 init_completion(&stuser->comp); in stuser_create()
72 stuser->event_cnt = atomic_read(&stdev->event_cnt); in stuser_create()
74 dev_dbg(&stdev->dev, "%s: %p\n", __func__, stuser); in stuser_create()
85 dev_dbg(&stuser->stdev->dev, "%s: %p\n", __func__, stuser); in stuser_free()
87 put_device(&stuser->stdev->dev); in stuser_free()
93 kref_put(&stuser->kref, stuser_free); in stuser_put()
108 stuser->state = state; in stuser_set_state()
110 dev_dbg(&stuser->stdev->dev, "stuser state %p -> %s", in stuser_set_state()
122 if (stdev->mrpc_busy) in mrpc_cmd_submit()
125 if (list_empty(&stdev->mrpc_queue)) in mrpc_cmd_submit()
128 stuser = list_entry(stdev->mrpc_queue.next, struct switchtec_user, in mrpc_cmd_submit()
132 stdev->mrpc_busy = 1; in mrpc_cmd_submit()
133 memcpy_toio(&stdev->mmio_mrpc->input_data, in mrpc_cmd_submit()
134 stuser->data, stuser->data_len); in mrpc_cmd_submit()
135 iowrite32(stuser->cmd, &stdev->mmio_mrpc->cmd); in mrpc_cmd_submit()
137 schedule_delayed_work(&stdev->mrpc_timeout, in mrpc_cmd_submit()
145 struct switchtec_dev *stdev = stuser->stdev; in mrpc_queue_cmd()
147 kref_get(&stuser->kref); in mrpc_queue_cmd()
148 stuser->read_len = sizeof(stuser->data); in mrpc_queue_cmd()
150 reinit_completion(&stuser->comp); in mrpc_queue_cmd()
151 list_add_tail(&stuser->list, &stdev->mrpc_queue); in mrpc_queue_cmd()
163 if (list_empty(&stdev->mrpc_queue)) in mrpc_complete_cmd()
166 stuser = list_entry(stdev->mrpc_queue.next, struct switchtec_user, in mrpc_complete_cmd()
169 stuser->status = ioread32(&stdev->mmio_mrpc->status); in mrpc_complete_cmd()
170 if (stuser->status == SWITCHTEC_MRPC_STATUS_INPROGRESS) in mrpc_complete_cmd()
174 stuser->return_code = 0; in mrpc_complete_cmd()
176 if (stuser->status != SWITCHTEC_MRPC_STATUS_DONE) in mrpc_complete_cmd()
179 stuser->return_code = ioread32(&stdev->mmio_mrpc->ret_value); in mrpc_complete_cmd()
180 if (stuser->return_code != 0) in mrpc_complete_cmd()
183 memcpy_fromio(stuser->data, &stdev->mmio_mrpc->output_data, in mrpc_complete_cmd()
184 stuser->read_len); in mrpc_complete_cmd()
187 complete_all(&stuser->comp); in mrpc_complete_cmd()
188 list_del_init(&stuser->list); in mrpc_complete_cmd()
190 stdev->mrpc_busy = 0; in mrpc_complete_cmd()
201 dev_dbg(&stdev->dev, "%s\n", __func__); in mrpc_event_work()
203 mutex_lock(&stdev->mrpc_mutex); in mrpc_event_work()
204 cancel_delayed_work(&stdev->mrpc_timeout); in mrpc_event_work()
206 mutex_unlock(&stdev->mrpc_mutex); in mrpc_event_work()
216 dev_dbg(&stdev->dev, "%s\n", __func__); in mrpc_timeout_work()
218 mutex_lock(&stdev->mrpc_mutex); in mrpc_timeout_work()
220 status = ioread32(&stdev->mmio_mrpc->status); in mrpc_timeout_work()
222 schedule_delayed_work(&stdev->mrpc_timeout, in mrpc_timeout_work()
230 mutex_unlock(&stdev->mrpc_mutex); in mrpc_timeout_work()
239 ver = ioread32(&stdev->mmio_sys_info->device_version); in device_version_show()
251 ver = ioread32(&stdev->mmio_sys_info->firmware_version); in fw_version_show()
265 for (i = len - 1; i > 0; i--) { in io_string_show()
280 return io_string_show(buf, &stdev->mmio_sys_info->field, \
281 sizeof(stdev->mmio_sys_info->field)); \
295 int id = ioread16(&stdev->mmio_sys_info->component_id); in component_id_show()
305 int rev = ioread8(&stdev->mmio_sys_info->component_revision); in component_revision_show()
316 return sprintf(buf, "%d\n", stdev->partition); in partition_show()
325 return sprintf(buf, "%d\n", stdev->partition_count); in partition_count_show()
350 stdev = container_of(inode->i_cdev, struct switchtec_dev, cdev); in switchtec_dev_open()
356 filp->private_data = stuser; in switchtec_dev_open()
359 dev_dbg(&stdev->dev, "%s: %p\n", __func__, stuser); in switchtec_dev_open()
366 struct switchtec_user *stuser = filp->private_data; in switchtec_dev_release()
375 if (mutex_lock_interruptible(&stdev->mrpc_mutex)) in lock_mutex_and_test_alive()
376 return -EINTR; in lock_mutex_and_test_alive()
378 if (!stdev->alive) { in lock_mutex_and_test_alive()
379 mutex_unlock(&stdev->mrpc_mutex); in lock_mutex_and_test_alive()
380 return -ENODEV; in lock_mutex_and_test_alive()
389 struct switchtec_user *stuser = filp->private_data; in switchtec_dev_write()
390 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_write()
393 if (size < sizeof(stuser->cmd) || in switchtec_dev_write()
394 size > sizeof(stuser->cmd) + sizeof(stuser->data)) in switchtec_dev_write()
395 return -EINVAL; in switchtec_dev_write()
397 stuser->data_len = size - sizeof(stuser->cmd); in switchtec_dev_write()
403 if (stuser->state != MRPC_IDLE) { in switchtec_dev_write()
404 rc = -EBADE; in switchtec_dev_write()
408 rc = copy_from_user(&stuser->cmd, data, sizeof(stuser->cmd)); in switchtec_dev_write()
410 rc = -EFAULT; in switchtec_dev_write()
414 data += sizeof(stuser->cmd); in switchtec_dev_write()
415 rc = copy_from_user(&stuser->data, data, size - sizeof(stuser->cmd)); in switchtec_dev_write()
417 rc = -EFAULT; in switchtec_dev_write()
424 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_write()
435 struct switchtec_user *stuser = filp->private_data; in switchtec_dev_read()
436 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_read()
439 if (size < sizeof(stuser->cmd) || in switchtec_dev_read()
440 size > sizeof(stuser->cmd) + sizeof(stuser->data)) in switchtec_dev_read()
441 return -EINVAL; in switchtec_dev_read()
447 if (stuser->state == MRPC_IDLE) { in switchtec_dev_read()
448 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
449 return -EBADE; in switchtec_dev_read()
452 stuser->read_len = size - sizeof(stuser->return_code); in switchtec_dev_read()
454 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
456 if (filp->f_flags & O_NONBLOCK) { in switchtec_dev_read()
457 if (!try_wait_for_completion(&stuser->comp)) in switchtec_dev_read()
458 return -EAGAIN; in switchtec_dev_read()
460 rc = wait_for_completion_interruptible(&stuser->comp); in switchtec_dev_read()
469 if (stuser->state != MRPC_DONE) { in switchtec_dev_read()
470 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
471 return -EBADE; in switchtec_dev_read()
474 rc = copy_to_user(data, &stuser->return_code, in switchtec_dev_read()
475 sizeof(stuser->return_code)); in switchtec_dev_read()
477 rc = -EFAULT; in switchtec_dev_read()
481 data += sizeof(stuser->return_code); in switchtec_dev_read()
482 rc = copy_to_user(data, &stuser->data, in switchtec_dev_read()
483 size - sizeof(stuser->return_code)); in switchtec_dev_read()
485 rc = -EFAULT; in switchtec_dev_read()
492 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
494 if (stuser->status == SWITCHTEC_MRPC_STATUS_DONE) in switchtec_dev_read()
496 else if (stuser->status == SWITCHTEC_MRPC_STATUS_INTERRUPTED) in switchtec_dev_read()
497 return -ENXIO; in switchtec_dev_read()
499 return -EBADMSG; in switchtec_dev_read()
504 struct switchtec_user *stuser = filp->private_data; in switchtec_dev_poll()
505 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_poll()
508 poll_wait(filp, &stuser->comp.wait, wait); in switchtec_dev_poll()
509 poll_wait(filp, &stdev->event_wq, wait); in switchtec_dev_poll()
514 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_poll()
516 if (try_wait_for_completion(&stuser->comp)) in switchtec_dev_poll()
519 if (stuser->event_cnt != atomic_read(&stdev->event_cnt)) in switchtec_dev_poll()
529 struct flash_info_regs __iomem *fi = stdev->mmio_flash_info; in ioctl_flash_info() local
531 info.flash_length = ioread32(&fi->flash_length); in ioctl_flash_info()
535 return -EFAULT; in ioctl_flash_info()
543 info->address = ioread32(&pi->address); in set_fw_info_part()
544 info->length = ioread32(&pi->length); in set_fw_info_part()
551 struct flash_info_regs __iomem *fi = stdev->mmio_flash_info; in ioctl_flash_part_info() local
552 struct sys_info_regs __iomem *si = stdev->mmio_sys_info; in ioctl_flash_part_info()
553 u32 active_addr = -1; in ioctl_flash_part_info()
556 return -EFAULT; in ioctl_flash_part_info()
560 active_addr = ioread32(&fi->active_cfg); in ioctl_flash_part_info()
561 set_fw_info_part(&info, &fi->cfg0); in ioctl_flash_part_info()
562 if (ioread16(&si->cfg_running) == SWITCHTEC_CFG0_RUNNING) in ioctl_flash_part_info()
566 active_addr = ioread32(&fi->active_cfg); in ioctl_flash_part_info()
567 set_fw_info_part(&info, &fi->cfg1); in ioctl_flash_part_info()
568 if (ioread16(&si->cfg_running) == SWITCHTEC_CFG1_RUNNING) in ioctl_flash_part_info()
572 active_addr = ioread32(&fi->active_img); in ioctl_flash_part_info()
573 set_fw_info_part(&info, &fi->img0); in ioctl_flash_part_info()
574 if (ioread16(&si->img_running) == SWITCHTEC_IMG0_RUNNING) in ioctl_flash_part_info()
578 active_addr = ioread32(&fi->active_img); in ioctl_flash_part_info()
579 set_fw_info_part(&info, &fi->img1); in ioctl_flash_part_info()
580 if (ioread16(&si->img_running) == SWITCHTEC_IMG1_RUNNING) in ioctl_flash_part_info()
584 set_fw_info_part(&info, &fi->nvlog); in ioctl_flash_part_info()
587 set_fw_info_part(&info, &fi->vendor[0]); in ioctl_flash_part_info()
590 set_fw_info_part(&info, &fi->vendor[1]); in ioctl_flash_part_info()
593 set_fw_info_part(&info, &fi->vendor[2]); in ioctl_flash_part_info()
596 set_fw_info_part(&info, &fi->vendor[3]); in ioctl_flash_part_info()
599 set_fw_info_part(&info, &fi->vendor[4]); in ioctl_flash_part_info()
602 set_fw_info_part(&info, &fi->vendor[5]); in ioctl_flash_part_info()
605 set_fw_info_part(&info, &fi->vendor[6]); in ioctl_flash_part_info()
608 set_fw_info_part(&info, &fi->vendor[7]); in ioctl_flash_part_info()
611 return -EINVAL; in ioctl_flash_part_info()
618 return -EFAULT; in ioctl_flash_part_info()
631 s.global = ioread32(&stdev->mmio_sw_event->global_summary); in ioctl_event_summary()
632 s.part_bitmap = readq(&stdev->mmio_sw_event->part_event_bitmap); in ioctl_event_summary()
633 s.local_part = ioread32(&stdev->mmio_part_cfg->part_event_summary); in ioctl_event_summary()
635 for (i = 0; i < stdev->partition_count; i++) { in ioctl_event_summary()
636 reg = ioread32(&stdev->mmio_part_cfg_all[i].part_event_summary); in ioctl_event_summary()
641 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id); in ioctl_event_summary()
645 reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary); in ioctl_event_summary()
650 return -EFAULT; in ioctl_event_summary()
652 stuser->event_cnt = atomic_read(&stdev->event_cnt); in ioctl_event_summary()
660 return (void __iomem *)stdev->mmio_sw_event + offset; in global_ev_reg()
666 return (void __iomem *)&stdev->mmio_part_cfg_all[index] + offset; in part_ev_reg()
672 return (void __iomem *)&stdev->mmio_pff_csr[index] + offset; in pff_ev_reg()
724 return ERR_PTR(-EINVAL); in event_hdr_addr()
730 index = stdev->partition; in event_hdr_addr()
731 else if (index < 0 || index >= stdev->partition_count) in event_hdr_addr()
732 return ERR_PTR(-EINVAL); in event_hdr_addr()
734 if (index < 0 || index >= stdev->pff_csr_count) in event_hdr_addr()
735 return ERR_PTR(-EINVAL); in event_hdr_addr()
748 reg = event_hdr_addr(stdev, ctl->event_id, ctl->index); in event_ctl()
753 for (i = 0; i < ARRAY_SIZE(ctl->data); i++) in event_ctl()
754 ctl->data[i] = ioread32(&reg[i + 1]); in event_ctl()
756 ctl->occurred = hdr & SWITCHTEC_EVENT_OCCURRED; in event_ctl()
757 ctl->count = (hdr >> 5) & 0xFF; in event_ctl()
759 if (!(ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR)) in event_ctl()
761 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL) in event_ctl()
763 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_DIS_POLL) in event_ctl()
765 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_EN_LOG) in event_ctl()
767 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_DIS_LOG) in event_ctl()
769 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_EN_CLI) in event_ctl()
771 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_DIS_CLI) in event_ctl()
773 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_EN_FATAL) in event_ctl()
775 if (ctl->flags & SWITCHTEC_IOCTL_EVENT_FLAG_DIS_FATAL) in event_ctl()
778 if (ctl->flags) in event_ctl()
781 ctl->flags = 0; in event_ctl()
783 ctl->flags |= SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL; in event_ctl()
785 ctl->flags |= SWITCHTEC_IOCTL_EVENT_FLAG_EN_LOG; in event_ctl()
787 ctl->flags |= SWITCHTEC_IOCTL_EVENT_FLAG_EN_CLI; in event_ctl()
789 ctl->flags |= SWITCHTEC_IOCTL_EVENT_FLAG_EN_FATAL; in event_ctl()
803 return -EFAULT; in ioctl_event_ctl()
806 return -EINVAL; in ioctl_event_ctl()
809 return -EINVAL; in ioctl_event_ctl()
815 nr_idxs = stdev->partition_count; in ioctl_event_ctl()
817 nr_idxs = stdev->pff_csr_count; in ioctl_event_ctl()
819 return -EINVAL; in ioctl_event_ctl()
835 return -EFAULT; in ioctl_event_ctl()
849 return -EFAULT; in ioctl_pff_to_port()
851 p.port = -1; in ioctl_pff_to_port()
852 for (part = 0; part < stdev->partition_count; part++) { in ioctl_pff_to_port()
853 pcfg = &stdev->mmio_part_cfg_all[part]; in ioctl_pff_to_port()
856 reg = ioread32(&pcfg->usp_pff_inst_id); in ioctl_pff_to_port()
862 reg = ioread32(&pcfg->vep_pff_inst_id); in ioctl_pff_to_port()
868 for (i = 0; i < ARRAY_SIZE(pcfg->dsp_pff_inst_id); i++) { in ioctl_pff_to_port()
869 reg = ioread32(&pcfg->dsp_pff_inst_id[i]); in ioctl_pff_to_port()
877 if (p.port != -1) in ioctl_pff_to_port()
882 return -EFAULT; in ioctl_pff_to_port()
894 return -EFAULT; in ioctl_port_to_pff()
897 pcfg = stdev->mmio_part_cfg; in ioctl_port_to_pff()
898 else if (p.partition < stdev->partition_count) in ioctl_port_to_pff()
899 pcfg = &stdev->mmio_part_cfg_all[p.partition]; in ioctl_port_to_pff()
901 return -EINVAL; in ioctl_port_to_pff()
905 p.pff = ioread32(&pcfg->usp_pff_inst_id); in ioctl_port_to_pff()
908 p.pff = ioread32(&pcfg->vep_pff_inst_id); in ioctl_port_to_pff()
911 if (p.port > ARRAY_SIZE(pcfg->dsp_pff_inst_id)) in ioctl_port_to_pff()
912 return -EINVAL; in ioctl_port_to_pff()
914 ARRAY_SIZE(pcfg->dsp_pff_inst_id) + 1); in ioctl_port_to_pff()
915 p.pff = ioread32(&pcfg->dsp_pff_inst_id[p.port - 1]); in ioctl_port_to_pff()
920 return -EFAULT; in ioctl_port_to_pff()
928 struct switchtec_user *stuser = filp->private_data; in switchtec_dev_ioctl()
929 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_ioctl()
957 rc = -ENOTTY; in switchtec_dev_ioctl()
961 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_ioctl()
982 if (stdev->link_notifier) in link_event_work()
983 stdev->link_notifier(stdev); in link_event_work()
993 for (idx = 0; idx < stdev->pff_csr_count; idx++) { in check_link_state_events()
994 reg = ioread32(&stdev->mmio_pff_csr[idx].link_state_hdr); in check_link_state_events()
995 dev_dbg(&stdev->dev, "link_state: %d->%08x\n", idx, reg); in check_link_state_events()
998 if (count != stdev->link_event_count[idx]) { in check_link_state_events()
1000 stdev->link_event_count[idx] = count; in check_link_state_events()
1005 schedule_work(&stdev->link_event_work); in check_link_state_events()
1012 for (idx = 0; idx < stdev->pff_csr_count; idx++) { in enable_link_state_events()
1015 &stdev->mmio_pff_csr[idx].link_state_hdr); in enable_link_state_events()
1030 pci_clear_master(stdev->pdev); in stdev_kill()
1032 cancel_delayed_work_sync(&stdev->mrpc_timeout); in stdev_kill()
1035 mutex_lock(&stdev->mrpc_mutex); in stdev_kill()
1036 stdev->alive = false; in stdev_kill()
1039 list_for_each_entry_safe(stuser, tmpuser, &stdev->mrpc_queue, list) { in stdev_kill()
1040 complete_all(&stuser->comp); in stdev_kill()
1041 list_del_init(&stuser->list); in stdev_kill()
1045 mutex_unlock(&stdev->mrpc_mutex); in stdev_kill()
1048 wake_up_interruptible(&stdev->event_wq); in stdev_kill()
1060 dev_to_node(&pdev->dev)); in stdev_create()
1062 return ERR_PTR(-ENOMEM); in stdev_create()
1064 stdev->alive = true; in stdev_create()
1065 stdev->pdev = pdev; in stdev_create()
1066 INIT_LIST_HEAD(&stdev->mrpc_queue); in stdev_create()
1067 mutex_init(&stdev->mrpc_mutex); in stdev_create()
1068 stdev->mrpc_busy = 0; in stdev_create()
1069 INIT_WORK(&stdev->mrpc_work, mrpc_event_work); in stdev_create()
1070 INIT_DELAYED_WORK(&stdev->mrpc_timeout, mrpc_timeout_work); in stdev_create()
1071 INIT_WORK(&stdev->link_event_work, link_event_work); in stdev_create()
1072 init_waitqueue_head(&stdev->event_wq); in stdev_create()
1073 atomic_set(&stdev->event_cnt, 0); in stdev_create()
1075 dev = &stdev->dev; in stdev_create()
1077 dev->class = switchtec_class; in stdev_create()
1078 dev->parent = &pdev->dev; in stdev_create()
1079 dev->groups = switchtec_device_groups; in stdev_create()
1080 dev->release = stdev_release; in stdev_create()
1089 dev->devt = MKDEV(MAJOR(switchtec_devt), minor); in stdev_create()
1092 cdev = &stdev->cdev; in stdev_create()
1094 cdev->owner = THIS_MODULE; in stdev_create()
1099 put_device(&stdev->dev); in stdev_create()
1119 dev_dbg(&stdev->dev, "%s: %d %d %x\n", __func__, eid, idx, hdr); in mask_event()
1132 for (idx = 0; idx < stdev->partition_count; idx++) in mask_all_events()
1135 for (idx = 0; idx < stdev->pff_csr_count; idx++) { in mask_all_events()
1136 if (!stdev->pff_local[idx]) in mask_all_events()
1155 reg = ioread32(&stdev->mmio_part_cfg->mrpc_comp_hdr); in switchtec_event_isr()
1157 dev_dbg(&stdev->dev, "%s: mrpc comp\n", __func__); in switchtec_event_isr()
1159 schedule_work(&stdev->mrpc_work); in switchtec_event_isr()
1160 iowrite32(reg, &stdev->mmio_part_cfg->mrpc_comp_hdr); in switchtec_event_isr()
1169 atomic_inc(&stdev->event_cnt); in switchtec_event_isr()
1170 wake_up_interruptible(&stdev->event_wq); in switchtec_event_isr()
1171 dev_dbg(&stdev->dev, "%s: %d events\n", __func__, in switchtec_event_isr()
1184 nvecs = pci_alloc_irq_vectors(stdev->pdev, 1, 4, in switchtec_init_isr()
1189 event_irq = ioread16(&stdev->mmio_part_cfg->vep_vector_number); in switchtec_init_isr()
1191 return -EFAULT; in switchtec_init_isr()
1193 event_irq = pci_irq_vector(stdev->pdev, event_irq); in switchtec_init_isr()
1197 return devm_request_irq(&stdev->pdev->dev, event_irq, in switchtec_init_isr()
1206 struct part_cfg_regs *pcfg = stdev->mmio_part_cfg; in init_pff()
1209 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id); in init_pff()
1214 stdev->pff_csr_count = i; in init_pff()
1216 reg = ioread32(&pcfg->usp_pff_inst_id); in init_pff()
1218 stdev->pff_local[reg] = 1; in init_pff()
1220 reg = ioread32(&pcfg->vep_pff_inst_id); in init_pff()
1222 stdev->pff_local[reg] = 1; in init_pff()
1224 for (i = 0; i < ARRAY_SIZE(pcfg->dsp_pff_inst_id); i++) { in init_pff()
1225 reg = ioread32(&pcfg->dsp_pff_inst_id[i]); in init_pff()
1227 stdev->pff_local[reg] = 1; in init_pff()
1246 stdev->mmio = pcim_iomap_table(pdev)[0]; in switchtec_init_pci()
1247 stdev->mmio_mrpc = stdev->mmio + SWITCHTEC_GAS_MRPC_OFFSET; in switchtec_init_pci()
1248 stdev->mmio_sw_event = stdev->mmio + SWITCHTEC_GAS_SW_EVENT_OFFSET; in switchtec_init_pci()
1249 stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; in switchtec_init_pci()
1250 stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET; in switchtec_init_pci()
1251 stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET; in switchtec_init_pci()
1252 stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id); in switchtec_init_pci()
1253 stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count); in switchtec_init_pci()
1254 stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET; in switchtec_init_pci()
1255 stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition]; in switchtec_init_pci()
1256 stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET; in switchtec_init_pci()
1258 if (stdev->partition_count < 1) in switchtec_init_pci()
1259 stdev->partition_count = 1; in switchtec_init_pci()
1274 if (pdev->class == (PCI_CLASS_BRIDGE_OTHER << 8)) in switchtec_pci_probe()
1287 dev_err(&stdev->dev, "failed to init isr.\n"); in switchtec_pci_probe()
1293 &stdev->mmio_part_cfg->mrpc_comp_hdr); in switchtec_pci_probe()
1296 rc = cdev_device_add(&stdev->cdev, &stdev->dev); in switchtec_pci_probe()
1300 dev_info(&stdev->dev, "Management device registered.\n"); in switchtec_pci_probe()
1307 ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); in switchtec_pci_probe()
1308 put_device(&stdev->dev); in switchtec_pci_probe()
1318 cdev_device_del(&stdev->cdev, &stdev->dev); in switchtec_pci_remove()
1319 ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); in switchtec_pci_remove()
1320 dev_info(&stdev->dev, "unregistered.\n"); in switchtec_pci_remove()
1323 put_device(&stdev->dev); in switchtec_pci_remove()