1#define pr_fmt(fmt) "irq: " fmt
2
3#include <linux/debugfs.h>
4#include <linux/hardirq.h>
5#include <linux/interrupt.h>
6#include <linux/irq.h>
7#include <linux/irqdesc.h>
8#include <linux/irqdomain.h>
9#include <linux/module.h>
10#include <linux/mutex.h>
11#include <linux/of.h>
12#include <linux/of_address.h>
13#include <linux/topology.h>
14#include <linux/seq_file.h>
15#include <linux/slab.h>
16#include <linux/smp.h>
17#include <linux/fs.h>
18
19#define IRQ_DOMAIN_MAP_LEGACY 0
20
21#define IRQ_DOMAIN_MAP_NOMAP 1
22#define IRQ_DOMAIN_MAP_LINEAR 2
23#define IRQ_DOMAIN_MAP_TREE 3
24
25static LIST_HEAD(irq_domain_list);
26static DEFINE_MUTEX(irq_domain_mutex);
27
28static DEFINE_MUTEX(revmap_trees_mutex);
29static struct irq_domain *irq_default_domain;
30
31
32
33
34
35
36
37
38
39
40
41
42static struct irq_domain *irq_domain_alloc(struct device_node *of_node,
43 unsigned int revmap_type,
44 const struct irq_domain_ops *ops,
45 void *host_data)
46{
47 struct irq_domain *domain;
48
49 domain = kzalloc_node(sizeof(*domain), GFP_KERNEL,
50 of_node_to_nid(of_node));
51 if (WARN_ON(!domain))
52 return NULL;
53
54
55 domain->revmap_type = revmap_type;
56 domain->ops = ops;
57 domain->host_data = host_data;
58 domain->of_node = of_node_get(of_node);
59
60 return domain;
61}
62
63static void irq_domain_free(struct irq_domain *domain)
64{
65 of_node_put(domain->of_node);
66 kfree(domain);
67}
68
69static void irq_domain_add(struct irq_domain *domain)
70{
71 mutex_lock(&irq_domain_mutex);
72 list_add(&domain->link, &irq_domain_list);
73 mutex_unlock(&irq_domain_mutex);
74 pr_debug("Allocated domain of type %d @0x%p\n",
75 domain->revmap_type, domain);
76}
77
78
79
80
81
82
83
84
85
86void irq_domain_remove(struct irq_domain *domain)
87{
88 mutex_lock(&irq_domain_mutex);
89
90 switch (domain->revmap_type) {
91 case IRQ_DOMAIN_MAP_LEGACY:
92
93
94
95
96
97 break;
98 case IRQ_DOMAIN_MAP_TREE:
99
100
101
102
103
104 WARN_ON(domain->revmap_data.tree.height);
105 break;
106 case IRQ_DOMAIN_MAP_LINEAR:
107 kfree(domain->revmap_data.linear.revmap);
108 domain->revmap_data.linear.size = 0;
109 break;
110 case IRQ_DOMAIN_MAP_NOMAP:
111 break;
112 }
113
114 list_del(&domain->link);
115
116
117
118
119 if (unlikely(irq_default_domain == domain))
120 irq_set_default_host(NULL);
121
122 mutex_unlock(&irq_domain_mutex);
123
124 pr_debug("Removed domain of type %d @0x%p\n",
125 domain->revmap_type, domain);
126
127 irq_domain_free(domain);
128}
129EXPORT_SYMBOL_GPL(irq_domain_remove);
130
131static unsigned int irq_domain_legacy_revmap(struct irq_domain *domain,
132 irq_hw_number_t hwirq)
133{
134 irq_hw_number_t first_hwirq = domain->revmap_data.legacy.first_hwirq;
135 int size = domain->revmap_data.legacy.size;
136
137 if (WARN_ON(hwirq < first_hwirq || hwirq >= first_hwirq + size))
138 return 0;
139 return hwirq - first_hwirq + domain->revmap_data.legacy.first_irq;
140}
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
160 unsigned int size,
161 unsigned int first_irq,
162 const struct irq_domain_ops *ops,
163 void *host_data)
164{
165 if (first_irq > 0)
166 return irq_domain_add_legacy(of_node, size, first_irq, 0,
167 ops, host_data);
168 else
169 return irq_domain_add_linear(of_node, size, ops, host_data);
170}
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
188 unsigned int size,
189 unsigned int first_irq,
190 irq_hw_number_t first_hwirq,
191 const struct irq_domain_ops *ops,
192 void *host_data)
193{
194 struct irq_domain *domain;
195 unsigned int i;
196
197 domain = irq_domain_alloc(of_node, IRQ_DOMAIN_MAP_LEGACY, ops, host_data);
198 if (!domain)
199 return NULL;
200
201 domain->revmap_data.legacy.first_irq = first_irq;
202 domain->revmap_data.legacy.first_hwirq = first_hwirq;
203 domain->revmap_data.legacy.size = size;
204
205 mutex_lock(&irq_domain_mutex);
206
207 for (i = 0; i < size; i++) {
208 int irq = first_irq + i;
209 struct irq_data *irq_data = irq_get_irq_data(irq);
210
211 if (WARN_ON(!irq_data || irq_data->domain)) {
212 mutex_unlock(&irq_domain_mutex);
213 irq_domain_free(domain);
214 return NULL;
215 }
216 }
217
218
219 for (i = 0; i < size; i++) {
220 struct irq_data *irq_data = irq_get_irq_data(first_irq + i);
221 irq_data->hwirq = first_hwirq + i;
222 irq_data->domain = domain;
223 }
224 mutex_unlock(&irq_domain_mutex);
225
226 for (i = 0; i < size; i++) {
227 int irq = first_irq + i;
228 int hwirq = first_hwirq + i;
229
230
231 if (!irq)
232 continue;
233
234
235
236
237
238 if (ops->map)
239 ops->map(domain, irq, hwirq);
240
241
242 irq_clear_status_flags(irq, IRQ_NOREQUEST);
243 }
244
245 irq_domain_add(domain);
246 return domain;
247}
248EXPORT_SYMBOL_GPL(irq_domain_add_legacy);
249
250
251
252
253
254
255
256
257struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
258 unsigned int size,
259 const struct irq_domain_ops *ops,
260 void *host_data)
261{
262 struct irq_domain *domain;
263 unsigned int *revmap;
264
265 revmap = kzalloc_node(sizeof(*revmap) * size, GFP_KERNEL,
266 of_node_to_nid(of_node));
267 if (WARN_ON(!revmap))
268 return NULL;
269
270 domain = irq_domain_alloc(of_node, IRQ_DOMAIN_MAP_LINEAR, ops, host_data);
271 if (!domain) {
272 kfree(revmap);
273 return NULL;
274 }
275 domain->revmap_data.linear.size = size;
276 domain->revmap_data.linear.revmap = revmap;
277 irq_domain_add(domain);
278 return domain;
279}
280EXPORT_SYMBOL_GPL(irq_domain_add_linear);
281
282struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
283 unsigned int max_irq,
284 const struct irq_domain_ops *ops,
285 void *host_data)
286{
287 struct irq_domain *domain = irq_domain_alloc(of_node,
288 IRQ_DOMAIN_MAP_NOMAP, ops, host_data);
289 if (domain) {
290 domain->revmap_data.nomap.max_irq = max_irq ? max_irq : ~0;
291 irq_domain_add(domain);
292 }
293 return domain;
294}
295EXPORT_SYMBOL_GPL(irq_domain_add_nomap);
296
297
298
299
300
301
302
303
304
305struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
306 const struct irq_domain_ops *ops,
307 void *host_data)
308{
309 struct irq_domain *domain = irq_domain_alloc(of_node,
310 IRQ_DOMAIN_MAP_TREE, ops, host_data);
311 if (domain) {
312 INIT_RADIX_TREE(&domain->revmap_data.tree, GFP_KERNEL);
313 irq_domain_add(domain);
314 }
315 return domain;
316}
317EXPORT_SYMBOL_GPL(irq_domain_add_tree);
318
319
320
321
322
323struct irq_domain *irq_find_host(struct device_node *node)
324{
325 struct irq_domain *h, *found = NULL;
326 int rc;
327
328
329
330
331
332
333 mutex_lock(&irq_domain_mutex);
334 list_for_each_entry(h, &irq_domain_list, link) {
335 if (h->ops->match)
336 rc = h->ops->match(h, node);
337 else
338 rc = (h->of_node != NULL) && (h->of_node == node);
339
340 if (rc) {
341 found = h;
342 break;
343 }
344 }
345 mutex_unlock(&irq_domain_mutex);
346 return found;
347}
348EXPORT_SYMBOL_GPL(irq_find_host);
349
350
351
352
353
354
355
356
357
358
359void irq_set_default_host(struct irq_domain *domain)
360{
361 pr_debug("Default domain set to @0x%p\n", domain);
362
363 irq_default_domain = domain;
364}
365EXPORT_SYMBOL_GPL(irq_set_default_host);
366
367static void irq_domain_disassociate_many(struct irq_domain *domain,
368 unsigned int irq_base, int count)
369{
370
371
372
373
374 while (count--) {
375 int irq = irq_base + count;
376 struct irq_data *irq_data = irq_get_irq_data(irq);
377 irq_hw_number_t hwirq = irq_data->hwirq;
378
379 if (WARN_ON(!irq_data || irq_data->domain != domain))
380 continue;
381
382 irq_set_status_flags(irq, IRQ_NOREQUEST);
383
384
385 irq_set_chip_and_handler(irq, NULL, NULL);
386
387
388 synchronize_irq(irq);
389
390
391 if (domain->ops->unmap)
392 domain->ops->unmap(domain, irq);
393 smp_mb();
394
395 irq_data->domain = NULL;
396 irq_data->hwirq = 0;
397
398
399 switch(domain->revmap_type) {
400 case IRQ_DOMAIN_MAP_LINEAR:
401 if (hwirq < domain->revmap_data.linear.size)
402 domain->revmap_data.linear.revmap[hwirq] = 0;
403 break;
404 case IRQ_DOMAIN_MAP_TREE:
405 mutex_lock(&revmap_trees_mutex);
406 radix_tree_delete(&domain->revmap_data.tree, hwirq);
407 mutex_unlock(&revmap_trees_mutex);
408 break;
409 }
410 }
411}
412
413int irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base,
414 irq_hw_number_t hwirq_base, int count)
415{
416 unsigned int virq = irq_base;
417 irq_hw_number_t hwirq = hwirq_base;
418 int i, ret;
419
420 pr_debug("%s(%s, irqbase=%i, hwbase=%i, count=%i)\n", __func__,
421 of_node_full_name(domain->of_node), irq_base, (int)hwirq_base, count);
422
423 for (i = 0; i < count; i++) {
424 struct irq_data *irq_data = irq_get_irq_data(virq + i);
425
426 if (WARN(!irq_data, "error: irq_desc not allocated; "
427 "irq=%i hwirq=0x%x\n", virq + i, (int)hwirq + i))
428 return -EINVAL;
429 if (WARN(irq_data->domain, "error: irq_desc already associated; "
430 "irq=%i hwirq=0x%x\n", virq + i, (int)hwirq + i))
431 return -EINVAL;
432 };
433
434 for (i = 0; i < count; i++, virq++, hwirq++) {
435 struct irq_data *irq_data = irq_get_irq_data(virq);
436
437 irq_data->hwirq = hwirq;
438 irq_data->domain = domain;
439 if (domain->ops->map) {
440 ret = domain->ops->map(domain, virq, hwirq);
441 if (ret != 0) {
442 pr_err("irq-%i==>hwirq-0x%lx mapping failed: %d\n",
443 virq, hwirq, ret);
444 WARN_ON(1);
445 irq_data->domain = NULL;
446 irq_data->hwirq = 0;
447 goto err_unmap;
448 }
449 }
450
451 switch (domain->revmap_type) {
452 case IRQ_DOMAIN_MAP_LINEAR:
453 if (hwirq < domain->revmap_data.linear.size)
454 domain->revmap_data.linear.revmap[hwirq] = virq;
455 break;
456 case IRQ_DOMAIN_MAP_TREE:
457 mutex_lock(&revmap_trees_mutex);
458 radix_tree_insert(&domain->revmap_data.tree, hwirq, irq_data);
459 mutex_unlock(&revmap_trees_mutex);
460 break;
461 }
462
463 irq_clear_status_flags(virq, IRQ_NOREQUEST);
464 }
465
466 return 0;
467
468 err_unmap:
469 irq_domain_disassociate_many(domain, irq_base, i);
470 return -EINVAL;
471}
472EXPORT_SYMBOL_GPL(irq_domain_associate_many);
473
474
475
476
477
478
479
480
481
482unsigned int irq_create_direct_mapping(struct irq_domain *domain)
483{
484 unsigned int virq;
485
486 if (domain == NULL)
487 domain = irq_default_domain;
488
489 if (WARN_ON(!domain || domain->revmap_type != IRQ_DOMAIN_MAP_NOMAP))
490 return 0;
491
492 virq = irq_alloc_desc_from(1, of_node_to_nid(domain->of_node));
493 if (!virq) {
494 pr_debug("create_direct virq allocation failed\n");
495 return 0;
496 }
497 if (virq >= domain->revmap_data.nomap.max_irq) {
498 pr_err("ERROR: no free irqs available below %i maximum\n",
499 domain->revmap_data.nomap.max_irq);
500 irq_free_desc(virq);
501 return 0;
502 }
503 pr_debug("create_direct obtained virq %d\n", virq);
504
505 if (irq_domain_associate(domain, virq, virq)) {
506 irq_free_desc(virq);
507 return 0;
508 }
509
510 return virq;
511}
512EXPORT_SYMBOL_GPL(irq_create_direct_mapping);
513
514
515
516
517
518
519
520
521
522
523
524unsigned int irq_create_mapping(struct irq_domain *domain,
525 irq_hw_number_t hwirq)
526{
527 unsigned int hint;
528 int virq;
529
530 pr_debug("irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq);
531
532
533 if (domain == NULL)
534 domain = irq_default_domain;
535 if (domain == NULL) {
536 pr_warning("irq_create_mapping called for"
537 " NULL domain, hwirq=%lx\n", hwirq);
538 WARN_ON(1);
539 return 0;
540 }
541 pr_debug("-> using domain @%p\n", domain);
542
543
544 virq = irq_find_mapping(domain, hwirq);
545 if (virq) {
546 pr_debug("-> existing mapping on virq %d\n", virq);
547 return virq;
548 }
549
550
551 if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY)
552 return irq_domain_legacy_revmap(domain, hwirq);
553
554
555 hint = hwirq % nr_irqs;
556 if (hint == 0)
557 hint++;
558 virq = irq_alloc_desc_from(hint, of_node_to_nid(domain->of_node));
559 if (virq <= 0)
560 virq = irq_alloc_desc_from(1, of_node_to_nid(domain->of_node));
561 if (virq <= 0) {
562 pr_debug("-> virq allocation failed\n");
563 return 0;
564 }
565
566 if (irq_domain_associate(domain, virq, hwirq)) {
567 irq_free_desc(virq);
568 return 0;
569 }
570
571 pr_debug("irq %lu on domain %s mapped to virtual irq %u\n",
572 hwirq, of_node_full_name(domain->of_node), virq);
573
574 return virq;
575}
576EXPORT_SYMBOL_GPL(irq_create_mapping);
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596int irq_create_strict_mappings(struct irq_domain *domain, unsigned int irq_base,
597 irq_hw_number_t hwirq_base, int count)
598{
599 int ret;
600
601 ret = irq_alloc_descs(irq_base, irq_base, count,
602 of_node_to_nid(domain->of_node));
603 if (unlikely(ret < 0))
604 return ret;
605
606 ret = irq_domain_associate_many(domain, irq_base, hwirq_base, count);
607 if (unlikely(ret < 0)) {
608 irq_free_descs(irq_base, count);
609 return ret;
610 }
611
612 return 0;
613}
614EXPORT_SYMBOL_GPL(irq_create_strict_mappings);
615
616unsigned int irq_create_of_mapping(struct device_node *controller,
617 const u32 *intspec, unsigned int intsize)
618{
619 struct irq_domain *domain;
620 irq_hw_number_t hwirq;
621 unsigned int type = IRQ_TYPE_NONE;
622 unsigned int virq;
623
624 domain = controller ? irq_find_host(controller) : irq_default_domain;
625 if (!domain) {
626#ifdef CONFIG_MIPS
627
628
629
630
631
632
633
634
635 if (intsize > 0)
636 return intspec[0];
637#endif
638 pr_warning("no irq domain found for %s !\n",
639 of_node_full_name(controller));
640 return 0;
641 }
642
643
644 if (domain->ops->xlate == NULL)
645 hwirq = intspec[0];
646 else {
647 if (domain->ops->xlate(domain, controller, intspec, intsize,
648 &hwirq, &type))
649 return 0;
650 }
651
652
653 virq = irq_create_mapping(domain, hwirq);
654 if (!virq)
655 return virq;
656
657
658 if (type != IRQ_TYPE_NONE &&
659 type != (irqd_get_trigger_type(irq_get_irq_data(virq))))
660 irq_set_irq_type(virq, type);
661 return virq;
662}
663EXPORT_SYMBOL_GPL(irq_create_of_mapping);
664
665
666
667
668
669void irq_dispose_mapping(unsigned int virq)
670{
671 struct irq_data *irq_data = irq_get_irq_data(virq);
672 struct irq_domain *domain;
673
674 if (!virq || !irq_data)
675 return;
676
677 domain = irq_data->domain;
678 if (WARN_ON(domain == NULL))
679 return;
680
681
682 if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY)
683 return;
684
685 irq_domain_disassociate_many(domain, virq, 1);
686 irq_free_desc(virq);
687}
688EXPORT_SYMBOL_GPL(irq_dispose_mapping);
689
690
691
692
693
694
695unsigned int irq_find_mapping(struct irq_domain *domain,
696 irq_hw_number_t hwirq)
697{
698 struct irq_data *data;
699
700
701 if (domain == NULL)
702 domain = irq_default_domain;
703 if (domain == NULL)
704 return 0;
705
706 switch (domain->revmap_type) {
707 case IRQ_DOMAIN_MAP_LEGACY:
708 return irq_domain_legacy_revmap(domain, hwirq);
709 case IRQ_DOMAIN_MAP_LINEAR:
710 return irq_linear_revmap(domain, hwirq);
711 case IRQ_DOMAIN_MAP_TREE:
712 rcu_read_lock();
713 data = radix_tree_lookup(&domain->revmap_data.tree, hwirq);
714 rcu_read_unlock();
715 if (data)
716 return data->irq;
717 break;
718 case IRQ_DOMAIN_MAP_NOMAP:
719 data = irq_get_irq_data(hwirq);
720 if (data && (data->domain == domain) && (data->hwirq == hwirq))
721 return hwirq;
722 break;
723 }
724
725 return 0;
726}
727EXPORT_SYMBOL_GPL(irq_find_mapping);
728
729
730
731
732
733
734
735
736
737unsigned int irq_linear_revmap(struct irq_domain *domain,
738 irq_hw_number_t hwirq)
739{
740 BUG_ON(domain->revmap_type != IRQ_DOMAIN_MAP_LINEAR);
741
742
743 if (WARN_ON(hwirq >= domain->revmap_data.linear.size))
744 return 0;
745
746 return domain->revmap_data.linear.revmap[hwirq];
747}
748EXPORT_SYMBOL_GPL(irq_linear_revmap);
749
750#ifdef CONFIG_IRQ_DOMAIN_DEBUG
751static int virq_debug_show(struct seq_file *m, void *private)
752{
753 unsigned long flags;
754 struct irq_desc *desc;
755 const char *p;
756 static const char none[] = "none";
757 void *data;
758 int i;
759
760 seq_printf(m, "%-5s %-7s %-15s %-*s %s\n", "irq", "hwirq",
761 "chip name", (int)(2 * sizeof(void *) + 2), "chip data",
762 "domain name");
763
764 for (i = 1; i < nr_irqs; i++) {
765 desc = irq_to_desc(i);
766 if (!desc)
767 continue;
768
769 raw_spin_lock_irqsave(&desc->lock, flags);
770
771 if (desc->action && desc->action->handler) {
772 struct irq_chip *chip;
773
774 seq_printf(m, "%5d ", i);
775 seq_printf(m, "0x%05lx ", desc->irq_data.hwirq);
776
777 chip = irq_desc_get_chip(desc);
778 if (chip && chip->name)
779 p = chip->name;
780 else
781 p = none;
782 seq_printf(m, "%-15s ", p);
783
784 data = irq_desc_get_chip_data(desc);
785 seq_printf(m, data ? "0x%p " : " %p ", data);
786
787 if (desc->irq_data.domain)
788 p = of_node_full_name(desc->irq_data.domain->of_node);
789 else
790 p = none;
791 seq_printf(m, "%s\n", p);
792 }
793
794 raw_spin_unlock_irqrestore(&desc->lock, flags);
795 }
796
797 return 0;
798}
799
800static int virq_debug_open(struct inode *inode, struct file *file)
801{
802 return single_open(file, virq_debug_show, inode->i_private);
803}
804
805static const struct file_operations virq_debug_fops = {
806 .open = virq_debug_open,
807 .read = seq_read,
808 .llseek = seq_lseek,
809 .release = single_release,
810};
811
812static int __init irq_debugfs_init(void)
813{
814 if (debugfs_create_file("irq_domain_mapping", S_IRUGO, NULL,
815 NULL, &virq_debug_fops) == NULL)
816 return -ENOMEM;
817
818 return 0;
819}
820__initcall(irq_debugfs_init);
821#endif
822
823
824
825
826
827
828
829int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr,
830 const u32 *intspec, unsigned int intsize,
831 unsigned long *out_hwirq, unsigned int *out_type)
832{
833 if (WARN_ON(intsize < 1))
834 return -EINVAL;
835 *out_hwirq = intspec[0];
836 *out_type = IRQ_TYPE_NONE;
837 return 0;
838}
839EXPORT_SYMBOL_GPL(irq_domain_xlate_onecell);
840
841
842
843
844
845
846
847
848int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr,
849 const u32 *intspec, unsigned int intsize,
850 irq_hw_number_t *out_hwirq, unsigned int *out_type)
851{
852 if (WARN_ON(intsize < 2))
853 return -EINVAL;
854 *out_hwirq = intspec[0];
855 *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
856 return 0;
857}
858EXPORT_SYMBOL_GPL(irq_domain_xlate_twocell);
859
860
861
862
863
864
865
866
867
868
869
870
871int irq_domain_xlate_onetwocell(struct irq_domain *d,
872 struct device_node *ctrlr,
873 const u32 *intspec, unsigned int intsize,
874 unsigned long *out_hwirq, unsigned int *out_type)
875{
876 if (WARN_ON(intsize < 1))
877 return -EINVAL;
878 *out_hwirq = intspec[0];
879 *out_type = (intsize > 1) ? intspec[1] : IRQ_TYPE_NONE;
880 return 0;
881}
882EXPORT_SYMBOL_GPL(irq_domain_xlate_onetwocell);
883
884const struct irq_domain_ops irq_domain_simple_ops = {
885 .xlate = irq_domain_xlate_onetwocell,
886};
887EXPORT_SYMBOL_GPL(irq_domain_simple_ops);
888
889#ifdef CONFIG_OF_IRQ
890void irq_domain_generate_simple(const struct of_device_id *match,
891 u64 phys_base, unsigned int irq_start)
892{
893 struct device_node *node;
894 pr_debug("looking for phys_base=%llx, irq_start=%i\n",
895 (unsigned long long) phys_base, (int) irq_start);
896 node = of_find_matching_node_by_address(NULL, match, phys_base);
897 if (node)
898 irq_domain_add_legacy(node, 32, irq_start, 0,
899 &irq_domain_simple_ops, NULL);
900}
901EXPORT_SYMBOL_GPL(irq_domain_generate_simple);
902#endif
903