Lines Matching refs:afu

28 #define CXL_AFU_MINOR_D(afu) (CXL_CARD_MINOR(afu->adapter) + 1 + (3 * afu->slice))  argument
29 #define CXL_AFU_MINOR_M(afu) (CXL_AFU_MINOR_D(afu) + 1) argument
30 #define CXL_AFU_MINOR_S(afu) (CXL_AFU_MINOR_D(afu) + 2) argument
31 #define CXL_AFU_MKDEV_D(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_D(afu)) argument
32 #define CXL_AFU_MKDEV_M(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_M(afu)) argument
33 #define CXL_AFU_MKDEV_S(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_S(afu)) argument
46 struct cxl_afu *afu; in __afu_open() local
61 if (!(afu = adapter->afu[slice])) { in __afu_open()
71 cxl_afu_get(afu); in __afu_open()
74 if (!afu->current_mode) in __afu_open()
77 if (!cxl_ops->link_ok(adapter, afu)) { in __afu_open()
87 rc = cxl_context_init(ctx, afu, master); in __afu_open()
101 cxl_afu_put(afu); in __afu_open()
179 work.num_interrupts = ctx->afu->pp_irqs; in afu_ioctl_start_work()
180 else if ((work.num_interrupts < ctx->afu->pp_irqs) || in afu_ioctl_start_work()
181 (work.num_interrupts > ctx->afu->irqs_max)) { in afu_ioctl_start_work()
201 rc = cxl_adapter_context_get(ctx->afu->adapter); in afu_ioctl_start_work()
256 cxl_adapter_context_put(ctx->afu->adapter); in afu_ioctl_start_work()
296 afuid.card_id = ctx->afu->adapter->adapter_num; in afu_ioctl_get_afu_id()
297 afuid.afu_offset = ctx->afu->slice; in afu_ioctl_get_afu_id()
298 afuid.afu_mode = ctx->afu->current_mode; in afu_ioctl_get_afu_id()
301 if (ctx->afu->current_mode == CXL_MODE_DIRECTED && !ctx->master) in afu_ioctl_get_afu_id()
317 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) in afu_ioctl()
347 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) in afu_mmap()
434 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) in afu_read()
447 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) { in afu_read()
564 static int cxl_add_chardev(struct cxl_afu *afu, dev_t devt, struct cdev *cdev, in cxl_add_chardev() argument
574 dev_err(&afu->dev, "Unable to add %s chardev: %i\n", desc, rc); in cxl_add_chardev()
578 dev = device_create(cxl_class, &afu->dev, devt, afu, in cxl_add_chardev()
579 "afu%i.%i%s", afu->adapter->adapter_num, afu->slice, postfix); in cxl_add_chardev()
582 dev_err(&afu->dev, "Unable to create %s chardev in sysfs: %i\n", desc, rc); in cxl_add_chardev()
594 int cxl_chardev_d_afu_add(struct cxl_afu *afu) in cxl_chardev_d_afu_add() argument
596 return cxl_add_chardev(afu, CXL_AFU_MKDEV_D(afu), &afu->afu_cdev_d, in cxl_chardev_d_afu_add()
597 &afu->chardev_d, "d", "dedicated", in cxl_chardev_d_afu_add()
601 int cxl_chardev_m_afu_add(struct cxl_afu *afu) in cxl_chardev_m_afu_add() argument
603 return cxl_add_chardev(afu, CXL_AFU_MKDEV_M(afu), &afu->afu_cdev_m, in cxl_chardev_m_afu_add()
604 &afu->chardev_m, "m", "master", in cxl_chardev_m_afu_add()
608 int cxl_chardev_s_afu_add(struct cxl_afu *afu) in cxl_chardev_s_afu_add() argument
610 return cxl_add_chardev(afu, CXL_AFU_MKDEV_S(afu), &afu->afu_cdev_s, in cxl_chardev_s_afu_add()
611 &afu->chardev_s, "s", "shared", in cxl_chardev_s_afu_add()
615 void cxl_chardev_afu_remove(struct cxl_afu *afu) in cxl_chardev_afu_remove() argument
617 if (afu->chardev_d) { in cxl_chardev_afu_remove()
618 cdev_del(&afu->afu_cdev_d); in cxl_chardev_afu_remove()
619 device_unregister(afu->chardev_d); in cxl_chardev_afu_remove()
620 afu->chardev_d = NULL; in cxl_chardev_afu_remove()
622 if (afu->chardev_m) { in cxl_chardev_afu_remove()
623 cdev_del(&afu->afu_cdev_m); in cxl_chardev_afu_remove()
624 device_unregister(afu->chardev_m); in cxl_chardev_afu_remove()
625 afu->chardev_m = NULL; in cxl_chardev_afu_remove()
627 if (afu->chardev_s) { in cxl_chardev_afu_remove()
628 cdev_del(&afu->afu_cdev_s); in cxl_chardev_afu_remove()
629 device_unregister(afu->chardev_s); in cxl_chardev_afu_remove()
630 afu->chardev_s = NULL; in cxl_chardev_afu_remove()
634 int cxl_register_afu(struct cxl_afu *afu) in cxl_register_afu() argument
636 afu->dev.class = cxl_class; in cxl_register_afu()
638 return device_register(&afu->dev); in cxl_register_afu()