Lines Matching refs:ioapic
106 static struct ioapic { struct
141 static inline int mp_ioapic_pin_count(int ioapic) in mp_ioapic_pin_count() argument
143 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_ioapic_pin_count()
148 static inline u32 mp_pin_to_gsi(int ioapic, int pin) in mp_pin_to_gsi() argument
150 return mp_ioapic_gsi_routing(ioapic)->gsi_base + pin; in mp_pin_to_gsi()
158 static inline struct irq_domain *mp_ioapic_irqdomain(int ioapic) in mp_ioapic_irqdomain() argument
160 return ioapics[ioapic].irqdomain; in mp_ioapic_irqdomain()
831 int ioapic, pin, idx; in __acpi_get_override_irq() local
836 ioapic = mp_find_ioapic(gsi); in __acpi_get_override_irq()
837 if (ioapic < 0) in __acpi_get_override_irq()
840 pin = mp_find_ioapic_pin(ioapic, gsi); in __acpi_get_override_irq()
844 idx = find_irq_entry(ioapic, pin, mp_INT); in __acpi_get_override_irq()
867 info->ioapic.node = node; in ioapic_set_alloc_attr()
868 info->ioapic.is_level = trigger; in ioapic_set_alloc_attr()
869 info->ioapic.active_low = polarity; in ioapic_set_alloc_attr()
870 info->ioapic.valid = 1; in ioapic_set_alloc_attr()
882 dst->ioapic.pin = pin; in ioapic_copy_alloc_attr()
883 dst->ioapic.valid = 1; in ioapic_copy_alloc_attr()
884 if (src && src->ioapic.valid) { in ioapic_copy_alloc_attr()
885 dst->ioapic.node = src->ioapic.node; in ioapic_copy_alloc_attr()
886 dst->ioapic.is_level = src->ioapic.is_level; in ioapic_copy_alloc_attr()
887 dst->ioapic.active_low = src->ioapic.active_low; in ioapic_copy_alloc_attr()
889 dst->ioapic.node = NUMA_NO_NODE; in ioapic_copy_alloc_attr()
891 dst->ioapic.is_level = level; in ioapic_copy_alloc_attr()
892 dst->ioapic.active_low = pol_low; in ioapic_copy_alloc_attr()
898 dst->ioapic.is_level = true; in ioapic_copy_alloc_attr()
899 dst->ioapic.active_low = true; in ioapic_copy_alloc_attr()
906 return (info && info->ioapic.valid) ? info->ioapic.node : NUMA_NO_NODE; in ioapic_alloc_attr_node()
936 if (info->ioapic.is_level != data->is_level) in mp_check_pin_attr()
937 mp_register_handler(irq, info->ioapic.is_level); in mp_check_pin_attr()
938 data->entry.is_level = data->is_level = info->ioapic.is_level; in mp_check_pin_attr()
939 data->entry.active_low = data->active_low = info->ioapic.active_low; in mp_check_pin_attr()
942 return data->is_level == info->ioapic.is_level && in mp_check_pin_attr()
943 data->active_low == info->ioapic.active_low; in mp_check_pin_attr()
946 static int alloc_irq_from_domain(struct irq_domain *domain, int ioapic, u32 gsi, in alloc_irq_from_domain() argument
951 int type = ioapics[ioapic].irqdomain_cfg.type; in alloc_irq_from_domain()
989 int irq, int ioapic, int pin, in alloc_isa_irq_from_domain() argument
1004 if (__add_pin_to_irq_node(irq_data->chip_data, node, ioapic, in alloc_isa_irq_from_domain()
1005 info->ioapic.pin)) in alloc_isa_irq_from_domain()
1021 static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, in mp_map_pin_to_irq() argument
1028 struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); in mp_map_pin_to_irq()
1056 ioapic_copy_alloc_attr(&tmp, info, gsi, ioapic, pin); in mp_map_pin_to_irq()
1059 ioapic, pin, &tmp); in mp_map_pin_to_irq()
1061 irq = alloc_irq_from_domain(domain, ioapic, gsi, &tmp); in mp_map_pin_to_irq()
1074 static int pin_2_irq(int idx, int ioapic, int pin, unsigned int flags) in pin_2_irq() argument
1076 u32 gsi = mp_pin_to_gsi(ioapic, pin); in pin_2_irq()
1104 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, NULL); in pin_2_irq()
1109 int ioapic, pin, idx; in mp_map_gsi_to_irq() local
1111 ioapic = mp_find_ioapic(gsi); in mp_map_gsi_to_irq()
1112 if (ioapic < 0) in mp_map_gsi_to_irq()
1115 pin = mp_find_ioapic_pin(ioapic, gsi); in mp_map_gsi_to_irq()
1116 idx = find_irq_entry(ioapic, pin, mp_INT); in mp_map_gsi_to_irq()
1120 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, info); in mp_map_gsi_to_irq()
1208 unsigned int ioapic, pin; in setup_IO_APIC_irqs() local
1213 for_each_ioapic_pin(ioapic, pin) { in setup_IO_APIC_irqs()
1214 idx = find_irq_entry(ioapic, pin, mp_INT); in setup_IO_APIC_irqs()
1218 mpc_ioapic_id(ioapic), pin); in setup_IO_APIC_irqs()
1220 pin_2_irq(idx, ioapic, pin, in setup_IO_APIC_irqs()
1221 ioapic ? 0 : IOAPIC_MAP_ALLOC); in setup_IO_APIC_irqs()
2140 static int mp_alloc_timer_irq(int ioapic, int pin) in mp_alloc_timer_irq() argument
2143 struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); in mp_alloc_timer_irq()
2149 info.devid = mpc_ioapic_id(ioapic); in mp_alloc_timer_irq()
2150 info.ioapic.pin = pin; in mp_alloc_timer_irq()
2152 irq = alloc_isa_irq_from_domain(domain, 0, ioapic, pin, &info); in mp_alloc_timer_irq()
2334 static int mp_irqdomain_create(int ioapic) in mp_irqdomain_create() argument
2337 int hwirqs = mp_ioapic_pin_count(ioapic); in mp_irqdomain_create()
2338 struct ioapic *ip = &ioapics[ioapic]; in mp_irqdomain_create()
2340 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_irqdomain_create()
2351 fn = irq_domain_alloc_named_id_fwnode("IO-APIC", mpc_ioapic_id(ioapic)); in mp_irqdomain_create()
2358 fwspec.param[0] = mpc_ioapic_id(ioapic); in mp_irqdomain_create()
2368 (void *)(long)ioapic); in mp_irqdomain_create()
2402 int ioapic; in setup_IO_APIC() local
2410 for_each_ioapic(ioapic) in setup_IO_APIC()
2411 BUG_ON(mp_irqdomain_create(ioapic)); in setup_IO_APIC()
2465 static int io_apic_get_redir_entries(int ioapic) in io_apic_get_redir_entries() argument
2471 reg_01.raw = io_apic_read(ioapic, 1); in io_apic_get_redir_entries()
2497 static int io_apic_get_unique_id(int ioapic, int apic_id) in io_apic_get_unique_id() argument
2518 reg_00.raw = io_apic_read(ioapic, 0); in io_apic_get_unique_id()
2523 "%d\n", ioapic, apic_id, reg_00.bits.ID); in io_apic_get_unique_id()
2542 "trying %d\n", ioapic, apic_id, i); in io_apic_get_unique_id()
2554 io_apic_write(ioapic, 0, reg_00.raw); in io_apic_get_unique_id()
2555 reg_00.raw = io_apic_read(ioapic, 0); in io_apic_get_unique_id()
2561 ioapic); in io_apic_get_unique_id()
2567 "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); in io_apic_get_unique_id()
2628 static int io_apic_get_version(int ioapic) in io_apic_get_version() argument
2634 reg_01.raw = io_apic_read(ioapic, 1); in io_apic_get_version()
2774 int mp_find_ioapic_pin(int ioapic, u32 gsi) in mp_find_ioapic_pin() argument
2778 if (WARN_ON(ioapic < 0)) in mp_find_ioapic_pin()
2781 gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_find_ioapic_pin()
2830 int idx, ioapic, entries; in mp_register_ioapic() local
2837 for_each_ioapic(ioapic) in mp_register_ioapic()
2838 if (ioapics[ioapic].mp_config.apicaddr == address) { in mp_register_ioapic()
2840 address, ioapic); in mp_register_ioapic()
2870 for_each_ioapic(ioapic) { in mp_register_ioapic()
2871 gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_register_ioapic()
2921 int ioapic, pin; in mp_unregister_ioapic() local
2924 for_each_ioapic(ioapic) in mp_unregister_ioapic()
2925 if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) { in mp_unregister_ioapic()
2934 for_each_pin(ioapic, pin) { in mp_unregister_ioapic()
2935 u32 gsi = mp_pin_to_gsi(ioapic, pin); in mp_unregister_ioapic()
2943 pin, ioapic); in mp_unregister_ioapic()
2950 ioapics[ioapic].nr_registers = 0; in mp_unregister_ioapic()
2951 ioapic_destroy_irqdomain(ioapic); in mp_unregister_ioapic()
2952 free_ioapic_saved_registers(ioapic); in mp_unregister_ioapic()
2953 if (ioapics[ioapic].iomem_res) in mp_unregister_ioapic()
2954 release_resource(ioapics[ioapic].iomem_res); in mp_unregister_ioapic()
2955 clear_fixmap(FIX_IO_APIC_BASE_0 + ioapic); in mp_unregister_ioapic()
2956 memset(&ioapics[ioapic], 0, sizeof(ioapics[ioapic])); in mp_unregister_ioapic()
2963 int ioapic; in mp_ioapic_registered() local
2965 for_each_ioapic(ioapic) in mp_ioapic_registered()
2966 if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) in mp_ioapic_registered()
2975 if (info && info->ioapic.valid) { in mp_irqdomain_get_attr()
2976 data->is_level = info->ioapic.is_level; in mp_irqdomain_get_attr()
2977 data->active_low = info->ioapic.active_low; in mp_irqdomain_get_attr()
3018 int ret, ioapic, pin; in mp_irqdomain_alloc() local
3027 ioapic = mp_irqdomain_ioapic_idx(domain); in mp_irqdomain_alloc()
3028 pin = info->ioapic.pin; in mp_irqdomain_alloc()
3043 irq_data->hwirq = info->ioapic.pin; in mp_irqdomain_alloc()
3047 mp_irqdomain_get_attr(mp_pin_to_gsi(ioapic, pin), data, info); in mp_irqdomain_alloc()
3049 add_pin_to_irq_node(data, ioapic_alloc_attr_node(info), ioapic, pin); in mp_irqdomain_alloc()
3061 ioapic, mpc_ioapic_id(ioapic), pin, virq, in mp_irqdomain_alloc()