Lines Matching refs:ioapic
107 static struct ioapic { struct
142 static inline int mp_ioapic_pin_count(int ioapic) in mp_ioapic_pin_count() argument
144 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_ioapic_pin_count()
149 static inline u32 mp_pin_to_gsi(int ioapic, int pin) in mp_pin_to_gsi() argument
151 return mp_ioapic_gsi_routing(ioapic)->gsi_base + pin; in mp_pin_to_gsi()
159 static inline struct irq_domain *mp_ioapic_irqdomain(int ioapic) in mp_ioapic_irqdomain() argument
161 return ioapics[ioapic].irqdomain; in mp_ioapic_irqdomain()
832 int ioapic, pin, idx; in __acpi_get_override_irq() local
837 ioapic = mp_find_ioapic(gsi); in __acpi_get_override_irq()
838 if (ioapic < 0) in __acpi_get_override_irq()
841 pin = mp_find_ioapic_pin(ioapic, gsi); in __acpi_get_override_irq()
845 idx = find_irq_entry(ioapic, pin, mp_INT); in __acpi_get_override_irq()
868 info->ioapic.node = node; in ioapic_set_alloc_attr()
869 info->ioapic.is_level = trigger; in ioapic_set_alloc_attr()
870 info->ioapic.active_low = polarity; in ioapic_set_alloc_attr()
871 info->ioapic.valid = 1; in ioapic_set_alloc_attr()
883 dst->ioapic.pin = pin; in ioapic_copy_alloc_attr()
884 dst->ioapic.valid = 1; in ioapic_copy_alloc_attr()
885 if (src && src->ioapic.valid) { in ioapic_copy_alloc_attr()
886 dst->ioapic.node = src->ioapic.node; in ioapic_copy_alloc_attr()
887 dst->ioapic.is_level = src->ioapic.is_level; in ioapic_copy_alloc_attr()
888 dst->ioapic.active_low = src->ioapic.active_low; in ioapic_copy_alloc_attr()
890 dst->ioapic.node = NUMA_NO_NODE; in ioapic_copy_alloc_attr()
892 dst->ioapic.is_level = level; in ioapic_copy_alloc_attr()
893 dst->ioapic.active_low = pol_low; in ioapic_copy_alloc_attr()
899 dst->ioapic.is_level = true; in ioapic_copy_alloc_attr()
900 dst->ioapic.active_low = true; in ioapic_copy_alloc_attr()
907 return (info && info->ioapic.valid) ? info->ioapic.node : NUMA_NO_NODE; in ioapic_alloc_attr_node()
937 if (info->ioapic.is_level != data->is_level) in mp_check_pin_attr()
938 mp_register_handler(irq, info->ioapic.is_level); in mp_check_pin_attr()
939 data->entry.is_level = data->is_level = info->ioapic.is_level; in mp_check_pin_attr()
940 data->entry.active_low = data->active_low = info->ioapic.active_low; in mp_check_pin_attr()
943 return data->is_level == info->ioapic.is_level && in mp_check_pin_attr()
944 data->active_low == info->ioapic.active_low; in mp_check_pin_attr()
947 static int alloc_irq_from_domain(struct irq_domain *domain, int ioapic, u32 gsi, in alloc_irq_from_domain() argument
952 int type = ioapics[ioapic].irqdomain_cfg.type; in alloc_irq_from_domain()
990 int irq, int ioapic, int pin, in alloc_isa_irq_from_domain() argument
1005 if (__add_pin_to_irq_node(irq_data->chip_data, node, ioapic, in alloc_isa_irq_from_domain()
1006 info->ioapic.pin)) in alloc_isa_irq_from_domain()
1022 static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, in mp_map_pin_to_irq() argument
1029 struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); in mp_map_pin_to_irq()
1057 ioapic_copy_alloc_attr(&tmp, info, gsi, ioapic, pin); in mp_map_pin_to_irq()
1060 ioapic, pin, &tmp); in mp_map_pin_to_irq()
1062 irq = alloc_irq_from_domain(domain, ioapic, gsi, &tmp); in mp_map_pin_to_irq()
1075 static int pin_2_irq(int idx, int ioapic, int pin, unsigned int flags) in pin_2_irq() argument
1077 u32 gsi = mp_pin_to_gsi(ioapic, pin); in pin_2_irq()
1105 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, NULL); in pin_2_irq()
1110 int ioapic, pin, idx; in mp_map_gsi_to_irq() local
1112 ioapic = mp_find_ioapic(gsi); in mp_map_gsi_to_irq()
1113 if (ioapic < 0) in mp_map_gsi_to_irq()
1116 pin = mp_find_ioapic_pin(ioapic, gsi); in mp_map_gsi_to_irq()
1117 idx = find_irq_entry(ioapic, pin, mp_INT); in mp_map_gsi_to_irq()
1121 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, info); in mp_map_gsi_to_irq()
1209 unsigned int ioapic, pin; in setup_IO_APIC_irqs() local
1214 for_each_ioapic_pin(ioapic, pin) { in setup_IO_APIC_irqs()
1215 idx = find_irq_entry(ioapic, pin, mp_INT); in setup_IO_APIC_irqs()
1219 mpc_ioapic_id(ioapic), pin); in setup_IO_APIC_irqs()
1221 pin_2_irq(idx, ioapic, pin, in setup_IO_APIC_irqs()
1222 ioapic ? 0 : IOAPIC_MAP_ALLOC); in setup_IO_APIC_irqs()
2137 static int mp_alloc_timer_irq(int ioapic, int pin) in mp_alloc_timer_irq() argument
2140 struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); in mp_alloc_timer_irq()
2146 info.devid = mpc_ioapic_id(ioapic); in mp_alloc_timer_irq()
2147 info.ioapic.pin = pin; in mp_alloc_timer_irq()
2149 irq = alloc_isa_irq_from_domain(domain, 0, ioapic, pin, &info); in mp_alloc_timer_irq()
2331 static int mp_irqdomain_create(int ioapic) in mp_irqdomain_create() argument
2334 int hwirqs = mp_ioapic_pin_count(ioapic); in mp_irqdomain_create()
2335 struct ioapic *ip = &ioapics[ioapic]; in mp_irqdomain_create()
2337 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_irqdomain_create()
2348 fn = irq_domain_alloc_named_id_fwnode("IO-APIC", mpc_ioapic_id(ioapic)); in mp_irqdomain_create()
2355 fwspec.param[0] = mpc_ioapic_id(ioapic); in mp_irqdomain_create()
2365 (void *)(long)ioapic); in mp_irqdomain_create()
2396 int ioapic; in setup_IO_APIC() local
2404 for_each_ioapic(ioapic) in setup_IO_APIC()
2405 BUG_ON(mp_irqdomain_create(ioapic)); in setup_IO_APIC()
2459 static int io_apic_get_redir_entries(int ioapic) in io_apic_get_redir_entries() argument
2465 reg_01.raw = io_apic_read(ioapic, 1); in io_apic_get_redir_entries()
2495 static int io_apic_get_unique_id(int ioapic, int apic_id) in io_apic_get_unique_id() argument
2516 reg_00.raw = io_apic_read(ioapic, 0); in io_apic_get_unique_id()
2521 "%d\n", ioapic, apic_id, reg_00.bits.ID); in io_apic_get_unique_id()
2540 "trying %d\n", ioapic, apic_id, i); in io_apic_get_unique_id()
2552 io_apic_write(ioapic, 0, reg_00.raw); in io_apic_get_unique_id()
2553 reg_00.raw = io_apic_read(ioapic, 0); in io_apic_get_unique_id()
2559 ioapic); in io_apic_get_unique_id()
2565 "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); in io_apic_get_unique_id()
2626 static int io_apic_get_version(int ioapic) in io_apic_get_version() argument
2632 reg_01.raw = io_apic_read(ioapic, 1); in io_apic_get_version()
2777 int mp_find_ioapic_pin(int ioapic, u32 gsi) in mp_find_ioapic_pin() argument
2781 if (WARN_ON(ioapic < 0)) in mp_find_ioapic_pin()
2784 gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_find_ioapic_pin()
2833 int idx, ioapic, entries; in mp_register_ioapic() local
2840 for_each_ioapic(ioapic) in mp_register_ioapic()
2841 if (ioapics[ioapic].mp_config.apicaddr == address) { in mp_register_ioapic()
2843 address, ioapic); in mp_register_ioapic()
2873 for_each_ioapic(ioapic) { in mp_register_ioapic()
2874 gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_register_ioapic()
2924 int ioapic, pin; in mp_unregister_ioapic() local
2927 for_each_ioapic(ioapic) in mp_unregister_ioapic()
2928 if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) { in mp_unregister_ioapic()
2937 for_each_pin(ioapic, pin) { in mp_unregister_ioapic()
2938 u32 gsi = mp_pin_to_gsi(ioapic, pin); in mp_unregister_ioapic()
2946 pin, ioapic); in mp_unregister_ioapic()
2953 ioapics[ioapic].nr_registers = 0; in mp_unregister_ioapic()
2954 ioapic_destroy_irqdomain(ioapic); in mp_unregister_ioapic()
2955 free_ioapic_saved_registers(ioapic); in mp_unregister_ioapic()
2956 if (ioapics[ioapic].iomem_res) in mp_unregister_ioapic()
2957 release_resource(ioapics[ioapic].iomem_res); in mp_unregister_ioapic()
2958 clear_fixmap(FIX_IO_APIC_BASE_0 + ioapic); in mp_unregister_ioapic()
2959 memset(&ioapics[ioapic], 0, sizeof(ioapics[ioapic])); in mp_unregister_ioapic()
2966 int ioapic; in mp_ioapic_registered() local
2968 for_each_ioapic(ioapic) in mp_ioapic_registered()
2969 if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) in mp_ioapic_registered()
2978 if (info && info->ioapic.valid) { in mp_irqdomain_get_attr()
2979 data->is_level = info->ioapic.is_level; in mp_irqdomain_get_attr()
2980 data->active_low = info->ioapic.active_low; in mp_irqdomain_get_attr()
3021 int ret, ioapic, pin; in mp_irqdomain_alloc() local
3030 ioapic = mp_irqdomain_ioapic_idx(domain); in mp_irqdomain_alloc()
3031 pin = info->ioapic.pin; in mp_irqdomain_alloc()
3046 irq_data->hwirq = info->ioapic.pin; in mp_irqdomain_alloc()
3050 mp_irqdomain_get_attr(mp_pin_to_gsi(ioapic, pin), data, info); in mp_irqdomain_alloc()
3052 add_pin_to_irq_node(data, ioapic_alloc_attr_node(info), ioapic, pin); in mp_irqdomain_alloc()
3064 ioapic, mpc_ioapic_id(ioapic), pin, virq, in mp_irqdomain_alloc()