MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / gicv2_ofw_init

Function gicv2_ofw_init

components/drivers/pic/pic-gicv2.c:597–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597static rt_err_t gicv2_ofw_init(struct rt_ofw_node *np, const struct rt_ofw_node_id *id)
598{
599 rt_err_t err = RT_EOK;
600 struct gicv2 *gic = RT_NULL;
601
602 do {
603 rt_uint64_t regs[8];
604
605 if (_gicv2_nr >= RT_PIC_ARM_GIC_MAX_NR)
606 {
607 LOG_W("GICv2/v1 table is full");
608 err = -RT_EFULL;
609 break;
610 }
611
612 gic = &_gicv2_list[_gicv2_nr];
613
614 rt_ofw_get_address_array(np, RT_ARRAY_SIZE(regs), regs);
615
616 if ((err = gicv2_iomap_init(gic, regs)))
617 {
618 break;
619 }
620
621 if (gic->version != 1 && gic->version != 2)
622 {
623 LOG_E("Version = %d is not support", gic->version);
624 err = -RT_EINVAL;
625 break;
626 }
627
628 gic->skip_init = rt_ofw_prop_read_bool(np, "skip-init");
629
630 gic_common_init_quirk_ofw(np, _gicv2_quirks, gic);
631 gicv2_init(gic);
632
633 rt_ofw_data(np) = &gic->parent;
634
635 if (gic->version == 2)
636 {
637 #ifdef RT_PIC_ARM_GIC_V2M
638 gicv2m_ofw_probe(np, id);
639 #endif
640 }
641
642 ++_gicv2_nr;
643 } while (0);
644
645 if (err && gic)
646 {
647 gicv2_init_fail(gic);
648 }
649
650 return err;
651}
652
653static const struct rt_ofw_node_id gicv2_ofw_ids[] =
654{

Callers

nothing calls this directly

Calls 7

rt_ofw_get_address_arrayFunction · 0.85
gicv2_iomap_initFunction · 0.85
rt_ofw_prop_read_boolFunction · 0.85
gicv2_initFunction · 0.85
gicv2m_ofw_probeFunction · 0.85
gicv2_init_failFunction · 0.85

Tested by

no test coverage detected