1
2
3
4
5
6
7
8#ifndef AIE_INTERNAL_H
9#define AIE_INTERNAL_H
10
11#include <linux/bitfield.h>
12#include <linux/bitmap.h>
13#include <linux/bits.h>
14#include <linux/cdev.h>
15#include <linux/clk.h>
16#include <linux/device.h>
17#include <linux/dma-buf.h>
18#include <linux/file.h>
19#include <linux/fpga/fpga-bridge.h>
20#include <linux/io.h>
21#include <linux/interrupt.h>
22#include <linux/list.h>
23#include <linux/mutex.h>
24#include <linux/of.h>
25#include <linux/of_device.h>
26#include <linux/slab.h>
27#include <uapi/linux/xlnx-ai-engine.h>
28
29
30
31
32enum aie_tile_type {
33 AIE_TILE_TYPE_TILE,
34 AIE_TILE_TYPE_SHIMPL,
35 AIE_TILE_TYPE_SHIMNOC,
36 AIE_TILE_TYPE_MAX
37};
38
39#define AIE_TILE_TYPE_MASK_TILE BIT(AIE_TILE_TYPE_TILE)
40#define AIE_TILE_TYPE_MASK_SHIMPL BIT(AIE_TILE_TYPE_SHIMPL)
41
42#define AIE_TILE_TYPE_MASK_SHIMNOC BIT(AIE_TILE_TYPE_SHIMNOC)
43
44
45
46
47
48
49#define AIE_REGS_ATTR_TILE_TYPE_SHIFT 0U
50#define AIE_REGS_ATTR_PERM_SHIFT 8U
51#define AIE_REGS_ATTR_TILE_TYPE_MASK GENMASK(AIE_REGS_ATTR_PERM_SHIFT - 1, \
52 AIE_REGS_ATTR_TILE_TYPE_SHIFT)
53#define AIE_REGS_ATTR_PERM_MASK GENMASK(15, \
54 AIE_REGS_ATTR_PERM_SHIFT)
55
56#define AIE_PART_STATUS_BRIDGE_DISABLED 0x1U
57
58
59#define VERSAL_ES1_REV_ID 0x0
60#define VERSAL_ES2_REV_ID 0x1
61
62#define AIE_NPI_ERROR_ID BIT(1)
63
64
65#define AIE_INTR_L2_CTRL_MASK_WIDTH 32
66
67
68#define AIE_MAX_MODS_PER_TILE 2U
69
70
71#define AIE_CORE_REGS_STEP 0x10
72
73
74
75
76
77
78
79#define AIE_TILE_MOD_START AIE_MEM_MOD
80#define AIE_MOD_ID(T, M) ((M) - AIE_##T ## _MOD_START)
81#define AIE_TILE_MEM_MOD_ID AIE_MOD_ID(TILE, AIE_MEM_MOD)
82#define AIE_TILE_CORE_MOD_ID AIE_MOD_ID(TILE, AIE_CORE_MOD)
83#define AIE_SHIMPL_MOD_START AIE_PL_MOD
84#define AIE_SHIMNOC_MOD_START AIE_PL_MOD
85#define AIE_SHIM_PL_MOD_ID AIE_MOD_ID(SHIMPL, AIE_PL_MOD)
86#define AIE_SHIM_NOC_MOD_ID AIE_MOD_ID(SHIMNOC, AIE_NOC_MOD)
87
88
89#define DELIMITER_LEVEL0 "|"
90#define DELIMITER_LEVEL1 ", "
91#define DELIMITER_LEVEL2 "; "
92
93
94#define AIE_SYSFS_CORE_STS_SIZE 100U
95#define AIE_SYSFS_CHAN_STS_SIZE 150U
96#define AIE_SYSFS_QUEUE_SIZE_SIZE 40U
97#define AIE_SYSFS_QUEUE_STS_SIZE 60U
98#define AIE_SYSFS_BD_SIZE 40U
99#define AIE_SYSFS_ERROR_SIZE 300U
100#define AIE_SYSFS_ERROR_CATEGORY_SIZE 500U
101#define AIE_SYSFS_LOCK_STS_SIZE 400U
102#define AIE_SYSFS_EVENT_STS_SIZE 550U
103
104
105#define AIE_PART_DEV_ATTR_RO(_name) { \
106 .name = __stringify(_name), \
107 .mode = 0444, \
108 .show = aie_part_show_##_name, \
109}
110
111#define AIE_PART_DEV_ATTR_WO(_name) { \
112 .name = __stringify(_name), \
113 .mode = 0200, \
114 .store = aie_part_store_##_name, \
115}
116
117#define AIE_PART_DEV_ATTR_RW(_name) { \
118 .name = __stringify(_name), \
119 .mode = 0644, \
120 .show = aie_part_show_##_name, \
121 .store = aie_part_store_##_name, \
122}
123
124#define AIE_TILE_DEV_ATTR_RO(_name, _ttype) { \
125 .name = __stringify(_name), \
126 .mode = 0444, \
127 .tile_type = _ttype, \
128 .show = aie_tile_show_##_name, \
129}
130
131#define AIE_TILE_DEV_ATTR_WO(_name, _ttype) { \
132 .name = __stringify(_name), \
133 .mode = 0200, \
134 .tile_type = _ttype, \
135 .store = aie_tile_store_##_name, \
136}
137
138#define AIE_TILE_DEV_ATTR_RW(_name, _ttype) { \
139 .name = __stringify(_name), \
140 .mode = 0644, \
141 .tile_type = _ttype, \
142 .show = aie_tile_show_##_name, \
143 .store = aie_tile_store_##_name, \
144}
145
146#define AIE_PART_BIN_ATTR_RO(_name, _size) { \
147 .name = __stringify(_name), \
148 .mode = 0444, \
149 .size = _size, \
150 .read = aie_sysfs_read_handler, \
151 .read_callback = aie_part_read_cb_##_name, \
152}
153
154#define AIE_PART_BIN_ATTR_WO(_name, _size) { \
155 .name = __stringify(_name), \
156 .mode = 0200, \
157 .size = _size, \
158 .write = aie_part_write_handler, \
159 .write_callback = aie_part_write_cb_##_name, \
160}
161
162#define AIE_PART_BIN_ATTR_RW(_name, _size) { \
163 .name = __stringify(_name), \
164 .mode = 0644 \
165 .size = _size, \
166 .read = aie_sysfs_read_handler, \
167 .write = aie_part_write_handler, \
168 .read_callback = aie_part_read_cb_##_name, \
169 .write_callback = aie_part_write_cb_##_name, \
170}
171
172#define AIE_TILE_BIN_ATTR_RO(_name, _size, _ttype) { \
173 .name = __stringify(_name), \
174 .mode = 0444, \
175 .size = _size, \
176 .tile_type = _ttype, \
177 .read = aie_sysfs_read_handler, \
178 .read_callback = aie_tile_read_cb_##_name, \
179}
180
181#define AIE_TILE_BIN_ATTR_WO(_name, _size, _ttype) { \
182 .name = __stringify(_name), \
183 .mode = 0200, \
184 .size = _size, \
185 .tile_type = _ttype, \
186 .write = aie_tile_write_handler, \
187 .write_callback = aie_tile_write_cb_##_name, \
188}
189
190#define AIE_TILE_BIN_ATTR_RW(_name, _size, _ttype) { \
191 .name = __stringify(_name), \
192 .mode = 0644, \
193 .size = _size, \
194 .tile_type = _ttype, \
195 .read = aie_sysfs_read_handler, \
196 .write = aie_tile_write_handler, \
197 .read_callback = aie_tile_read_cb_##_name, \
198 .write_callback = aie_tile_write_cb_##_name, \
199}
200
201
202
203
204enum aie_shim_switch_type {
205 AIE_SHIM_SWITCH_A,
206 AIE_SHIM_SWITCH_B
207};
208
209
210
211
212
213
214
215
216
217struct aie_tile_regs {
218 size_t soff;
219 size_t eoff;
220 u32 attribute;
221};
222
223
224
225
226
227
228struct aie_single_reg_field {
229 u32 mask;
230 u32 regoff;
231};
232
233struct aie_device;
234struct aie_partition;
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250struct aie_part_mem {
251 struct aie_partition *apart;
252 struct dma_buf *dbuf;
253 struct aie_mem mem;
254 size_t size;
255};
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275struct aie_dma_attr {
276 struct aie_single_reg_field laddr;
277 struct aie_single_reg_field haddr;
278 struct aie_single_reg_field buflen;
279 struct aie_single_reg_field sts;
280 struct aie_single_reg_field stall;
281 struct aie_single_reg_field qsize;
282 struct aie_single_reg_field curbd;
283 struct aie_single_reg_field qsts;
284 u32 bd_regoff;
285 u32 mm2s_sts_regoff;
286 u32 s2mm_sts_regoff;
287 u32 num_mm2s_chan;
288 u32 num_s2mm_chan;
289 u32 num_bds;
290 u32 bd_len;
291};
292
293
294
295
296
297
298struct aie_core_regs_attr {
299 const struct aie_tile_regs *core_regs;
300 u32 width;
301};
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329struct aie_tile_operations {
330 u32 (*get_tile_type)(struct aie_location *loc);
331 unsigned int (*get_mem_info)(struct aie_range *range,
332 struct aie_part_mem *pmem);
333 u32 (*get_core_status)(struct aie_partition *apart,
334 struct aie_location *loc);
335 int (*reset_shim)(struct aie_device *adev, struct aie_range *range);
336 int (*init_part_clk_state)(struct aie_partition *apart);
337 int (*scan_part_clocks)(struct aie_partition *apart);
338 int (*set_part_clocks)(struct aie_partition *apart);
339};
340
341
342
343
344
345
346struct aie_resource {
347 unsigned long *bitmap;
348 u32 total;
349};
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365struct aie_event_attr {
366 struct aie_single_reg_field bc_event;
367 struct aie_single_reg_field group_error;
368 u32 bc_regoff;
369 u32 status_regoff;
370 u32 group_regoff;
371 u32 base_error_event;
372 u32 num_broadcasts;
373 u32 base_bc_event;
374 u32 num_events;
375};
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390struct aie_l1_intr_ctrl_attr {
391 struct aie_single_reg_field swa_status;
392 struct aie_single_reg_field swb_status;
393 struct aie_single_reg_field swa_event;
394 struct aie_single_reg_field swb_event;
395 u32 regoff;
396 u32 event_lsb;
397 u32 num_broadcasts;
398};
399
400
401
402
403
404
405
406
407
408
409
410
411struct aie_l2_intr_ctrl_attr {
412 struct aie_single_reg_field mask;
413 struct aie_single_reg_field enable;
414 struct aie_single_reg_field disable;
415 struct aie_single_reg_field status;
416 u32 regoff;
417 u32 num_broadcasts;
418};
419
420
421
422
423
424
425struct aie_error_cb {
426 void (*cb)(void *priv);
427 void *priv;
428};
429
430
431
432
433
434
435struct aie_event_prop {
436 u32 event;
437 char *event_str;
438};
439
440
441
442
443
444
445
446struct aie_err_category {
447 u32 err_category;
448 u32 num_events;
449 const struct aie_event_prop *prop;
450};
451
452
453
454
455
456
457
458struct aie_error_attr {
459 u32 num_err_categories;
460 const struct aie_err_category *err_category;
461};
462
463
464
465
466
467
468
469
470
471struct aie_rsc_stat {
472 struct aie_resource rbits;
473 struct aie_resource sbits;
474};
475
476
477
478
479
480
481
482struct aie_mod_rscs {
483 struct aie_rsc_stat *rscs_stat;
484};
485
486
487
488
489
490
491
492
493
494
495
496
497
498struct aie_tile_rscs {
499 struct aie_mod_rscs *mod_rscs[AIE_RSCTYPE_MAX];
500};
501
502
503
504
505
506struct aie_mod_rsc_attr {
507 u8 num_rscs;
508};
509
510
511
512
513
514
515struct aie_tile_rsc_attr {
516 struct aie_mod_rsc_attr mod_attr[AIE_MAX_MODS_PER_TILE];
517};
518
519
520
521
522
523
524
525struct aie_lock_attr {
526 struct aie_single_reg_field sts;
527 u32 sts_regoff;
528 u32 num_locks;
529};
530
531
532
533
534
535
536
537
538
539
540struct aie_tile_attr {
541 u8 start_row;
542 u8 num_rows;
543 u8 num_mods;
544 const enum aie_module_type *mods;
545 const struct aie_tile_rsc_attr *rscs_attr;
546};
547
548
549
550
551
552
553
554
555
556struct aie_dev_attr {
557 const char *name;
558 umode_t mode;
559 u32 tile_type;
560 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
561 char *buf);
562 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
563 const char *buf, size_t count);
564};
565
566
567
568
569
570
571
572
573
574struct aie_sysfs_prop {
575 char *data;
576 ssize_t size;
577 ssize_t max_size;
578 ssize_t (*read_callback)(struct kobject *kobj, char *buffer,
579 ssize_t size);
580 ssize_t (*write_callback)(struct kobject *kobj, char *buffer,
581 ssize_t size);
582};
583
584
585
586
587
588
589
590
591
592
593
594
595struct aie_bin_attr {
596 const char *name;
597 umode_t mode;
598 ssize_t size;
599 u32 tile_type;
600 ssize_t (*read)(struct file *filp, struct kobject *kobj,
601 struct bin_attribute *attr, char *buf, loff_t offset,
602 size_t max_size);
603 ssize_t (*write)(struct file *filp, struct kobject *kobj,
604 struct bin_attribute *attr, char *buf, loff_t offset,
605 size_t max_size);
606 ssize_t (*read_callback)(struct kobject *kobj, char *buffer,
607 ssize_t size);
608 ssize_t (*write_callback)(struct kobject *kobj, char *buffer,
609 ssize_t size);
610};
611
612
613
614
615
616
617
618
619
620struct aie_sysfs_attr {
621 const struct aie_dev_attr *dev_attr;
622 const struct aie_bin_attr *bin_attr;
623 u32 num_dev_attrs;
624 u32 num_bin_attrs;
625};
626
627
628
629
630
631
632
633
634struct aie_tile {
635 struct aie_location loc;
636 struct aie_partition *apart;
637 struct device dev;
638 struct attribute_group *attr_grp;
639};
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691struct aie_device {
692 struct list_head partitions;
693 struct cdev cdev;
694 struct device dev;
695 struct mutex mlock;
696 void __iomem *base;
697 struct clk *clk;
698 struct resource *res;
699 const struct aie_tile_regs *kernel_regs;
700 const struct aie_core_regs_attr *core_regs;
701 const struct aie_tile_operations *ops;
702 const struct aie_single_reg_field *col_rst;
703 const struct aie_single_reg_field *col_clkbuf;
704 const struct aie_dma_attr *shim_dma;
705 const struct aie_dma_attr *tile_dma;
706 const struct aie_event_attr *pl_events;
707 const struct aie_event_attr *mem_events;
708 const struct aie_event_attr *core_events;
709 const struct aie_l1_intr_ctrl_attr *l1_ctrl;
710 const struct aie_l2_intr_ctrl_attr *l2_ctrl;
711 const struct aie_error_attr *core_errors;
712 const struct aie_error_attr *mem_errors;
713 const struct aie_error_attr *shim_errors;
714 size_t size;
715 struct aie_resource cols_res;
716 u32 array_shift;
717 u32 col_shift;
718 u32 row_shift;
719 u32 num_kernel_regs;
720 u32 num_core_regs;
721 int irq;
722 struct work_struct backtrack;
723 int version;
724 u32 pm_node_id;
725 u32 clock_id;
726 struct aie_tile_attr ttype_attr[AIE_TILE_TYPE_MAX];
727 const struct aie_sysfs_attr *part_sysfs_attr;
728 const struct aie_sysfs_attr *tile_sysfs_attr;
729 char **core_status_str;
730 const struct aie_single_reg_field *core_pc;
731 const struct aie_single_reg_field *core_lr;
732 const struct aie_single_reg_field *core_sp;
733 char **dma_status_str;
734 char **queue_status_str;
735 const struct aie_lock_attr *pl_lock;
736 const struct aie_lock_attr *mem_lock;
737 char **lock_status_str;
738};
739
740
741
742
743
744
745struct aie_part_bridge {
746 char name[32];
747 struct fpga_bridge *br;
748};
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783struct aie_partition {
784 struct list_head node;
785 struct list_head dbufs;
786 struct aie_part_bridge br;
787 struct aie_device *adev;
788 struct file *filep;
789 struct aie_part_mem *pmems;
790 struct kmem_cache *dbufs_cache;
791 struct aie_tile_rscs trscs[AIE_TILE_TYPE_MAX];
792 u64 freq_req;
793 struct aie_range range;
794 struct mutex mlock;
795 struct device dev;
796 struct aie_tile *atiles;
797 struct aie_resource cores_clk_state;
798 struct aie_resource tiles_inuse;
799 struct aie_error_cb error_cb;
800 struct aie_resource core_event_status;
801 struct aie_resource mem_event_status;
802 struct aie_resource pl_event_status;
803 struct aie_resource l2_mask;
804 struct attribute_group *attr_grp;
805 u32 partition_id;
806 u32 status;
807 u32 cntrflag;
808 u8 error_to_report;
809};
810
811
812
813
814
815
816
817
818
819struct aie_part_pinned_region {
820 u64 user_addr;
821 u64 len;
822 struct page **pages;
823 int npages;
824};
825
826extern struct class *aie_class;
827extern const struct file_operations aie_part_fops;
828
829#define cdev_to_aiedev(i_cdev) container_of((i_cdev), struct aie_device, cdev)
830#define dev_to_aiedev(_dev) container_of((_dev), struct aie_device, dev)
831#define dev_to_aiepart(_dev) container_of((_dev), struct aie_partition, dev)
832#define dev_to_aietile(_dev) container_of((_dev), struct aie_tile, dev)
833
834#define aie_col_mask(adev) ({ \
835 struct aie_device *_adev = (adev); \
836 GENMASK_ULL(_adev->array_shift - 1, _adev->col_shift); \
837 })
838
839#define aie_row_mask(adev) ({ \
840 struct aie_device *_adev = (adev); \
841 GENMASK_ULL(_adev->col_shift - 1, _adev->row_shift); \
842 })
843
844#define aie_tile_reg_mask(adev) ({ \
845 struct aie_device *_adev = (adev); \
846 GENMASK_ULL(_adev->row_shift - 1, 0); \
847 })
848
849
850
851
852
853#define aie_tile_reg_field_get(mask, shift, regoff) ( \
854 ((regoff) & (mask)) >> (shift))
855
856#define aie_cal_tile_reg(adev, regoff) ( \
857 aie_tile_reg_field_get(aie_tile_reg_mask(adev), 0, regoff))
858
859
860
861
862
863
864
865static inline u32 aie_get_field_val(const struct aie_single_reg_field *field,
866 u32 val)
867{
868 long long mask = (long long)field->mask & 0x00000000ffffffff;
869
870 return (val << __bf_shf(mask)) & field->mask;
871}
872
873
874
875
876
877
878
879static inline u32 aie_get_reg_field(const struct aie_single_reg_field *field,
880 u32 regval)
881{
882 long long mask64 = (long long)field->mask & 0x00000000ffffffff;
883
884 return (regval & field->mask) >> __bf_shf(mask64);
885}
886
887
888
889
890
891
892
893
894
895static inline u32 aie_cal_regoff(struct aie_device *adev,
896 struct aie_location loc, u32 regoff_intile)
897{
898 return regoff_intile + (loc.col << adev->col_shift) +
899 (loc.row << adev->row_shift);
900}
901
902
903
904
905
906
907
908
909
910
911
912static inline int aie_validate_location(struct aie_partition *apart,
913 struct aie_location loc)
914{
915 if (loc.col < apart->range.start.col ||
916 loc.col >= apart->range.start.col + apart->range.size.col ||
917 loc.row < apart->range.start.row ||
918 loc.row >= apart->range.start.row + apart->range.size.row)
919 return -EINVAL;
920
921 return 0;
922}
923
924
925
926
927
928
929
930
931
932
933
934
935
936static inline
937unsigned long aie_resource_or_get_valueul(struct aie_resource *res,
938 u32 sbit, u32 nbits)
939{
940 const size_t i = BIT_WORD(sbit);
941 unsigned long bits;
942
943 bits = res->bitmap[i];
944 bits >>= (sbit % BITS_PER_LONG);
945 bits |= BITMAP_FIRST_WORD_MASK(nbits);
946
947 return bits;
948}
949
950int aie_resource_initialize(struct aie_resource *res, int count);
951void aie_resource_uninitialize(struct aie_resource *res);
952int aie_resource_check_region(struct aie_resource *res, u32 start,
953 u32 count);
954int aie_resource_get_region(struct aie_resource *res, u32 start,
955 u32 count);
956void aie_resource_put_region(struct aie_resource *res, int start, u32 count);
957int aie_resource_set(struct aie_resource *res, u32 start, u32 count);
958int aie_resource_cpy_from_arr32(struct aie_resource *res, u32 start,
959 const u32 *src, u32 nbits);
960int aie_resource_cpy_to_arr32(struct aie_resource *res, u32 start, u32 *dst,
961 u32 nbits);
962int aie_resource_clear(struct aie_resource *res, u32 start, u32 count);
963int aie_resource_clear_all(struct aie_resource *res);
964bool aie_resource_testbit(struct aie_resource *res, u32 bit);
965int aie_resource_check_common_avail(struct aie_resource *res0,
966 struct aie_resource *res1,
967 u32 sbit, u32 nbits);
968int aie_resource_get_common_avail(struct aie_resource *res0,
969 struct aie_resource *res1,
970 u32 sbit, u32 nbits, u32 total,
971 struct aie_rsc *rscs);
972int aie_resource_check_pattern_region(struct aie_resource *res,
973 u32 start, u32 end, u32 count);
974int aie_resource_check_common_pattern_region(struct aie_resource *res0,
975 struct aie_resource *res1,
976 u32 sbit, u32 nbits, u32 total);
977int aie_resource_get_common_pattern_region(struct aie_resource *res0,
978 struct aie_resource *res1,
979 u32 sbit, u32 nbits, u32 total,
980 struct aie_rsc *rscs);
981
982const struct file_operations *aie_part_get_fops(void);
983u8 aie_part_in_use(struct aie_partition *apart);
984struct aie_partition *aie_get_partition_from_id(struct aie_device *adev,
985 u32 partition_id);
986struct aie_partition *of_aie_part_probe(struct aie_device *adev,
987 struct device_node *nc);
988void aie_part_remove(struct aie_partition *apart);
989int aie_part_clean(struct aie_partition *apart);
990int aie_part_open(struct aie_partition *apart, void *rsc_metadata);
991
992int aie_fpga_create_bridge(struct aie_partition *apart);
993void aie_fpga_free_bridge(struct aie_partition *apart);
994
995int aie_mem_get_info(struct aie_partition *apart, unsigned long arg);
996
997long aie_part_attach_dmabuf_req(struct aie_partition *apart,
998 void __user *user_args);
999long aie_part_detach_dmabuf_req(struct aie_partition *apart,
1000 void __user *user_args);
1001long aie_part_set_bd(struct aie_partition *apart, void __user *user_args);
1002long aie_part_set_dmabuf_bd(struct aie_partition *apart,
1003 void __user *user_args);
1004void aie_part_release_dmabufs(struct aie_partition *apart);
1005int aie_part_prealloc_dbufs_cache(struct aie_partition *apart);
1006
1007int aie_part_scan_clk_state(struct aie_partition *apart);
1008bool aie_part_check_clk_enable_loc(struct aie_partition *apart,
1009 struct aie_location *loc);
1010int aie_part_set_freq(struct aie_partition *apart, u64 freq);
1011int aie_part_get_running_freq(struct aie_partition *apart, u64 *freq);
1012
1013int aie_part_request_tiles_from_user(struct aie_partition *apart,
1014 void __user *user_args);
1015int aie_part_release_tiles_from_user(struct aie_partition *apart,
1016 void __user *user_args);
1017int aie_device_init(struct aie_device *adev);
1018
1019void aie_array_backtrack(struct work_struct *work);
1020irqreturn_t aie_interrupt(int irq, void *data);
1021void aie_part_clear_cached_events(struct aie_partition *apart);
1022int aie_part_set_intr_rscs(struct aie_partition *apart);
1023
1024bool aie_part_has_mem_mmapped(struct aie_partition *apart);
1025bool aie_part_has_regs_mmapped(struct aie_partition *apart);
1026
1027int aie_part_get_tile_rows(struct aie_partition *apart,
1028 enum aie_tile_type ttype);
1029
1030int aie_part_reset(struct aie_partition *apart);
1031int aie_part_post_reinit(struct aie_partition *apart);
1032
1033int aie_part_rscmgr_init(struct aie_partition *apart);
1034void aie_part_rscmgr_finish(struct aie_partition *apart);
1035void aie_part_rscmgr_reset(struct aie_partition *apart);
1036long aie_part_rscmgr_rsc_req(struct aie_partition *apart,
1037 void __user *user_args);
1038long aie_part_rscmgr_rsc_release(struct aie_partition *apart,
1039 void __user *user_args);
1040long aie_part_rscmgr_rsc_free(struct aie_partition *apart,
1041 void __user *user_args);
1042long aie_part_rscmgr_rsc_req_specific(struct aie_partition *apart,
1043 void __user *user_args);
1044long aie_part_rscmgr_rsc_check_avail(struct aie_partition *apart,
1045 void __user *user_args);
1046long aie_part_rscmgr_get_broadcast(struct aie_partition *apart,
1047 void __user *user_args);
1048int aie_part_rscmgr_set_static(struct aie_partition *apart, void *meta);
1049int aie_part_rscmgr_set_tile_broadcast(struct aie_partition *apart,
1050 struct aie_location loc,
1051 enum aie_module_type mod, uint32_t id);
1052
1053int aie_part_sysfs_create_entries(struct aie_partition *apart);
1054void aie_part_sysfs_remove_entries(struct aie_partition *apart);
1055int aie_tile_sysfs_create_entries(struct aie_tile *atile);
1056void aie_tile_sysfs_remove_entries(struct aie_tile *atile);
1057ssize_t aie_sysfs_read_handler(struct file *filp, struct kobject *kobj,
1058 struct bin_attribute *attr, char *buf,
1059 loff_t offset, size_t max_size);
1060
1061ssize_t aie_sysfs_get_core_status(struct aie_partition *apart,
1062 struct aie_location *loc, char *buffer,
1063 ssize_t size);
1064ssize_t aie_tile_show_core(struct device *dev, struct device_attribute *attr,
1065 char *buffer);
1066ssize_t aie_part_read_cb_core(struct kobject *kobj, char *buffer, ssize_t size);
1067ssize_t aie_sysfs_get_dma_status(struct aie_partition *apart,
1068 struct aie_location *loc, char *buffer,
1069 ssize_t size);
1070ssize_t aie_tile_show_dma(struct device *dev, struct device_attribute *attr,
1071 char *buffer);
1072ssize_t aie_part_read_cb_dma(struct kobject *kobj, char *buffer, ssize_t size);
1073ssize_t aie_tile_show_lock(struct device *dev, struct device_attribute *attr,
1074 char *buffer);
1075ssize_t aie_part_read_cb_lock(struct kobject *kobj, char *buffer, ssize_t size);
1076ssize_t aie_sysfs_get_lock_status(struct aie_partition *apart,
1077 struct aie_location *loc, char *buffer,
1078 ssize_t size);
1079u32 aie_get_module_error_count(struct aie_partition *apart,
1080 struct aie_location loc,
1081 enum aie_module_type module,
1082 const struct aie_error_attr *err_attr);
1083bool aie_check_error_bitmap(struct aie_partition *apart,
1084 struct aie_location loc,
1085 enum aie_module_type module, u8 event);
1086u32 aie_get_error_count(struct aie_partition *apart);
1087ssize_t aie_sysfs_get_errors(struct aie_partition *apart,
1088 struct aie_location *loc, char *buffer,
1089 ssize_t size);
1090ssize_t aie_tile_show_error(struct device *dev, struct device_attribute *attr,
1091 char *buffer);
1092ssize_t aie_part_show_error_stat(struct device *dev,
1093 struct device_attribute *attr, char *buffer);
1094ssize_t aie_part_read_cb_error(struct kobject *kobj, char *buffer,
1095 ssize_t size);
1096ssize_t aie_tile_show_event(struct device *dev, struct device_attribute *attr,
1097 char *buffer);
1098void aie_read_event_status(struct aie_partition *apart,
1099 struct aie_location *loc,
1100 enum aie_module_type module, u32 *reg);
1101ssize_t aie_part_read_cb_status(struct kobject *kobj, char *buffer,
1102 ssize_t size);
1103long aie_part_rscmgr_get_statistics(struct aie_partition *apart,
1104 void __user *user_args);
1105
1106#endif
1107