arch/x86: Generalize dynamic irq connection on given vector

This will be used by MSI multi-vector implementation to connect the irq
and the vector prior to allocation.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
diff --git a/arch/x86/core/intel64/irq.c b/arch/x86/core/intel64/irq.c
index af6f19c..2c8c86a 100644
--- a/arch/x86/core/intel64/irq.c
+++ b/arch/x86/core/intel64/irq.c
@@ -80,6 +80,17 @@
 	return -1;
 }
 
+void z_x86_irq_connect_on_vector(unsigned int irq,
+				 uint8_t vector,
+				 void (*func)(const void *arg),
+				 const void *arg, uint32_t flags)
+{
+	_irq_to_interrupt_vector[irq] = vector;
+	z_irq_controller_irq_config(vector, irq, flags);
+	x86_irq_funcs[vector - IV_IRQS] = func;
+	x86_irq_args[vector - IV_IRQS] = arg;
+}
+
 /*
  * N.B.: the API docs don't say anything about returning error values, but
  * this function returns -1 if a vector at the specific priority can't be
@@ -99,10 +110,7 @@
 
 	vector = z_x86_allocate_vector(priority, -1);
 	if (vector >= 0) {
-		_irq_to_interrupt_vector[irq] = vector;
-		z_irq_controller_irq_config(vector, irq, flags);
-		x86_irq_funcs[vector - IV_IRQS] = func;
-		x86_irq_args[vector - IV_IRQS] = arg;
+		z_x86_irq_connect_on_vector(irq, vector, func, arg, flags);
 	}
 
 	irq_unlock(key);
diff --git a/arch/x86/include/kernel_arch_func.h b/arch/x86/include/kernel_arch_func.h
index 15be051..a0919e6 100644
--- a/arch/x86/include/kernel_arch_func.h
+++ b/arch/x86/include/kernel_arch_func.h
@@ -100,6 +100,14 @@
  */
 int z_x86_allocate_vector(unsigned int priority, int prev_vector);
 
+/*
+ * Connect a vector
+ */
+void z_x86_irq_connect_on_vector(unsigned int irq,
+				 uint8_t vector,
+				 void (*func)(const void *arg),
+				 const void *arg, uint32_t flags);
+
 #endif /* !_ASMLANGUAGE */
 
 #endif /* ZEPHYR_ARCH_X86_INCLUDE_KERNEL_ARCH_FUNC_H_ */