Lines Matching refs:afu

28 #define CXL_AFU_MINOR_D(afu) (CXL_CARD_MINOR(afu->adapter) + 1 + (3 * afu->slice))
29 #define CXL_AFU_MINOR_M(afu) (CXL_AFU_MINOR_D(afu) + 1)
30 #define CXL_AFU_MINOR_S(afu) (CXL_AFU_MINOR_D(afu) + 2)
31 #define CXL_AFU_MKDEV_D(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_D(afu))
32 #define CXL_AFU_MKDEV_M(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_M(afu))
33 #define CXL_AFU_MKDEV_S(afu) MKDEV(MAJOR(cxl_dev), CXL_AFU_MINOR_S(afu))
44 struct cxl_afu *afu;
50 pr_devel("afu_open afu%i.%i\n", slice, adapter_num);
59 if (!(afu = adapter->afu[slice])) {
65 * taking a ref to the afu so that it doesn't go away
69 cxl_afu_get(afu);
72 if (!afu->current_mode)
75 if (!cxl_ops->link_ok(adapter, afu)) {
85 rc = cxl_context_init(ctx, afu, master);
99 cxl_afu_put(afu);
177 work.num_interrupts = ctx->afu->pp_irqs;
178 else if ((work.num_interrupts < ctx->afu->pp_irqs) ||
179 (work.num_interrupts > ctx->afu->irqs_max)) {
199 rc = cxl_adapter_context_get(ctx->afu->adapter);
254 cxl_adapter_context_put(ctx->afu->adapter);
294 afuid.card_id = ctx->afu->adapter->adapter_num;
295 afuid.afu_offset = ctx->afu->slice;
296 afuid.afu_mode = ctx->afu->current_mode;
298 /* set the flag bit in case the afu is a slave */
299 if (ctx->afu->current_mode == CXL_MODE_DIRECTED && !ctx->master)
315 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
345 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
432 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
445 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) {
493 pr_devel("afu_read delivering afu error\n");
565 static int cxl_add_chardev(struct cxl_afu *afu, dev_t devt, struct cdev *cdev,
575 dev_err(&afu->dev, "Unable to add %s chardev: %i\n", desc, rc);
579 dev = device_create(&cxl_class, &afu->dev, devt, afu,
580 "afu%i.%i%s", afu->adapter->adapter_num, afu->slice, postfix);
583 dev_err(&afu->dev, "Unable to create %s chardev in sysfs: %i\n", desc, rc);
595 int cxl_chardev_d_afu_add(struct cxl_afu *afu)
597 return cxl_add_chardev(afu, CXL_AFU_MKDEV_D(afu), &afu->afu_cdev_d,
598 &afu->chardev_d, "d", "dedicated",
602 int cxl_chardev_m_afu_add(struct cxl_afu *afu)
604 return cxl_add_chardev(afu, CXL_AFU_MKDEV_M(afu), &afu->afu_cdev_m,
605 &afu->chardev_m, "m", "master",
609 int cxl_chardev_s_afu_add(struct cxl_afu *afu)
611 return cxl_add_chardev(afu, CXL_AFU_MKDEV_S(afu), &afu->afu_cdev_s,
612 &afu->chardev_s, "s", "shared",
616 void cxl_chardev_afu_remove(struct cxl_afu *afu)
618 if (afu->chardev_d) {
619 cdev_del(&afu->afu_cdev_d);
620 device_unregister(afu->chardev_d);
621 afu->chardev_d = NULL;
623 if (afu->chardev_m) {
624 cdev_del(&afu->afu_cdev_m);
625 device_unregister(afu->chardev_m);
626 afu->chardev_m = NULL;
628 if (afu->chardev_s) {
629 cdev_del(&afu->afu_cdev_s);
630 device_unregister(afu->chardev_s);
631 afu->chardev_s = NULL;
635 int cxl_register_afu(struct cxl_afu *afu)
637 afu->dev.class = &cxl_class;
639 return device_register(&afu->dev);